• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@RolesAllowed

 
Pavani Sharma Nookala
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to use annotation on both class and method. I do not know how to inherit the role on class to annotation on method

EXAMPLE:

I would like for the admin also to access the home method.
I do not want to declare admin role on the method.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Pavani Sharma Nookala,

Welcome to Javaranch!

Pavani Sharma Nookala wrote:
I would like for the admin also to access the home method.
I do not want to declare admin role on the method.

First of all: why don't you want that?

An annotation on a method overrides the annotation on the class.

From the EJB specs:
Specifying the RolesAllowed or PermitAll or DenyAll annotation on the bean class means that it applies to all applicable business methods of the class.
Method permissions may be specified on a method of the bean class to override the method permissions value specified on the bean class.

Regards,
Frits
 
Pavani Sharma Nookala
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply Frits Walraven . That answers my question. But let me put the same question in another way.

For example if i have 10 to 15 roles is there any way to deny access for maybe 1 or 2 roles. Like @Deny(value = "someRole") or @RolesNotAllowed(value = "")
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For example if i have 10 to 15 roles is there any way to deny access for maybe 1 or 2 roles. Like @Deny(value = "someRole") or @RolesNotAllowed(value = "")

No, there are no annotations like that, but you can always allow the other 13 roles

Regards,
Frits
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic