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.lm.balancetransfer; 17 18 import java.util.Set; 19 20 import org.apache.commons.lang.StringUtils; 21 import org.apache.log4j.Logger; 22 import org.kuali.hr.time.util.TKContext; 23 import org.kuali.rice.kew.api.KewApiServiceLocator; 24 import org.kuali.rice.kim.api.identity.Person; 25 import org.kuali.rice.kns.document.authorization.TransactionalDocumentAuthorizerBase; 26 import org.kuali.rice.krad.document.Document; 27 import org.kuali.rice.krad.maintenance.MaintenanceDocumentAuthorizerBase; 28 import org.kuali.rice.krad.util.KRADConstants; 29 30 public class BalanceTransferAuthorizer extends MaintenanceDocumentAuthorizerBase { 31 32 private static final Logger LOG = Logger.getLogger(BalanceTransferAuthorizer.class); 33 34 @Override 35 public boolean canEditDocumentOverview(Document document, Person user) { 36 return true; 37 } 38 39 /* @Override 40 public Set<String> getDocumentActions(Document document, Person user, 41 Set<String> documentActions) { 42 Set<String> author = super.getDocumentActions(document, user, documentActions); 43 MissedPunchDocument mpDoc = (MissedPunchDocument)document; 44 if(StringUtils.equals(mpDoc.getDocumentStatus(),"R") ){ 45 if(KewApiServiceLocator.getWorkflowDocumentActionsService().isFinalApprover(mpDoc.getDocumentNumber(), TKContext.getPrincipalId())){ 46 author.add(KRADConstants.KUALI_ACTION_CAN_EDIT); 47 author.add(KRADConstants.KUALI_ACTION_CAN_APPROVE); 48 49 author.remove(KRADConstants.KUALI_ACTION_CAN_DISAPPROVE); 50 } 51 } else if(!StringUtils.equals(mpDoc.getDocumentStatus(), "A")){ 52 author.add(KRADConstants.KUALI_ACTION_CAN_EDIT); 53 author.add(KRADConstants.KUALI_ACTION_CAN_ROUTE); 54 } 55 author.remove(KRADConstants.KUALI_ACTION_CAN_ADD_ADHOC_REQUESTS); 56 author.remove(KRADConstants.KUALI_ACTION_CAN_SEND_ADHOC_REQUESTS); 57 return author; 58 }*/ 59 60 61 62 }