01: /*
02: * Copyright 2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.kfs.document.authorization;
17:
18: import java.util.List;
19: import java.util.Map;
20:
21: import org.kuali.core.bo.user.UniversalUser;
22: import org.kuali.core.document.Document;
23: import org.kuali.core.document.TransactionalDocument;
24: import org.kuali.core.document.authorization.TransactionalDocumentAuthorizer;
25: import org.kuali.kfs.bo.AccountingLine;
26: import org.kuali.module.chart.bo.ChartUser;
27:
28: /**
29: * Extension to TransactionalDocumentAuthorizer interface which adds financial-document-specific methods.
30: */
31: public interface AccountingDocumentAuthorizer extends
32: TransactionalDocumentAuthorizer {
33: /**
34: * @param document
35: * @param user
36: * @return Map with field names as keys that are allowed to be edited in special edit modes.
37: */
38: public Map getAccountingLineEditableFields(Document document,
39: UniversalUser user);
40:
41: /**
42: * Variant version of getEditMode which uses passed-in sourceAccountingLines and targetAccountingLines instead of getting them
43: * out of the given Document, since the Document may (when this gets called from KualiDocumentActionBase) contain invalid
44: * accountingLines whose invalidity will prevent the editMode from being calculated correctly.
45: *
46: * @param document
47: * @param user
48: * @param sourceAccountingLines
49: * @param targetAccountingLines
50: * @return Map with keys AuthorizationConstants.EditMode value (String) which indicates what operations the user is currently
51: * allowed to take on that document.
52: */
53: public Map getEditMode(Document document, UniversalUser user,
54: List sourceAccountingLines, List targetAccountingLines);
55:
56: /**
57: * Initially wanted to use a Set, but JSTL doesn't seem to allow me to navigate Sets as easily as Maps. Initially used Account
58: * objects as keys, but the Accounts of AccountingLines are sometimes left unpopulated when you reach the JSP, so I had to add a
59: * method to Account and to AccountingLine which would generate a well-formatted String from the primitive account-related keys
60: * in an Account or AccountingLine; that well-formatted String is now used as the key in this Map.
61: *
62: * @param document
63: * @param user
64: * @return Map of Account objects, indexed by accountKey (return value of account.buildAccountKey), which the given user should
65: * be allowed to edit
66: */
67: public Map getEditableAccounts(TransactionalDocument document,
68: ChartUser user);
69:
70: /**
71: * This method takes a list of accounting lines, and it returns a map with the keys being well-formatted representations of the
72: * primary keys of the accounts that the given user can actually edit.
73: *
74: * @param lines the accountingLine objects to check for editability.
75: * @param user the user to authorize each accounting line for
76: * @return a map with keys holding well formated primary keys of the editable accounts.
77: */
78: public Map getEditableAccounts(List<AccountingLine> lines,
79: ChartUser user);
80: }
|