[jboss-user] [JBoss Portal] - Re: isUserInRole(String role) doesn't work

julien@jboss.com do-not-reply at jboss.com
Wed Apr 18 15:07:42 EDT 2007


Here is the implementation of isUserInRole(String roleName) :


  |    public boolean isUserInRole(String roleName)
  |    {
  |       // Get the map role name to role link
  |       Map securityRoleRefsMap = ((PortletContainerImpl)((ContainerPortletInfo)(PortletInfo)invocation.getAttribute(PortletInvocation.INVOCATION_SCOPE, PortletContainerInvoker.PORTLET_CONTAINER_INFO)).getContainer()).getSecurityRoleRefsMap();
  | 
  |       // Process the role link
  |       String roleLink = (String)securityRoleRefsMap.get(roleName);
  |       if (roleLink == null)
  |       {
  |          if (securityRoleRefsMap.containsKey(roleName))
  |          {
  |             // The role name exist without a role link value
  |             return securityContext.isUserInRole(roleName);
  |          }
  |          else
  |          {
  |             // No role name is defined
  |             return false;
  |          }
  |       }
  |       else
  |       {
  |          // We have the role link value
  |          return securityContext.isUserInRole(roleLink);
  |       }
  |    }
  | 


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4038597#4038597

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4038597



More information about the jboss-user mailing list