• 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

Doubt about isCallerInRole-Question

 
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,

I can't understand the following questions (and answer) from enthuware:

What does the method isCallerInRole do?
a) It tests whether the caller of the bean belongs to the role that is passed as a parameter to this method.
b) It tests whether the caller's role exists in the application's security domain.
c) It tests whether the caller exists in the roles defined by the beans.
d) It tests whether the role passed in as a parameter exists in the application's security domain.



Enthuware says that answer a) is correct, but I don't think that there is a role-parameter which is passed into the method. There is only a @RolesAllowed annotation, which defines the roles that are able to execute the method. So, I think that option c) is the correct one.

Can someone please explain me this?

 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This question is about the isCallerInRole method in javax.ejb.EJBContext. Look at its signature :

public boolean isCallerInRole(String roleName)
Test if the caller has a given security role.
Parameters:
roleName - The name of the security role. The role must be one of the security roles that is defined in the deployment descriptor.
Returns:
True if the caller has the specified role.
 
Christian Nicoll
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Christoph,

thanks for your answer. I'm now able to understand why option a) is the only valid answer for this question.
reply
    Bookmark Topic Watch Topic
  • New Topic