org.apache.jetspeed.security
Interface PermissionManager


public interface PermissionManager

Describe the interface for managing Permissionand permission association to Principal. Permissions are used to manage Principals access entitlement on specified resources.

The permission manager does not enforce any hierarchy resolution, all relevant principals must be passed to the permission manager to assess the proper permissions.

For instance:


 
  grant principal o.a.j.security.UserPrincipal "theUserPrincipal"
  {
      permission o.a.j.security.PortletPermission "myportlet", "view,edit,minimize,maximize";
  };
  
 
 <pre>

Author:
<a href="mailto:dlestrat@apache.org">David Le Strat</a>

Method Summary
 void addPermission(Permission permission)
           Adds a permission definition.
 boolean checkPermission(Subject subject, Permission permission)
           Check permission for the given subject's access to the resource protected by the permission This is an abstraction introduced in M4 for Permission Manager implementations NOT founded upon the a Java security policy.
 Collection getPermissions()
          Retrieve a collection of all Permissions in the system ordered by Permission Type, resource Note that we return a collection of InternalPrincipal
 Permissions getPermissions(Collection principals)
           Gets the Permissionsgiven a collection of Principal.
 Permissions getPermissions(Principal principal)
           Gets the Permissionsgiven a Principal.
 Permissions getPermissions(String classname, String resource)
          Retrieve a list of all Permissions in the system for a given resource The resource can be a prefix, for example "j2-admin" will retrieve all portlet permissions starting with j2-admin
 Collection getPrincipals(Permission permission)
          Given a permission, return all principals granted to that permission
 void grantPermission(Principal principal, Permission permission)
           Grant a Permissionto a given Principal.
 boolean permissionExists(Permission permission)
           Whether the given permission exists.
 void removePermission(Permission permission)
           Remove all instances of a given permission.
 void removePermissions(Principal principal)
           Remove all permissions for a given principal.
 void revokePermission(Principal principal, Permission permission)
           Revoke a Permissionfrom a given Principal.
 int updatePermission(Permission permission, Collection principals)
          Update the collection of principals on the given principal, appropriately granting or revoking principals to the given permission.
 

Method Detail

getPermissions

Permissions getPermissions(Principal principal)

Gets the Permissionsgiven a Principal.

Parameters:
principal - The principal.
Returns:
The permissions.

getPermissions

Permissions getPermissions(Collection principals)

Gets the Permissionsgiven a collection of Principal.

Parameters:
principals - A collection of principal.
Returns:
The permissions.

addPermission

void addPermission(Permission permission)
                   throws SecurityException

Adds a permission definition.

Parameters:
permission - The permission to add.
Throws:
Throws - a security exception.
SecurityException

removePermission

void removePermission(Permission permission)
                      throws SecurityException

Remove all instances of a given permission.

Parameters:
permission - The permission to remove.
Throws:
Throws - a security exception.
SecurityException

permissionExists

boolean permissionExists(Permission permission)

Whether the given permission exists.

Parameters:
permission - The permission to look for.
Returns:
Whether the permission exists.

removePermissions

void removePermissions(Principal principal)
                       throws SecurityException

Remove all permissions for a given principal.

Parameters:
principal - The principal.
Throws:
Throws - a security exception.
SecurityException

grantPermission

void grantPermission(Principal principal,
                     Permission permission)
                     throws SecurityException

Grant a Permissionto a given Principal.

Parameters:
principal - The principal.
permission - The permission.
Throws:
Throws - a security exception if the principal does not exist.
SecurityException

revokePermission

void revokePermission(Principal principal,
                      Permission permission)
                      throws SecurityException

Revoke a Permissionfrom a given Principal.

Parameters:
principal - The principal.
permission - The permission.
Throws:
Throws - a security exception.
SecurityException

checkPermission

boolean checkPermission(Subject subject,
                        Permission permission)

Check permission for the given subject's access to the resource protected by the permission This is an abstraction introduced in M4 for Permission Manager implementations NOT founded upon the a Java security policy.

Parameters:
subject - The Java subject.
permission - The permission, usually a portlet, page or folder type permission.
Returns:
true if the subject has access to the permission protected resource, false if the subject does not have access.

getPermissions

Collection getPermissions()
Retrieve a collection of all Permissions in the system ordered by Permission Type, resource Note that we return a collection of InternalPrincipal

Returns:
A Java Security collection of InternalPrincipal

getPermissions

Permissions getPermissions(String classname,
                           String resource)
Retrieve a list of all Permissions in the system for a given resource The resource can be a prefix, for example "j2-admin" will retrieve all portlet permissions starting with j2-admin

Returns:
A Java Security collection of Permissions

updatePermission

int updatePermission(Permission permission,
                     Collection principals)
                     throws SecurityException
Update the collection of principals on the given principal, appropriately granting or revoking principals to the given permission.

Parameters:
permission - Permission to be updated
principals - The new collection of principals based on BasePrincipal to be associated with this permission
Returns:
Throws:
SecurityException

getPrincipals

Collection getPrincipals(Permission permission)
Given a permission, return all principals granted to that permission

Parameters:
permission -
Returns:
A collection of Java Security Permission objects


Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.