File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@RolesAllowed

 
mallika shah
Ranch Hand
Posts: 164
  • 0
  • 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
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • 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
  • 0
  • 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
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HR still overwrites admin.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic