org.apache.jetspeed.services.security
Class JetspeedPermissionManagement

java.lang.Object
  extended byorg.apache.jetspeed.services.security.JetspeedPermissionManagement

public abstract class JetspeedPermissionManagement
extends java.lang.Object

The PermissionManagement interface describes contract between the portal and security provider required for Jetspeed Permission Management. This interface enables an application to be independent of the underlying permission management technology.

Version:
$Id: JetspeedPermissionManagement.java,v 1.4 2004/02/23 03:58:11 jford Exp $
Author:
David Sean Taylor

Field Summary
 java.lang.String SERVICE_NAME
           
 
Constructor Summary
JetspeedPermissionManagement()
           
 
Method Summary
static void addPermission(Permission permission)
          Adds a Permission into permanent storage.
static Permission getPermission(java.lang.String permissionName)
          Retrieves a single Permission for a given permissionName principal.
static java.util.Iterator getPermissions()
          Retrieves all Permissions.
static java.util.Iterator getPermissions(java.lang.String rolename)
          Retrieves all Permissions for a given rolename principal.
protected static PermissionManagement getService()
           
static void grantPermission(java.lang.String roleName, java.lang.String permissionName)
          Grants a permission to a role.
static boolean hasPermission(java.lang.String roleName, java.lang.String permissionName)
          Checks for the relationship of role has a permission.
static void removePermission(java.lang.String permissionName)
          Removes a Permission from the permanent store.
static void revokePermission(java.lang.String roleName, java.lang.String permissionName)
          Revokes a permission from a role.
static void savePermission(Permission permission)
          Saves a Permission into permanent storage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE_NAME

public java.lang.String SERVICE_NAME
Constructor Detail

JetspeedPermissionManagement

public JetspeedPermissionManagement()
Method Detail

getService

protected static PermissionManagement getService()

getPermissions

public static java.util.Iterator getPermissions(java.lang.String rolename)
                                         throws JetspeedSecurityException
Retrieves all Permissions for a given rolename principal. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Parameters:
rolename - a role name identity to be retrieved.
Returns:
Iterator over all permissions associated to the role principal.
Throws:
PermissionException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

getPermissions

public static java.util.Iterator getPermissions()
                                         throws JetspeedSecurityException
Retrieves all Permissions. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Returns:
Iterator over all permissions.
Throws:
PermissionException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

addPermission

public static void addPermission(Permission permission)
                          throws JetspeedSecurityException
Adds a Permission into permanent storage. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Throws:
PermissionException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

savePermission

public static void savePermission(Permission permission)
                           throws JetspeedSecurityException
Saves a Permission into permanent storage. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Throws:
PermissionException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

removePermission

public static void removePermission(java.lang.String permissionName)
                             throws JetspeedSecurityException
Removes a Permission from the permanent store. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Parameters:
permissionName - the principal identity of the permission to be retrieved.
Throws:
PermissionException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

grantPermission

public static void grantPermission(java.lang.String roleName,
                                   java.lang.String permissionName)
                            throws JetspeedSecurityException
Grants a permission to a role. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Parameters:
roleName - grant a permission to this role.
permissionName - the permission to grant to the role.
Throws:
PermissionException - when the security provider has a general failure retrieving permissions.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

revokePermission

public static void revokePermission(java.lang.String roleName,
                                    java.lang.String permissionName)
                             throws JetspeedSecurityException
Revokes a permission from a role. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Parameters:
roleName - grant a permission to this role.
permissionName - the permission to grant to the role.
Throws:
PermissionException - when the security provider has a general failure retrieving permissions.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

hasPermission

public static boolean hasPermission(java.lang.String roleName,
                                    java.lang.String permissionName)
                             throws JetspeedSecurityException
Checks for the relationship of role has a permission. Returns true when the role has the given permission. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Parameters:
roleName - grant a permission to this role.
permissionName - the permission to grant to the role.
Throws:
PermissionException - when the security provider has a general failure retrieving permissions.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

getPermission

public static Permission getPermission(java.lang.String permissionName)
                                throws JetspeedSecurityException
Retrieves a single Permission for a given permissionName principal. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Parameters:
permissionName - a permission principal identity to be retrieved.
Returns:
Permission the permission record retrieved.
Throws:
PermissionException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException


Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.