01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: *
17: */
18:
19: package org.apache.lenya.cms.ac.usecase;
20:
21: import org.apache.lenya.ac.AccessControlException;
22: import org.apache.lenya.ac.Authorizer;
23: import org.apache.lenya.ac.Role;
24: import org.apache.lenya.cms.publication.Publication;
25:
26: /**
27: * Authorizer for usecases.
28: * @version $Id: UsecaseAuthorizer.java 392449 2006-04-07 23:20:38Z michi $
29: */
30: public interface UsecaseAuthorizer extends Authorizer {
31:
32: /**
33: * Authorizes a usecase by considering all roles of the current identity
34: *
35: * @param usecase The usecase ID.
36: * @param roles The roles of the current identity.
37: * @param publication The publication.
38: * @return A boolean value.
39: * @throws AccessControlException when something went wrong.
40: */
41: boolean authorizeUsecase(String usecase, Role[] roles,
42: Publication publication) throws AccessControlException;
43:
44: /**
45: * Grants or denies a usecase to a role
46: *
47: * @param usecase The usecase.
48: * @param publication The publication.
49: * @param role The role.
50: * @param granted If the usecase shall be permitted.
51: * @throws AccessControlException if an error occurs.
52: */
53: void setPermission(String usecase, Publication publication,
54: Role role, boolean granted) throws AccessControlException;
55:
56: /**
57: * Checks whether the specified role is permitted to invoke a given usecase
58: *
59: * @param usecase The usecase.
60: * @param publication The publication.
61: * @param role The role.
62: * @return A boolean value.
63: * @throws AccessControlException if an error occurs.
64: */
65: boolean isPermitted(String usecase, Publication publication,
66: Role role) throws AccessControlException;
67:
68: }
|