001 /**
002 * Copyright 2004-2013 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.kuali.hr.time.roles;
017
018 import org.kuali.hr.core.document.calendar.CalendarDocumentContract;
019 import org.kuali.hr.time.timesheet.TimesheetDocument;
020
021 import java.util.Set;
022
023 /**
024 * Class to set the contract between Users and Roles.
025 */
026 public interface UserRoles {
027
028 public boolean isLocationAdmin();
029
030 public boolean isDepartmentAdmin();
031
032 public String getPrincipalId();
033
034 public boolean isTimesheetReviewer();
035
036 /**
037 * Is the current user a system administrator?
038 * @return true if yes, false otherwise
039 */
040 public boolean isSystemAdmin();
041
042 /**
043 * Does the current user have any active assignments?
044 * @return true if yes, false otherwise.
045 */
046 public boolean isActiveEmployee();
047
048 /**
049 * Does the current user have any active approver roles?
050 *
051 * Approver roles attach at the WorkArea level.
052 *
053 * @return true if yes, false otherwise.
054 */
055 public boolean isAnyApproverActive();
056
057
058 /**
059 * Does the current user have any role that grants permission to approve
060 * timesheets?
061 * @return true if yes, false otherwise.
062 */
063 public boolean isTimesheetApprover();
064
065 /**
066 * Does the current user have the Global View Only role?
067 *
068 * @return true if yes, false otherwise.
069 */
070 public boolean isGlobalViewOnly();
071
072 /**
073 * Does the current user have an assignment that is marked synchronous?
074 *
075 * @return true if yes, false otherwise.
076 */
077 public boolean isSynchronous();
078
079 /**
080 * Provides a set of WorkArea names that this user is an approver for.
081 * @return a Set<Long> of workarea names.
082 */
083 public Set<Long> getApproverWorkAreas();
084
085 /**
086 * Provides a Set of WorkArea names that this user is a reviewer for.
087 * @return a Set<Long> of workarea names.
088 */
089 public Set<Long> getReviewerWorkAreas();
090
091 /**
092 * Provides a Set of Assignment ids that this user is active under.
093 * @return a Set<Long> of assignment object ids.
094 */
095 public Set<String> getActiveAssignmentIds();
096
097 /**
098 * Provides a Set<String> of Department names that this user is a
099 * 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 }