Search in sources :

Example 1 with IPermissionSet

use of org.apereo.portal.security.IPermissionSet in project uPortal by Jasig.

the class AuthorizationImpl method primGetPermissionsForPrincipal.

/**
     * Returns permissions for a principal. First check the entity caching service, and if the
     * permissions have not been cached, retrieve and cache them.
     *
     * @return IPermission[]
     * @param principal org.apereo.portal.security.IAuthorizationPrincipal
     */
private IPermission[] primGetPermissionsForPrincipal(IAuthorizationPrincipal principal) throws AuthorizationException {
    if (!this.cachePermissions) {
        return getUncachedPermissionsForPrincipal(principal, null, null, null);
    }
    IPermissionSet ps = null;
    // Check the caching service for the Permissions first.
    ps = cacheGet(principal);
    if (ps == null)
        synchronized (principal) {
            ps = cacheGet(principal);
            if (ps == null) {
                IPermission[] permissions = getUncachedPermissionsForPrincipal(principal, null, null, null);
                ps = new PermissionSetImpl(permissions, principal);
                cacheAdd(ps);
            }
        }
    // end synchronized
    return ps.getPermissions();
}
Also used : IPermissionSet(org.apereo.portal.security.IPermissionSet)

Aggregations

IPermissionSet (org.apereo.portal.security.IPermissionSet)1