01: /*
02: * Copyright 2006-2007 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.module.kra.budget.bo;
17:
18: import org.kuali.core.bo.user.KualiModuleUserBase;
19: import org.kuali.core.bo.user.UniversalUser;
20: import org.kuali.kfs.context.SpringContext;
21: import org.kuali.kfs.service.ParameterService;
22: import org.kuali.kfs.service.impl.ParameterConstants;
23: import org.kuali.module.kra.KraConstants;
24:
25: public class KraUser extends KualiModuleUserBase {
26:
27: public static final String MODULE_ID = "kra";
28:
29: private static transient ParameterService parameterService;
30:
31: public KraUser(UniversalUser user) {
32: super (MODULE_ID, user);
33: }
34:
35: /**
36: * Checks the employee status to determine if the user is active in KRA.
37: *
38: * @see org.kuali.core.bo.user.KualiModuleUser#isActive()
39: */
40: public boolean isActive() {
41: if (parameterService == null) {
42: parameterService = SpringContext
43: .getBean(ParameterService.class);
44: }
45: if (getUniversalUser() == null) {
46: return false;
47: }
48: return (getUniversalUser().isStaff() || getUniversalUser()
49: .isFaculty())
50: && parameterService
51: .getParameterEvaluator(
52: ParameterConstants.RESEARCH_ADMINISTRATION_ALL.class,
53: KraConstants.ALLOWED_EMPLOYEE_STATUS_RULE,
54: getUniversalUser()
55: .getEmployeeStatusCode())
56: .evaluationSucceeds();
57: }
58:
59: public void setActive(boolean active) {
60: throw new UnsupportedOperationException(
61: "setActive is not supported on "
62: + this .getClass().getSimpleName() + " objects");
63: }
64:
65: }
|