• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

@RolesAllowed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic