001    /**
002     * Copyright 2004-2012 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.time.timesheet.TimesheetDocument;
019    
020    import java.util.Set;
021    
022    /**
023     * Class to set the contract between Users and Roles.
024     */
025    public interface UserRoles {
026    
027        public boolean isLocationAdmin();
028    
029        public boolean isDepartmentAdmin();
030    
031        public String getPrincipalId();
032    
033        public boolean isTimesheetReviewer();
034        
035        /**
036         * Is the current user a system administrator?
037         * @return true if yes, false otherwise
038         */
039        public boolean isSystemAdmin();
040    
041        /**
042         * Does the current user have any active assignments?
043         * @return true if yes, false otherwise.
044         */
045        public boolean isActiveEmployee();
046    
047        /**
048         * Does the current user have any active approver roles?
049         *
050         * Approver roles attach at the WorkArea level.
051         *
052         * @return true if yes, false otherwise.
053         */
054        public boolean isAnyApproverActive();
055    
056    
057        /**
058         * Does the current user have any role that grants permission to approve
059         * timesheets?
060         * @return true if yes, false otherwise.
061         */
062        public boolean isTimesheetApprover();
063    
064        /**
065         * Does the current user have the Global View Only role?
066         *
067         * @return true if yes, false otherwise.
068         */
069        public boolean isGlobalViewOnly();
070    
071        /**
072         * Does the current user have an assignment that is marked synchronous?
073         *
074         * @return true if yes, false otherwise.
075         */
076        public boolean isSynchronous();
077    
078        /**
079         * Provides a set of WorkArea names that this user is an approver for.
080         * @return a Set<Long> of workarea names.
081         */
082        public Set<Long> getApproverWorkAreas();
083    
084        /**
085         * Provides a Set of WorkArea names that this user is a reviewer for.
086         * @return a Set<Long> of workarea names.
087         */
088        public Set<Long> getReviewerWorkAreas();
089    
090        /**
091         * Provides a Set of Assignment ids that this user is active under.
092         * @return a Set<Long> of assignment object ids.
093         */
094        public Set<String> getActiveAssignmentIds();
095    
096        /**
097         * Provides a Set<String> of Department names that this user is a
098         * departmental view only for.
099         * @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    }