org.apache.jetspeed.services.security.ldap
Class LDAPGroupManagement

java.lang.Object
  extended byorg.apache.turbine.services.BaseInitable
      extended byorg.apache.turbine.services.BaseService
          extended byorg.apache.turbine.services.TurbineBaseService
              extended byorg.apache.jetspeed.services.security.ldap.LDAPGroupManagement
All Implemented Interfaces:
GroupManagement, org.apache.turbine.services.Initable, org.apache.turbine.services.Service

public class LDAPGroupManagement
extends org.apache.turbine.services.TurbineBaseService
implements GroupManagement

Version:
$Id: LDAPGroupManagement.java,v 1.9 2005/04/27 14:08:24 raphael Exp $
Author:
Ender KILICOGLU, Sami Leino

Field Summary
 
Fields inherited from class org.apache.turbine.services.BaseService
configuration, name, properties, serviceBroker
 
Fields inherited from class org.apache.turbine.services.BaseInitable
initableBroker, isInitialized
 
Fields inherited from interface org.apache.jetspeed.services.security.GroupManagement
DEFAULT_GROUP_NAME, SERVICE_NAME
 
Constructor Summary
LDAPGroupManagement()
           
 
Method Summary
protected  void addDefaultGroupPSML(Group group)
           
 void addGroup(Group group)
          Adds a Group into permanent storage.
 Group getGroup(java.lang.String groupname)
          Retrieves a single Group for a given groupname principal.
 java.util.Iterator getGroups()
          Retrieves all Groups.
 java.util.Iterator getGroups(java.lang.String username)
          Retrieves all Groups for a given username principal.
protected  JetspeedRunData getRunData()
           
 java.util.HashMap getTurbineGroupRole(java.lang.String username)
          Retrieves a hashtable which associates Groups with Roles for a given username principal.
protected  boolean groupExists(java.lang.String groupName)
          Check whether a specified group exists.
 boolean inGroup(java.lang.String username, java.lang.String groupname)
          Checks for the relationship of user in a group.
 void init(javax.servlet.ServletConfig conf)
          This is the early initialization method called by the Turbine Service framework
 void joinGroup(java.lang.String username, java.lang.String groupname)
          Join a user to a group.
 void joinGroup(java.lang.String username, java.lang.String groupname, java.lang.String rolename)
          Join a user to a group - specific role.
 void removeGroup(java.lang.String groupname)
          Removes a Group from the permanent store.
 void saveGroup(Group group)
          Saves a Group into permanent storage.
 void unjoinGroup(java.lang.String username, java.lang.String groupName)
          Unjoin a user from a group.
 void unjoinGroup(java.lang.String username, java.lang.String groupName, java.lang.String rolename)
          Unjoin a user from a group in which the user has a specific role.
 
Methods inherited from class org.apache.turbine.services.TurbineBaseService
init, init, init, shutdown
 
Methods inherited from class org.apache.turbine.services.BaseService
getConfiguration, getName, getProperties, getServiceBroker, setName, setServiceBroker
 
Methods inherited from class org.apache.turbine.services.BaseInitable
getInit, getInitableBroker, setInit, setInitableBroker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.turbine.services.Service
getConfiguration, getName, getProperties, setName, setServiceBroker
 
Methods inherited from interface org.apache.turbine.services.Initable
getInit, init, init, setInitableBroker, shutdown
 

Constructor Detail

LDAPGroupManagement

public LDAPGroupManagement()
Method Detail

getGroups

public java.util.Iterator getGroups(java.lang.String username)
                             throws JetspeedSecurityException
Retrieves all Groups 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.

Specified by:
getGroups in interface GroupManagement
Parameters:
username - a user principal identity to be retrieved.
Returns:
Iterator over all groups associated to the user principal.
Throws:
GroupException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

getGroups

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

Specified by:
getGroups in interface GroupManagement
Returns:
Iterator over all groups.
Throws:
GroupException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

addGroup

public void addGroup(Group group)
              throws JetspeedSecurityException
Adds a Group into permanent storage. The security service can throw a NotUniqueEntityException when the public credentials fail to meet the security provider-specific unique constraints. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Specified by:
addGroup in interface GroupManagement
Throws:
GroupException - 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

addDefaultGroupPSML

protected void addDefaultGroupPSML(Group group)
                            throws GroupException
Throws:
GroupException

saveGroup

public void saveGroup(Group group)
               throws JetspeedSecurityException
Saves a Group into permanent storage. The security service can throw a NotUniqueEntityException when the public credentials fail to meet the security provider-specific unique constraints. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Specified by:
saveGroup in interface GroupManagement
Throws:
GroupException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

removeGroup

public void removeGroup(java.lang.String groupname)
                 throws JetspeedSecurityException
Removes a Group 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.

Specified by:
removeGroup in interface GroupManagement
Parameters:
groupname - the principal identity of the group to be retrieved.
Throws:
GroupException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

joinGroup

public void joinGroup(java.lang.String username,
                      java.lang.String groupname)
               throws JetspeedSecurityException
Join a user to a group. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Specified by:
joinGroup in interface GroupManagement
Throws:
GroupException - when the security provider has a general failure retrieving users.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

joinGroup

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

Specified by:
joinGroup in interface GroupManagement
Throws:
GroupException - when the security provider has a general failure retrieving groups.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

unjoinGroup

public void unjoinGroup(java.lang.String username,
                        java.lang.String groupName)
                 throws JetspeedSecurityException
Unjoin a user from a group. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Specified by:
unjoinGroup in interface GroupManagement
Throws:
GroupException - when the security provider has a general failure retrieving users.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

unjoinGroup

public void unjoinGroup(java.lang.String username,
                        java.lang.String groupName,
                        java.lang.String rolename)
                 throws JetspeedSecurityException
Unjoin a user from a group in which the user has a specific role. The security service may optionally check the current user context to determine if the requestor has permission to perform this action.

Specified by:
unjoinGroup in interface GroupManagement
Throws:
GroupException - when the security provider has a general failure retrieving users.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

inGroup

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

Specified by:
inGroup in interface GroupManagement
Throws:
GroupException - when the security provider has a general failure retrieving users.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

getGroup

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

Specified by:
getGroup in interface GroupManagement
Parameters:
groupname - a group principal identity to be retrieved.
Returns:
Group the group record retrieved.
Throws:
GroupException - when the security provider has a general failure.
InsufficientPrivilegeException - when the requestor is denied due to insufficient privilege
JetspeedSecurityException

getTurbineGroupRole

public java.util.HashMap getTurbineGroupRole(java.lang.String username)
                                      throws JetspeedSecurityException
Retrieves a hashtable which associates Groups with 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:
Hashtable record retrieved.
Throws:
GroupException - when the security provider has a general failure.
JetspeedSecurityException

getRunData

protected JetspeedRunData getRunData()

groupExists

protected boolean groupExists(java.lang.String groupName)
                       throws GroupException
Check whether a specified group exists. The login name is used for looking up the account.

Parameters:
groupName - the name of the group to check for existence.
Returns:
true if the specified account exists
Throws:
GroupException - if there was a general db access error

init

public void init(javax.servlet.ServletConfig conf)
          throws org.apache.turbine.services.InitializationException
This is the early initialization method called by the Turbine Service framework

Parameters:
conf - The ServletConfig
Throws:
throws - a InitializationException if the service fails to initialize
org.apache.turbine.services.InitializationException


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