org.apache.jetspeed.services.security
Class JetspeedRoleManagement

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

public abstract class JetspeedRoleManagement
extends java.lang.Object

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

Version:
$Id: JetspeedRoleManagement.java,v 1.5 2004/02/23 03:58:11 jford Exp $
Author:
David Sean Taylor, Mark Orciuch

Field Summary
 java.lang.String SERVICE_NAME
           
 
Constructor Summary
JetspeedRoleManagement()
           
 
Method Summary
static void addRole(Role role)
          Adds a Role into permanent storage.
static Role getRole(java.lang.String rolename)
          Retrieves a single Role for a given rolename principal.
static java.util.Iterator getRoles()
          Retrieves all Roles.
static java.util.Iterator getRoles(java.lang.String username)
          Retrieves all Roles for a given username principal.
protected static RoleManagement getService()
           
static void grantRole(java.lang.String username, java.lang.String rolename)
          Grants a role to a user.
static void grantRole(java.lang.String username, java.lang.String rolename, java.lang.String groupname)
          Grants a role to a user for a given group.
static boolean hasRole(java.lang.String username, java.lang.String rolename)
          Checks for the relationship of user has a role.
static boolean hasRole(java.lang.String username, java.lang.String rolename, java.lang.String groupname)
           
static void removeRole(java.lang.String rolename)
          Removes a Role from the permanent store.
static void revokeRole(java.lang.String username, java.lang.String rolename)
          Revokes a role from a user.
static void revokeRole(java.lang.String username, java.lang.String rolename, java.lang.String groupname)
          Revokes a role from a user for a specific group.
static void saveRole(Role role)
          Save a Role 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

JetspeedRoleManagement

public JetspeedRoleManagement()
Method Detail

getService

protected static RoleManagement getService()

getRoles

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

Parameters:
username - a user principal identity to be retrieved.
Returns:
Iterator over all roles associated to the user principal.
Throws:
RoleException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

getRoles

public static java.util.Iterator getRoles()
                                   throws JetspeedSecurityException
Retrieves all Roles. 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 roles.
Throws:
RoleException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

addRole

public static void addRole(Role role)
                    throws JetspeedSecurityException
Adds a Role into permanent storage.

Throws:
RoleException - when the security provider has a general failure.
NotUniqueEntityException - when the public credentials fail to meet the security provider-specific unique constraints.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

saveRole

public static void saveRole(Role role)
                     throws JetspeedSecurityException
Save a Role into permanent storage.

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

removeRole

public static void removeRole(java.lang.String rolename)
                       throws JetspeedSecurityException
Removes a Role 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:
rolename - the principal identity of the role to be retrieved.
Throws:
RoleException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

grantRole

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

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

grantRole

public static void grantRole(java.lang.String username,
                             java.lang.String rolename,
                             java.lang.String groupname)
                      throws JetspeedSecurityException
Grants a role to a user for a given group. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

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

revokeRole

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

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

revokeRole

public static void revokeRole(java.lang.String username,
                              java.lang.String rolename,
                              java.lang.String groupname)
                       throws JetspeedSecurityException
Revokes a role from a user for a specific group. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

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

hasRole

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

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

hasRole

public static boolean hasRole(java.lang.String username,
                              java.lang.String rolename,
                              java.lang.String groupname)
                       throws JetspeedSecurityException
Throws:
JetspeedSecurityException

getRole

public static Role getRole(java.lang.String rolename)
                    throws JetspeedSecurityException
Retrieves a single Role 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 principal identity to be retrieved.
Returns:
Role the role record retrieved.
Throws:
RoleException - 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.