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