01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/authz/tags/sakai_2-4-1/authz-api/api/src/java/org/sakaiproject/authz/api/GroupProvider.java $
03: * $Id: GroupProvider.java 20456 2007-01-19 00:58:21Z jholtzman@berkeley.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.authz.api;
21:
22: import java.util.Map;
23:
24: /**
25: * <p>
26: * GroupProvider provides user / role membership in a group, from an external system.
27: * </p>
28: */
29: public interface GroupProvider {
30: /**
31: * Access the role name for this particular user in the external group.
32: *
33: * @param id
34: * The external group id.
35: * @param userId
36: * The user Id.
37: * @return the role name for this particular user in the external group, or null if none.
38: */
39: String getRole(String id, String user);
40:
41: /**
42: * Access the user id - role name map for all users in the external group.
43: *
44: * @param id
45: * The external group id.
46: * @return the user id - role name map for all users in the external group (may be empty).
47: */
48: Map getUserRolesForGroup(String id);
49:
50: /**
51: * Access the external group id - role name map for this user in all external groups.
52: *
53: * @param userId
54: * The user id.
55: * @return the the external group id - role name map for this users in all external groups. (may be empty).
56: */
57: Map getGroupRolesForUser(String userId);
58:
59: /**
60: * Packs any number of simple ids into a compound id.
61: * @param ids
62: * The external group ids
63: * @return a compound id
64: */
65: public String packId(String[] ids);
66:
67: /**
68: * Unpack a possibly compound id into it's component ids, returning at least the id unchanged if not compound.
69: *
70: * @param id
71: * The external realm id.
72: * @return a String array of one or more ids upacked from this possibly compound id.
73: */
74: String[] unpackId(String id);
75:
76: /**
77: * Return one or the other of these role names - pick the one that if a user has both, is the more powerful one to give the user as their single role.
78: *
79: * @param one
80: * A role name. May be null!
81: * @param other
82: * Another role name. May be null!
83: * @return The better role.
84: */
85: String preferredRole(String one, String other);
86: }
|