View Javadoc

1   /**
2    * Copyright 2004-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
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.hr.time.roles;
17  
18  import org.kuali.hr.time.timesheet.TimesheetDocument;
19  
20  import java.util.Set;
21  
22  /**
23   * Class to set the contract between Users and Roles.
24   */
25  public interface UserRoles {
26  
27      public boolean isLocationAdmin();
28  
29      public boolean isDepartmentAdmin();
30  
31      public String getPrincipalId();
32  
33      public boolean isTimesheetReviewer();
34      
35      /**
36       * Is the current user a system administrator?
37       * @return true if yes, false otherwise
38       */
39      public boolean isSystemAdmin();
40  
41      /**
42       * Does the current user have any active assignments?
43       * @return true if yes, false otherwise.
44       */
45      public boolean isActiveEmployee();
46  
47      /**
48       * Does the current user have any active approver roles?
49       *
50       * Approver roles attach at the WorkArea level.
51       *
52       * @return true if yes, false otherwise.
53       */
54      public boolean isAnyApproverActive();
55  
56  
57      /**
58       * Does the current user have any role that grants permission to approve
59       * timesheets?
60       * @return true if yes, false otherwise.
61       */
62      public boolean isTimesheetApprover();
63  
64      /**
65       * Does the current user have the Global View Only role?
66       *
67       * @return true if yes, false otherwise.
68       */
69      public boolean isGlobalViewOnly();
70  
71      /**
72       * Does the current user have an assignment that is marked synchronous?
73       *
74       * @return true if yes, false otherwise.
75       */
76      public boolean isSynchronous();
77  
78      /**
79       * Provides a set of WorkArea names that this user is an approver for.
80       * @return a Set<Long> of workarea names.
81       */
82      public Set<Long> getApproverWorkAreas();
83  
84      /**
85       * Provides a Set of WorkArea names that this user is a reviewer for.
86       * @return a Set<Long> of workarea names.
87       */
88      public Set<Long> getReviewerWorkAreas();
89  
90      /**
91       * Provides a Set of Assignment ids that this user is active under.
92       * @return a Set<Long> of assignment object ids.
93       */
94      public Set<String> getActiveAssignmentIds();
95  
96      /**
97       * Provides a Set<String> of Department names that this user is a
98       * departmental view only for.
99       * @return a Set<String> of Department names.
100      */
101     public Set<String> getDepartmentViewOnlyDepartments();
102 
103     /**
104      * Provides a Set<String> of Department names that this user is a chart
105      * administrator for.
106      * @return a Set<String> of Department names.
107      */
108     public Set<String> getOrgAdminDepartments();
109 
110     /**
111      * Provides a Set<String> of chart names that this user is a chart
112      * administrator for.
113      * @return a Set<String> of Chart names.
114      */
115     public Set<String> getOrgAdminCharts();
116     
117     public boolean isDeptViewOnly();
118 
119     /**
120      * Indicates whether or not the current can approve the provided timesheet.
121      * @param doc The TimesheetDocument in question.
122      * @return true if the doc can be approved by the current user.
123      */
124     public boolean isApproverForTimesheet(TimesheetDocument doc);
125     public boolean isApproverForTimesheet(String docId);
126 
127     public boolean canSubmitTimesheet(TimesheetDocument doc);
128     public boolean canSubmitTimesheet(String docId);
129 
130     public boolean isDocumentReadable(TimesheetDocument document);
131     public boolean isDocumentReadable(String documentId);
132 
133     public boolean isDocumentWritable(TimesheetDocument document);
134     public boolean isDocumentWritable(String documentId);
135     
136     public boolean isApproverForPerson(String principalId);
137 
138     boolean isDepartmentAdminForPerson(String principalId);
139 
140     boolean isDeptViewOnlyForPerson(String principalId);
141 
142     boolean isLocationAdminForPerson(String principalId);
143 
144     boolean isTimesheetReviewerForPerson(String principalId);
145 }