1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kew.service.impl; |
17 | |
|
18 | |
import org.apache.commons.lang.StringUtils; |
19 | |
import org.kuali.rice.kim.api.permission.Permission; |
20 | |
import org.kuali.rice.kim.impl.permission.PermissionBo; |
21 | |
import org.kuali.rice.kim.service.support.KimPermissionTypeService; |
22 | |
import org.kuali.rice.kim.util.KimConstants; |
23 | |
import org.kuali.rice.krad.service.impl.DocumentTypePermissionTypeServiceImpl; |
24 | |
|
25 | |
import java.util.ArrayList; |
26 | |
import java.util.List; |
27 | |
import java.util.Map; |
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | 0 | public class AdhocReviewPermissionTypeServiceImpl extends DocumentTypePermissionTypeServiceImpl implements KimPermissionTypeService{ |
37 | |
|
38 | |
{ |
39 | 0 | requiredAttributes.add( KimConstants.AttributeConstants.ACTION_REQUEST_CD ); |
40 | 0 | } |
41 | |
|
42 | |
@Override |
43 | |
public List<Permission> performPermissionMatches( |
44 | |
Map<String, String> requestedDetails, |
45 | |
List<Permission> permissionsList) { |
46 | 0 | List<Permission> matchingPermissions = new ArrayList<Permission>(); |
47 | 0 | if (requestedDetails == null) { |
48 | 0 | return matchingPermissions; |
49 | |
} |
50 | |
|
51 | 0 | for (Permission kpi : permissionsList) { |
52 | 0 | PermissionBo bo = PermissionBo.from(kpi); |
53 | 0 | if (!bo.getDetails().containsKey(KimConstants.AttributeConstants.ACTION_REQUEST_CD) |
54 | |
|| StringUtils.equals(bo.getDetails(). |
55 | |
get(KimConstants.AttributeConstants.ACTION_REQUEST_CD), requestedDetails |
56 | |
.get(KimConstants.AttributeConstants.ACTION_REQUEST_CD))) { |
57 | 0 | matchingPermissions.add(kpi); |
58 | |
} |
59 | 0 | } |
60 | |
|
61 | 0 | matchingPermissions = super.performPermissionMatches(requestedDetails,matchingPermissions); |
62 | 0 | return matchingPermissions; |
63 | |
} |
64 | |
} |