1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kns.service.impl; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.List; |
20 | |
|
21 | |
import org.apache.commons.lang.StringUtils; |
22 | |
import org.kuali.rice.core.util.AttributeSet; |
23 | |
import org.kuali.rice.kim.bo.role.dto.KimPermissionInfo; |
24 | |
import org.kuali.rice.kim.util.KimConstants; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | 0 | public class ParameterPermissionTypeServiceImpl extends |
30 | |
NamespaceWildcardAllowedAndOrStringExactMatchPermissionTypeServiceImpl { |
31 | |
|
32 | |
{ |
33 | 0 | requiredAttributes.add(KimConstants.AttributeConstants.PARAMETER_NAME); |
34 | 0 | requiredAttributes.add(KimConstants.AttributeConstants.COMPONENT_NAME); |
35 | 0 | checkRequiredAttributes = true; |
36 | 0 | } |
37 | |
|
38 | |
@Override |
39 | |
protected List<KimPermissionInfo> performPermissionMatches(AttributeSet requestedDetails, List<KimPermissionInfo> permissionsList) { |
40 | 0 | String requestedParameterName = requestedDetails.get(KimConstants.AttributeConstants.PARAMETER_NAME); |
41 | 0 | String requestedComponentName = requestedDetails.get(KimConstants.AttributeConstants.COMPONENT_NAME); |
42 | 0 | List<KimPermissionInfo> matchingPermissions = new ArrayList<KimPermissionInfo>(); |
43 | 0 | for ( KimPermissionInfo kpi : permissionsList ) { |
44 | 0 | String parameterName = kpi.getDetails().get(KimConstants.AttributeConstants.PARAMETER_NAME); |
45 | 0 | String componentName = kpi.getDetails().get(KimConstants.AttributeConstants.COMPONENT_NAME); |
46 | 0 | if ( (StringUtils.isBlank(parameterName) |
47 | |
|| StringUtils.equals(requestedParameterName, parameterName)) |
48 | |
&&(StringUtils.isBlank(componentName) |
49 | |
|| StringUtils.equals(requestedComponentName, componentName))) { |
50 | 0 | matchingPermissions.add(kpi); |
51 | |
} |
52 | 0 | } |
53 | 0 | return super.performPermissionMatches(requestedDetails, matchingPermissions); |
54 | |
} |
55 | |
} |