org.sakaiproject.component.legacy.authzGroup
Class SampleGroupProvider

java.lang.Object
  extended byorg.sakaiproject.component.legacy.authzGroup.SampleGroupProvider
All Implemented Interfaces:
GroupProvider

public class SampleGroupProvider
extends Object
implements GroupProvider

Sample of a GroupProvider. Shows how to handle compound ids (connected with a '+').

Author:
Sakai Software Development Team

Nested Class Summary
 class SampleGroupProvider.MyMap
           
 
Field Summary
protected  HashSet m_usersa
          A collection of user ids.
protected  HashSet m_usersm
           
protected  Properties m_usersx
           
protected  String m_xFile
          Configuration: the full file path to the external user grants file (optional).
 
Constructor Summary
SampleGroupProvider()
          Construct.
 
Method Summary
 void destroy()
          Cleanup before shutting down.
 Map getGroupRolesForUser(String userId)
          Access the external group id - role name map for this user in all external groups.

If the provider supports compound external ids, the get() of this Map needs to accept a compount external id
and return the single role (if any) resolved from any individual external realm ids in the map.

 String getRole(String id, String user)
          Access the role name for this particular user in the external group.
 Map getUserRolesForGroup(String id)
          Access the user id - role name map for all users in the external group.
 void init()
          Final initialization, once all dependencies are set.
 void setXFile(String value)
          Dependency - set the full file path to the optional external user grants file.
 String[] unpackId(String id)
          Unpack a possibly compound id into it's component ids, returning at least the id unchanged if not compound.
protected  void update()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_xFile

protected String m_xFile
Configuration: the full file path to the external user grants file (optional).


m_usersa

protected HashSet m_usersa
A collection of user ids.


m_usersm

protected HashSet m_usersm

m_usersx

protected Properties m_usersx
Constructor Detail

SampleGroupProvider

public SampleGroupProvider()
Construct.

Method Detail

setXFile

public void setXFile(String value)
Dependency - set the full file path to the optional external user grants file.

Parameters:
value - The full file path to the external user grants file.

init

public void init()
Final initialization, once all dependencies are set.


destroy

public void destroy()
Cleanup before shutting down.


getRole

public String getRole(String id,
                      String user)
Access the role name for this particular user in the external group.

Specified by:
getRole in interface GroupProvider
Parameters:
id - The external group id.
Returns:
the role name for this particular user in the external group, or null if none.

getUserRolesForGroup

public Map getUserRolesForGroup(String id)
Access the user id - role name map for all users in the external group.

Specified by:
getUserRolesForGroup in interface GroupProvider
Parameters:
id - The external group id.
Returns:
the user id - role name map for all users in the external group (may be empty).

getGroupRolesForUser

public Map getGroupRolesForUser(String userId)
Access the external group id - role name map for this user in all external groups.

If the provider supports compound external ids, the get() of this Map needs to accept a compount external id
and return the single role (if any) resolved from any individual external realm ids in the map.

Specified by:
getGroupRolesForUser in interface GroupProvider
Parameters:
userId - The user id.
Returns:
the the external group id - role name map for this users in all external groups. (may be empty).

unpackId

public String[] unpackId(String id)
Unpack a possibly compound id into it's component ids, returning at least the id unchanged if not compound.

Specified by:
unpackId in interface GroupProvider
Parameters:
id - The external realm id.
Returns:
a String array of one or more ids upacked from this possibly compound id.

update

protected void update()