public class SampleGroupProvider extends Object implements GroupProvider
Sample of a GroupProvider. Shows how to handle compound ids (connected with a '+').
To use, set an authzGroup's external id to one of the following:
You should also have a user directory provider that recognizes the users:
| Modifier and Type | Field and Description |
|---|---|
protected String |
m_courseExternalId
The external id for the "course" group.
|
protected int |
m_courseStudents
how many students in the "course" group.
|
protected HashSet<String> |
m_usersa
A collection of user ids.
|
protected HashSet<String> |
m_usersc |
protected HashSet<String> |
m_usersm |
protected Properties |
m_usersx |
protected String |
m_xFile
Configuration: the full file path to the external user grants file (optional).
|
| Constructor and Description |
|---|
SampleGroupProvider()
Construct.
|
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Cleanup before shutting down.
|
Map<String,String> |
getGroupRolesForUser(String userId) |
Map |
getGroupRolesForUser(String userId,
String acadEid) |
String |
getRole(String id,
String user) |
Map<String,String> |
getUserRolesForGroup(String id) |
boolean |
groupExists(String arg0) |
void |
init()
Final initialization, once all dependencies are set.
|
String |
packId(String[] ids) |
String |
preferredRole(String one,
String other) |
void |
setCourseExternalId(String value)
Dependency - set the external id for the "course" group.
|
void |
setCourseStudents(String count)
Set how many students in the "course" group
|
void |
setXFile(String value)
Dependency - set the full file path to the optional external user grants file.
|
String[] |
unpackId(String id) |
protected void |
update() |
protected String m_xFile
protected String m_courseExternalId
protected int m_courseStudents
protected Properties m_usersx
public void setXFile(String value)
value - The full file path to the external user grants file.public void setCourseExternalId(String value)
value - The external id for the "course" site.public void setCourseStudents(String count)
count - How many students in the "course" grouppublic void init()
public void destroy()
public String getRole(String id, String user)
getRole in interface GroupProviderpublic Map<String,String> getUserRolesForGroup(String id)
getUserRolesForGroup in interface GroupProviderpublic Map<String,String> getGroupRolesForUser(String userId)
getGroupRolesForUser in interface GroupProviderpublic Map getGroupRolesForUser(String userId, String acadEid)
getGroupRolesForUser in interface GroupProviderpublic String packId(String[] ids)
packId in interface GroupProviderpublic String[] unpackId(String id)
unpackId in interface GroupProviderpublic String preferredRole(String one, String other)
preferredRole in interface GroupProviderprotected void update()
public boolean groupExists(String arg0)
groupExists in interface GroupProviderCopyright © 2003–2021 Sakai Project. All rights reserved.