This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds and have James Denton on-line!
See this thread for details.
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Multiple roles in securit-role-ref  RSS feed

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In my applcation Some of the users belongs to manager1 and some of the users belongs manager2.

The following is the existing code.

if (request.isUserInRole("manager1")) {
//do the process1
}

Now i want to change the code to do the process1 for manager2 also.

so i need to add the following condition in my code:

if (request.isUserInRole("manager2")) {
//do the process1
}

it works fine. But i don't want to change my code frequenlty. Becuase tomorrows i need to add the for managerXYZ for the same process.

so i changed in my servlet code as:

if (request.isUserInRole("MANAGER")) {
//do the process1
}

in the web.xml i changed as follows:

<security-role-ref>
<role-name>MANGAER</role-name>
<role-link>manager1</role-link>
</security-role-ref>

<security-role-ref>
<role-name>MANAGER</role-name>
<role-link>manager2</role-link>
</security-role-ref>

but it is not working as expected way. only manager2 users is successful, not for manager1. I think the manager2 is override the manager1.
How can i make multiple role links pointed to a single role_name.

Please help me.

Thanks
Anna Madhusudhanan
 
author & internet detective
Sheriff
Posts: 38564
654
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anna,
As you've noticed, you can't map different roles to the same role name. Why can't you just assign everyone the manager role directly? You could assign them another role if they need other privileges too.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 38564
654
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anna,
As you've noticed, you can't map different roles to the same role name. Why can't you just assign everyone the manager role directly? You could assign them another role if they need other privileges too.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!