Monday, June 13, 2011

PumaEnvironment's runUnrestricted

All the users in portal having some access rights associated with it. So this restricts users to update and look for the other users & groups attributes value.
So the solution in this scenario is – run your code as admin.
This can be done through PumaEnvironment's runUnrestricted method.
See the sample code below –

PumaEnvironment pe = pumaHome.getEnvironment();
try {
    pe.runUnrestricted(new PrivilegedExceptionAction() {
        public Object run() {
            //write your logic here to find groups

            return null;
        }
    });
} catch (PrivilegedActionException e) {
    throw e;
}

No comments:

Post a Comment