01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/authz/tags/sakai_2-4-1/authz-api/api/src/java/org/sakaiproject/authz/api/SecurityAdvisor.java $
03: * $Id: SecurityAdvisor.java 7102 2006-03-28 03:51:14Z ggolden@umich.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 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: /**
23: * <p>
24: * SecurityAdvisor is a stackable policy process that is given a chance to determine if a security question can be answered, over the logic of the SecurityService component.
25: * </p>
26: */
27: public interface SecurityAdvisor {
28: /**
29: * <p>
30: * SecurityAdvice enumerates different SecurityAdvisor results.
31: * </p>
32: */
33: public class SecurityAdvice {
34: private final String m_id;
35:
36: private SecurityAdvice(String id) {
37: m_id = id;
38: }
39:
40: public String toString() {
41: return m_id;
42: }
43:
44: /** Security result that indicates the end user is allowed the function. */
45: public static final SecurityAdvice ALLOWED = new SecurityAdvice(
46: "allowed");
47:
48: /** Security result that indicates the end user is NOT allowed the function. */
49: public static final SecurityAdvice NOT_ALLOWED = new SecurityAdvice(
50: "not allowed");
51:
52: /** Security result that indicates the SecurityAdvisor cannot answer the question. */
53: public static final SecurityAdvice PASS = new SecurityAdvice(
54: "pass");
55: }
56:
57: /**
58: * Can the current session user perform the requested function on the referenced Entity?
59: *
60: * @param userId
61: * The user id.
62: * @param function
63: * The lock id string.
64: * @param reference
65: * The resource reference string.
66: * @return ALLOWED or NOT_ALLOWED if the advisor can answer that the user can or cannot, or PASS if the advisor cannot answer.
67: */
68: SecurityAdvice isAllowed(String userId, String function,
69: String reference);
70: }
|