Bug 22895 - [PATCH] <req:isUserInRole> upgrade to support multiple roles
Summary: [PATCH] <req:isUserInRole> upgrade to support multiple roles
Alias: None
Product: Taglibs
Classification: Unclassified
Component: Request Taglib (show other bugs)
Version: 1.0.1
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Keywords: PatchAvailable
Depends on:
Reported: 2003-09-02 18:55 UTC by Matthew Sgarlata
Modified: 2011-02-11 06:04 UTC (History)
1 user (show)

Patch for isUserInRoleTag.java (2.36 KB, patch)
2003-09-02 18:55 UTC, Matthew Sgarlata
Details | Diff
Patch for xml\request.xml (documentation for the tag) (2.52 KB, patch)
2003-09-02 18:57 UTC, Matthew Sgarlata
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Sgarlata 2003-09-02 18:55:25 UTC
I think the user should be able to specify a comma-separated list of roles 
instead of a single role like this:

<req:isUserInRole role="role1,admin">
  The remote user is in role "role1" or in role "admin".
<req:isUserInRole role="role1,admin" value="false">
  The remote user is neither in role "role1" nor in role "admin".

There currently really is no clean way to do a check like this.  The attached 
patches add this capability and also update the documentation (or at least the 
documentation I could find).

I also considered that a more complex syntax with parantheses, and operators 
for AND, OR, and NOT could be useful, but decided they weren't really 
necessary.  NOT can be simulated using the value="" attribute, and AND can be 
simulated by nesting multiple <req:isUserInRole> tags within each-other.  I 
also think a mini expression language like this would be overkill for this tag 
which is currently very simple.
Comment 1 Matthew Sgarlata 2003-09-02 18:55:57 UTC
Created attachment 8037 [details]
Patch for isUserInRoleTag.java
Comment 2 Matthew Sgarlata 2003-09-02 18:57:19 UTC
Created attachment 8038 [details]
Patch for xml\request.xml (documentation for the tag)
Comment 3 Matthew Sgarlata 2003-09-02 19:06:50 UTC
added PatchAvailable keywords and [PATCH] to subject line
Comment 4 Rahul Akolkar 2005-09-24 17:24:57 UTC
Thank you for suggesting this enhancement and providing a patch. IMO, it is a 
useful suggestion.

However, the request taglib has been deprecated, we do not expect any
development around it in the near future.