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.
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 2000000MY61144 Posts
Re: How to check logged in user belongs to specified Privileged User group2013-01-08T14:43:22ZThis is the accepted answer. This is the accepted answer.There 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:05ZThis is the accepted answer. This is the accepted answer.
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:24ZThis is the accepted answer. This is the accepted answer.
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 ?
Re: How to check logged in user belongs to specified Privileged User group2013-01-11T16:12:33ZThis is the accepted answer. This is the accepted answer.
Can you please tell me how i can get Identifiable resource ... and Principal bob.
Identifiable resource = ... ;
Principal bob =...;