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.
NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
This topic has been locked.
4 replies Latest Post - 2013-01-11T16:12:33Z by SystemAdmin
Pinned topic How to check logged in user belongs to specified Privileged User group
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2013-01-11T16:12:33Z at 2013-01-11T16:12:33Z by SystemAdmin
JMW98 2000000MY61091 PostsACCEPTED ANSWER
Re: How to check logged in user belongs to specified Privileged User group2013-01-08T14:43:22Z in response to SystemAdminThere are a couple of interfaces for accessing PAC. The first is the SPI (focus on AccessControlRuntimeModel):
The other is the REST service:
where you could use something like:
to see what rights the current user has on the resource.
Re: How to check logged in user belongs to specified Privileged User group2013-01-08T16:03:05Z in response to JMW98Thanks 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.
Re: How to check logged in user belongs to specified Privileged User group2013-01-08T21:39:24Z in response to JMW98Hi 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 ?