View Javadoc
1   /*
2    * Copyright 2009 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.ole.pdp.service.impl;
17  
18  import org.kuali.ole.pdp.PdpConstants;
19  import org.kuali.ole.pdp.service.PdpAuthorizationService;
20  import org.kuali.ole.sys.OLEConstants;
21  import org.kuali.ole.sys.context.SpringContext;
22  import org.kuali.rice.kim.api.services.IdentityManagementService;
23  
24  public class PdpAuthorizationServiceImpl implements PdpAuthorizationService {
25  
26      private IdentityManagementService identityManagementService;
27      
28      /**
29       * @see org.kuali.ole.pdp.service.PdpAuthorizationService#hasCancelPayment(java.lang.String)
30       */
31      @Override
32      public boolean hasCancelPaymentPermission(String principalId) {
33          return getIdentityManagementService().isAuthorized(principalId, OLEConstants.CoreModuleNamespaces.PDP, PdpConstants.PermissionNames.CANCEL_PAYMENT, null);
34      }
35  
36      /**
37       * @see org.kuali.ole.pdp.service.PdpAuthorizationService#hasFormat(java.lang.String, java.lang.String)
38       */
39      @Override
40      public boolean hasFormatPermission(String principalId) {
41          return getIdentityManagementService().isAuthorized(principalId, OLEConstants.CoreModuleNamespaces.PDP, PdpConstants.PermissionNames.FORMAT, null);
42      }
43  
44      /**
45       * @see org.kuali.ole.pdp.service.PdpAuthorizationService#hasHoldPayment(java.lang.String)
46       */
47      @Override
48      public boolean hasHoldPaymentPermission(String principalId) {
49          return getIdentityManagementService().isAuthorized(principalId, OLEConstants.CoreModuleNamespaces.PDP, PdpConstants.PermissionNames.HOLD_PAYMENT_REMOVE_NON_TAX_PAYMENT_HOLD, null);
50      }
51  
52      /**
53       * @see org.kuali.ole.pdp.service.PdpAuthorizationService#hasRemoveFormatLock(java.lang.String, java.lang.String)
54       */
55      @Override
56      public boolean hasRemoveFormatLockPermission(String principalId) {
57          return getIdentityManagementService().isAuthorized(principalId, OLEConstants.CoreModuleNamespaces.PDP, PdpConstants.PermissionNames.REMOVE_FORMAT_LOCK, null);
58      }
59  
60  
61      /**
62       * @see org.kuali.ole.pdp.service.PdpAuthorizationService#hasRemovePaymentTaxHold(java.lang.String)
63       */
64      @Override
65      public boolean hasRemovePaymentTaxHoldPermission(String principalId) {
66          return getIdentityManagementService().isAuthorized(principalId, OLEConstants.CoreModuleNamespaces.PDP, PdpConstants.PermissionNames.REMOVE_PAYMENT_TAX_HOLD, null);
67      }
68  
69      /**
70       * @see org.kuali.ole.pdp.service.PdpAuthorizationService#hasSetAsImmediatePay(java.lang.String, java.lang.String)
71       */
72      @Override
73      public boolean hasSetAsImmediatePayPermission(String principalId) {
74          return getIdentityManagementService().isAuthorized(principalId, OLEConstants.CoreModuleNamespaces.PDP, PdpConstants.PermissionNames.SET_AS_IMMEDIATE_PAY, null);
75      }
76  
77      public IdentityManagementService getIdentityManagementService() {
78          if ( identityManagementService == null ) {
79              identityManagementService = SpringContext.getBean(IdentityManagementService.class);
80          }
81          return identityManagementService;
82      }
83  
84  }