01: /*
02: * Copyright 2006 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.kuali.core.authorization;
17:
18: import java.util.List;
19:
20: import org.kuali.core.KualiModule;
21: import org.kuali.core.bo.user.UniversalUser;
22:
23: public class KualiModuleAuthorizerBase implements KualiModuleAuthorizer {
24:
25: private KualiModule module;
26: private List<String> packagePrefixes;
27:
28: public boolean isAuthorized(UniversalUser user,
29: AuthorizationType authType) {
30: return user.isActiveForAnyModule();
31: }
32:
33: public final KualiModule getModule() {
34: return module;
35: }
36:
37: public final void setModule(KualiModule module) {
38: this .module = module;
39: }
40:
41: public List<String> getPackagePrefixes() {
42: return packagePrefixes;
43: }
44:
45: public void setPackagePrefixes(List<String> packagePrefixes) {
46: this .packagePrefixes = packagePrefixes;
47: }
48:
49: public boolean isResponsibleFor(Class boClass) {
50: if (packagePrefixes == null) {
51: return false;
52: }
53: for (String prefix : packagePrefixes) {
54: if (boClass.getPackage().getName().startsWith(prefix)) {
55: return true;
56: }
57: }
58: return false;
59: }
60:
61: }
|