• Post Reply Bookmark Topic Watch Topic
  • New Topic

@RolesAllowed

 
mallika shah
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@RolesAllowed("admin")
public class SomeClass {
public void aMethod () {...}
public void bMethod () {...}
...
}

@Stateless public class MyBean implements A extends SomeClass {
@RolesAllowed("HR")
public void aMethod () {...}

public void cMethod () {...}
...
}

which role would be allowed for aMethod() ?? both admin and HR , or will HR override admin and the only role allowed for aMethod() would be admin ??

thanks,
mallika
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Method permission on a method overrides the permission set on the class. So HR overrides admin.
 
mallika shah
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks Christophe,
one thing more which i would like to clear is

what if it was like this..

public class SomeClass {
@RolesAllowed("admin")
public void aMethod () {...}
public void bMethod () {...}
...
}

@Stateless public class MyBean implements A extends SomeClass {
@RolesAllowed("HR")
public void aMethod () {...}

public void cMethod () {...}
...
}

would HR still overwrite admin, or MyBean being a subclass of Someclass will have HR and admin both roles allowed for aMethod() ??

thanks,
mallika
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HR still overwrites admin.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!