This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes How get all User's roles in JSP/Servlet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How get all User Watch "How get all User New topic
Author

How get all User's roles in JSP/Servlet?

Robert Paris
Ranch Hand

Joined: Jul 28, 2002
Posts: 585
I know how to check that a user is in a role via: isUserInRole(), but how do I list all of the user's roles?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60740
    
  65

Patience is a virtue.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Robert Paris
Ranch Hand

Joined: Jul 28, 2002
Posts: 585
Anyone?
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Where is the problem.
Tell the details
[ May 17, 2005: Message edited by: Adeel Ansari ]
Robert Paris
Ranch Hand

Joined: Jul 28, 2002
Posts: 585
Originally posted by Adeel Ansari:
Where is the problem.
Tell the details

[ May 17, 2005: Message edited by: Adeel Ansari ]



That is NOT a good description of my post. There's nothing more to be descriptive about.

there is a method: isUserInRole() which checks if a user has the role you pass that method. I want a method that retrieves all the roles the user has/is a ameber of. I cannot find such a method. Is there one?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I don't think there is.
I skimmed both the J2EE API (link in my signature)
and SRV12 in the Servlet Spec (also has a link in my signature).

The only 3 methods that seem to be available to the Servlet programmer are:
  • getRemoteUser
  • isUserInRole
  • getUserPrincipal


  • There also are not any methods for adding users to roles, creating roles, removing etc...
    It seems that the intent of the spec was to keep the management of these deployment issues outside of the actual application.
    [ May 18, 2005: Message edited by: Ben Souther ]

    Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: How get all User's roles in JSP/Servlet?
     
    Similar Threads
    select from a table minus other table?
    ejb-jar.xml roles and Principals - PLEASE HELP!
    SCBCD Time to Evaluate (To Evelyn and Ranchers)
    question about user roles
    Creating users and controlling access based upon roles