Topic
  • 4 replies
  • Latest Post - ‏2013-01-11T16:12:33Z by SystemAdmin
SystemAdmin
SystemAdmin
30895 Posts

Pinned topic How to check logged in user belongs to specified Privileged User group

‏2013-01-07T21:10:24Z |
I really appreciate for your help ...

In JSR286 Portlet i need to show some functionality based on role access.

I gave Privileged user Grant Access to Group, XXXX user belongs to this group, how i can check this logged in user have privileged user role and show the functionality based on this role.

Thanks
Updated on 2013-01-11T16:12:33Z at 2013-01-11T16:12:33Z by SystemAdmin
  • JMW98
    JMW98
    1097 Posts

    Re: How to check logged in user belongs to specified Privileged User group

    ‏2013-01-08T14:43:22Z  
    There are a couple of interfaces for accessing PAC. The first is the SPI (focus on AccessControlRuntimeModel):

    http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Portal_Access_Control_SPI_wp7

    The other is the REST service:

    http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Portal_Access_Control_REST_API_wp7

    where you could use something like:

    /wps/mycontenthandler/ac/access:oid:Z6_GPC7EVO20GLOE0I785OOGF1003

    to see what rights the current user has on the resource.
  • SystemAdmin
    SystemAdmin
    30895 Posts

    Re: How to check logged in user belongs to specified Privileged User group

    ‏2013-01-08T16:03:05Z  
    • JMW98
    • ‏2013-01-08T14:43:22Z
    There are a couple of interfaces for accessing PAC. The first is the SPI (focus on AccessControlRuntimeModel):

    http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Portal_Access_Control_SPI_wp7

    The other is the REST service:

    http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Portal_Access_Control_REST_API_wp7

    where you could use something like:

    /wps/mycontenthandler/ac/access:oid:Z6_GPC7EVO20GLOE0I785OOGF1003

    to see what rights the current user has on the resource.
    Thanks JMW98 for responding to this.

    Here the SPI is for Portal Access Contorl (PAC).

    How i can check whether logged in user belongs to Privileged User role group.

    Thanks
  • SystemAdmin
    SystemAdmin
    30895 Posts

    Re: How to check logged in user belongs to specified Privileged User group

    ‏2013-01-08T21:39:24Z  
    • JMW98
    • ‏2013-01-08T14:43:22Z
    There are a couple of interfaces for accessing PAC. The first is the SPI (focus on AccessControlRuntimeModel):

    http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Portal_Access_Control_SPI_wp7

    The other is the REST service:

    http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Portal_Access_Control_REST_API_wp7

    where you could use something like:

    /wps/mycontenthandler/ac/access:oid:Z6_GPC7EVO20GLOE0I785OOGF1003

    to see what rights the current user has on the resource.
    Hi JMW98

    Identifiable resource = ... ; // some resource, for example a portlet
    Principal bob = ... ; // some principal, for example Bob
    Context ctx = new InitialContext();
    AccessControlHome home = (AccessControlHome) ctx.lookup(AccessControlHome.JNDI_NAME);
    AccessControlRuntimeModel runtimeModel = home.getAccessControlRuntimeModel(resource);
    boolean isAllowed = runtimeModel.isAllowed(bob, RoleType.USER);

    // the following is equivalent
    AccessControlEnvironment environment = home.getAccessControlEnvironment();
    Permission permission = environment.getPermission(resource, RoleType.USER);
    AccessControlGlobalRuntimeModel gobalModel = home.getAccessControlGlobalRuntimeModel();
    isAllowed = globalModel.hasPermission(bob, permission);

    how i can get resource and Prinipal here ?
  • SystemAdmin
    SystemAdmin
    30895 Posts

    Re: How to check logged in user belongs to specified Privileged User group

    ‏2013-01-11T16:12:33Z  
    • JMW98
    • ‏2013-01-08T14:43:22Z
    There are a couple of interfaces for accessing PAC. The first is the SPI (focus on AccessControlRuntimeModel):

    http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Portal_Access_Control_SPI_wp7

    The other is the REST service:

    http://www-10.lotus.com/ldd/portalwiki.nsf/dx/Portal_Access_Control_REST_API_wp7

    where you could use something like:

    /wps/mycontenthandler/ac/access:oid:Z6_GPC7EVO20GLOE0I785OOGF1003

    to see what rights the current user has on the resource.
    Hi JMW98

    Can you please tell me how i can get Identifiable resource ... and Principal bob.

    Identifiable resource = ... ;
    Principal bob =...;