Forgive me if this has been covered before. I am implementing a login/security scheme through the use of GUF and SQL methods. My user and role information is kept in a SQL database and a user can have more than one role assigned to him/her. What I would like to do is check if a specific role has been assigned to the current user, and then display some additional menu items if that role has been assigned. I haven't been able to figure out how to get and check the roles that have been assigned to the current user. As usual, any help will be greatly appreciated. -=Brad=-
Mabe, Brad writes:
Forgive me if this has been covered before.
There's no real great documentation on using the security API, and it's changing a bit anyway.
I am implementing a login/security scheme through the use of GUF and SQL methods. My user and role information is kept in a SQL database and a user can have more than one role assigned to him/her.
What I would like to do is check if a specific role has been assigned to the current user, and then display some additional menu items if that role has been assigned. I haven't been able to figure out how to get and check the roles that have been assigned to the current user.
As usual, any help will be greatly appreciated.
-=Brad=-
try: <dtml-if "AUTHENTICATED_USER.has_role('MyRole')"> My stuff </dtml-if> Jason Spisak CIO HireTechs.com 6151 West Century Boulevard Suite 900 Los Angeles, CA 90045 P. 310.665.3444 F. 310.665.3544 Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
On Thu, 8 Jun 2000, Mabe, Brad wrote:
Forgive me if this has been covered before.
I am implementing a login/security scheme through the use of GUF and SQL methods. My user and role information is kept in a SQL database and a user can have more than one role assigned to him/her.
What I would like to do is check if a specific role has been assigned to the current user, and then display some additional menu items if that role has been assigned. I haven't been able to figure out how to get and check the roles that have been assigned to the current user.
As usual, any help will be greatly appreciated.
(untested) <dtml-if "'myrole' in AUTHENTICATED_USER.getRolesInContext(this())"> User has the myrole role </dtml-if> getRoles is also there if you don't want to check for local roles. -- Stuart Bishop Work: zen@cs.rmit.edu.au Senior Systems Alchemist Play: zen@shangri-la.dropbear.id.au Computer Science, RMIT University
participants (3)
-
Jason Spisak -
Mabe, Brad -
Stuart 'Zen' Bishop