Getting the role of the current user

Viewpoint
Enthusiast

Getting the role of the current user

Hi,
I need the role of a user in my code so can anyone tell me as how to get the role of the current user?

Thanks in advance.
Tags (2)
6 REPLIES
Teradata Employee

Re: Getting the role of the current user

Can you explain what you need the roles of your user for? The security system that is part of Viewpoint is the only component that should have to be aware of a user's roles.

Re: Getting the role of the current user

i didn't get your request clearly.

you can get the role of a user from the below query

sel * from dbc.rolemembers where grantee= 'xxxxxxx'

Please give some more inputs to help u better.

Thanks
Pradeep

Enthusiast

Re: Getting the role of the current user

I am developing a viewpoint portlet. Now I am asked to make a preferences area for the portlet which is accessible through Admin--> Roles Manager--> Portlets, so that the admin is able to set the defaults. I have noticed that calling any ajax request for preferences from the Roles Manager area, I need to send the role of the current user. Currently I have hard coded it to "user". I want to set it dynamically by getting the role of the current User.
Enthusiast

Re: Getting the role of the current user

DBC.Users contains the default rolename for any user.
When a user logs on, a record is created for every session in DBC.SessionInfo - this also contains the username and rolename for that session.
If a user changes his role within a session, the rolename will be updated in here. Sessioninfo entries only exist while the user is logged on.

I dont know of anything which will tell you what role a user was using yesterday or last week - Roles are not that important in their own right. They are simply a convenience for managing rights!

HTH
Teradata Employee

Re: Getting the role of the current user

The current user could have many roles. What you want to do is specify the role for which you are currently configuring the default preferences. This value is already in the page scope under the "role" variable. You can access it in your JSP via the following EL expression: ${role}
Enthusiast

Re: Getting the role of the current user

Thanks Stever! that helped.