use of org.apache.shiro.authz.AuthorizationInfo in project ddf by codice.
the class AuthzRealm method isPermitted.
/**
* Checks if the corresponding Subject/user implies the given Permissions and returns a boolean
* array indicating which permissions are implied.
* <p/>
* <p/>
* More specifically, this method should determine if each <tt>Permission</tt> in the array is
* {@link Permission#implies(Permission) implied} by permissions already associated with the
* subject.
* <p/>
* <p/>
* This is primarily a performance-enhancing method to help reduce the number of
* {@link #isPermitted} invocations over the wire in client/server systems.
*
* @param subjectPrincipal the application-specific subject/user identifier.
* @param permissions the permissions that are being checked.
* @return an array of booleans whose indices correspond to the index of the permissions in the
* given list. A true value at an index indicates the user is permitted for for the
* associated <tt>Permission</tt> object in the list. A false value at an index
* indicates otherwise.
*/
@Override
public boolean[] isPermitted(PrincipalCollection subjectPrincipal, List<Permission> permissions) {
boolean[] results = new boolean[permissions.size()];
AuthorizationInfo authorizationInfo = getAuthorizationInfo(subjectPrincipal);
List<Permission> expandedPermissions = expandPermissions(permissions);
int i = 0;
for (Permission permission : expandedPermissions) {
results[i++] = isPermitted(subjectPrincipal, permission, authorizationInfo);
}
return results;
}
Aggregations