001/**
002 * Copyright 2005-2018 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 */
016package org.kuali.rice.krad.document;
017
018import org.kuali.rice.kim.api.identity.Person;
019import org.kuali.rice.krad.bo.DataObjectAuthorizer;
020
021/**
022 * Authorizer class for {@link Document} instances
023 *
024 * <p>
025 * Authorizer provides user based authorization
026 * </p>
027 *
028 * <p>
029 * The document authorizer is associated with a document type through its data dictionary
030 * {@link org.kuali.rice.krad.datadictionary.DocumentEntry}. This is then used by the framework to authorize certain
031 * actions and in addition used for view presentation logic
032 * </p>
033 *
034 * @author Kuali Rice Team (rice.collab@kuali.org)
035 */
036public interface DocumentAuthorizer extends DataObjectAuthorizer {
037    
038    /**
039     * Checks if a user has the permissions to initiate a  document
040     *
041     * @param documentTypeName document type name
042     * @param user current user
043     * @return boolean, true if the user has the permissions to initiate a document else false
044     */
045
046    public boolean canInitiate(String documentTypeName, Person user);
047
048    /**
049     * Checks if a user has the permissions to open a  document
050     *
051     * @param document document to check
052     * @param user current user
053     * @return boolean, true if the user has the permissions to open a document else false
054     */
055
056    public boolean canOpen(Document document, Person user);
057
058    /**
059     * Determines if the document can be edited; if false is returned, then all fields are in a
060     * read only state
061     *
062     * @param document document to check
063     * @param user current user
064     * @return boolean, true if the user has the permissions to edit a document else false
065     */
066
067    public boolean canEdit(Document document, Person user);
068
069    public boolean canAnnotate(Document document, Person user);
070
071    public boolean canReload(Document document, Person user);
072
073    public boolean canClose(Document document, Person user);
074
075    public boolean canSave(Document document, Person user);
076
077    /**
078     * Determines if the user has permission to route the document
079     *
080     * @param document document to check
081     * @param user current user
082     * @return boolean, true if the user has permissions to route a document else false
083     */
084    public boolean canRoute(Document document, Person user);
085
086    /**
087     * Determines if the user has permission to cancel the document
088     *
089     * @param document document to check
090     * @param user current user
091     * @return boolean, true if the user has permissions to cancel a document else false
092     */
093    public boolean canCancel(Document document, Person user);
094
095    /**
096     * Determines if the user has permission to copy the document
097     *
098     * @param document document to check
099     * @param user current user
100     * @return boolean, true if the user has permissions to cancel a document else false
101     */
102    public boolean canCopy(Document document, Person user);
103
104    public boolean canPerformRouteReport(Document document, Person user);
105
106    public boolean canBlanketApprove(Document document, Person user);
107
108    public boolean canApprove(Document document, Person user);
109
110    public boolean canDisapprove(Document document, Person user);
111
112    public boolean canSendNoteFyi(Document document, Person user);
113
114    public boolean canEditDocumentOverview(Document document, Person user);
115
116    public boolean canFyi(Document document, Person user);
117
118    public boolean canAcknowledge(Document document, Person user);
119
120    public boolean canReceiveAdHoc(Document document, Person user, String actionRequestCode);
121
122    public boolean canAddNoteAttachment(Document document, String attachmentTypeCode, Person user);
123
124    public boolean canDeleteNoteAttachment(Document document, String attachmentTypeCode,
125            String authorUniversalIdentifier, Person user);
126
127    public boolean canViewNoteAttachment(Document document, String attachmentTypeCode, Person user);
128
129    @Deprecated
130    public boolean canViewNoteAttachment(Document document, String attachmentTypeCode, String authorUniversalIdentifier,
131            Person user);
132
133    public boolean canSendAdHocRequests(Document document, String actionRequestCd, Person user);
134
135    public boolean canSendAnyTypeAdHocRequests(Document document, Person user);
136
137    public boolean canTakeRequestedAction(Document document, String actionRequestCode, Person user);
138
139    /**
140     * @since 2.1
141     */
142    public boolean canRecall(Document document, Person user);
143
144    /**
145     * Determines if the user has permission to take a super user action.
146     *
147     * @param document document to check
148     * @param user current user
149     *
150     * @return true if the user has permissions to take a super user action, otherwise false
151     *
152     * @since 2.5
153     */
154    boolean canSuperUserTakeAction(Document document, Person user);
155
156    /**
157     * Determines if the user has permission to approve a document as a super user.
158     *
159     * @param document document to check
160     * @param user current user
161     *
162     * @return true if the user has permissions to approve a document as a super user, otherwise false
163     * @since 2.5
164     */
165    boolean canSuperUserApprove(Document document, Person user);
166
167    /**
168     * Determines if the user has permission to disapprove a document as a super user.
169     *
170     * @param document document to check
171     * @param user current user
172     *
173     * @return true if the user has permissions to disapprove a document as a super user, otherwise false
174     * @since 2.5
175     */
176    boolean canSuperUserDisapprove(Document document, Person user);
177
178    void setDocumentRequestAuthorizationCache(DocumentRequestAuthorizationCache documentRequestAuthorizationCache);
179
180}