01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/providers/tags/sakai_2-4-1/cm/cm-authz-provider/src/java/org/sakaiproject/coursemanagement/impl/provider/RoleResolver.java $
03: * $Id: RoleResolver.java 20106 2007-01-04 19:43:11Z jholtzman@berkeley.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 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.coursemanagement.impl.provider;
21:
22: import java.util.Map;
23:
24: import org.sakaiproject.coursemanagement.api.CourseManagementService;
25: import org.sakaiproject.coursemanagement.api.Section;
26:
27: /**
28: * Resolves users roles in CM objects.
29: *
30: * @author <a href="mailto:jholtzman@berkeley.edu">Josh Holtzman</a>
31: *
32: */
33: public interface RoleResolver {
34:
35: /**
36: * Gets users roles in a CM object. A RoleResolver implementation
37: * will typically use the cmService to look "up" from the section in the CM
38: * hierarchy to find the object it's interested in, then find any membership roles
39: * associated with the user.
40: *
41: * @param section The section from which to start searching "up" the hierarchy,
42: * if necessary
43: * @param cmService The CM service impl. We pass this in rather than injecting
44: * it into every RoleResolver
45: *
46: * @return The user's role, or null if the user has no role in this CM object
47: */
48: public Map<String, String> getUserRoles(
49: CourseManagementService cmService, Section section);
50:
51: /**
52: * Gets a single user's roles in all sections with which s/he is associated.
53: *
54: * @param userEid The user's enterprise ID
55: * @param cmService The CM service impl. We pass this in rather than injecting
56: * it into every RoleResolver
57: *
58: * @return The user's roles, or null if the user has no role in this CM object
59: */
60: public Map<String, String> getGroupRoles(
61: CourseManagementService cmService, String userEid);
62:
63: /**
64: * Converts a CM role to a Sakai role.
65: *
66: * @param cmRole The role according to CM
67: * @return The role to use in a Sakai site or group, or null if the CM role should
68: * not be expressed as a role in a Sakai site or group.
69: */
70: String convertRole(String cmRole);
71: }
|