0 Replies Latest reply on Sep 18, 2006 1:31 PM by Rui Cunha

    Problem using security,  checkPermission()

    Rui Cunha Newbie

      I, i was trying o check the check user permissions to portal pages in order to choose which links to display in a portlet. But i'm getting a little problem.

      The code that i use is this:

       MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
       PortalPermissionFactory permissionFactory = (PortalPermissionFactory)MBeanProxy.get(PortalPermissionFactory.class,
      new ObjectName("portal:service=PortalPermissionFactory"), mbeanServer);
      boolean asPermission = permissionFactory.checkPermission(PermissionTypes.PORTAL_OBJECT, uri, PortalObjectPermission.VIEW);

      The problem is, if the page permissions is checked as Uncheck, it return true, but if is checked to a role that the current user belongs it returns false.

      I also tried the way that is described in the Chapter 5 of the Jboss Portal 2.2, and the result is the same.

      I think that the PortalSubject that it uses is not the user that i'm using, for some reason that i can't understand. Do i need to do something before or the portal should know how is the user that is looged in?

      I'm using JBoss AS 4.0.3SP1 and Jboss Portal 2.2.

      Thanks in advance

      Rui Cunha