You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Matt Raible <ma...@yahoo.com> on 2001/08/21 16:23:08 UTC

logic:present role="RoleName" not working??

I have the following scriptlet that returns the correct values:

<%
if (request.isUserInRole("Administrators")) {
	out.println("Administrator");
} else if (request.isUserInRole("Employees")) {
	out.println("Employee");
}
%>

And I was hopeing to use the logic:present tag to achieve the same results. 
However, the following prints out both roles no matter what.

<strutslogic:present role="Administrators" />
Administrator
</strutslogic:present>
<strutslogic:present role="Employees" />
Employees
</strutslogic:present>


On another note, the "Employees" groups contains the "Administrators" group -
how is it possible to create a hierarchy so that
request.isUserInRole("Employees")) returns true for an administrator?

Thanks,

Matt

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

Re: logic:present role="RoleName" not working??

Posted by Matt Raible <ma...@yahoo.com>.
I figured it out - I was closing the "present" tag before printing out values.

--- Matt Raible <ma...@yahoo.com> wrote:
> I have the following scriptlet that returns the correct values:
> 
> <%
> if (request.isUserInRole("Administrators")) {
> 	out.println("Administrator");
> } else if (request.isUserInRole("Employees")) {
> 	out.println("Employee");
> }
> %>
> 
> And I was hopeing to use the logic:present tag to achieve the same results. 
> However, the following prints out both roles no matter what.
> 
> <strutslogic:present role="Administrators" />
> Administrator
> </strutslogic:present>
> <strutslogic:present role="Employees" />
> Employees
> </strutslogic:present>
> 
> 
> On another note, the "Employees" groups contains the "Administrators" group -
> how is it possible to create a hierarchy so that
> request.isUserInRole("Employees")) returns true for an administrator?
> 
> Thanks,
> 
> Matt
> 
> __________________________________________________
> Do You Yahoo!?
> Make international calls for as low as $.04/minute with Yahoo! Messenger
> http://phonecard.yahoo.com/


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/