t2v / play2-auth

Play2.x Authentication and Authorization module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Method authorization

viejodecaldas opened this issue · comments

Hi,

I want to know if there is a way to do some method authorization via annotations, like you do in Java, checking the role or the user group.

Thanks in advance!

Hi,

You can create annotation macro like follows.

@authority(Admin)
def index = Action {
  ...
}

convert to

def index = StackAction(AuthorityKey -> Admin) {
  ...
}

Best