Refactor tg-check-permission directive to more compact