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.kim.bo.impl.KimAttributes; |
23 | |
import org.kuali.rice.kim.bo.role.dto.KimPermissionInfo; |
24 | |
import org.kuali.rice.kim.bo.types.dto.AttributeSet; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | 0 | public class ParameterPermissionTypeServiceImpl extends |
30 | |
NamespaceWildcardAllowedAndOrStringExactMatchPermissionTypeServiceImpl { |
31 | |
|
32 | |
{ |
33 | 0 | requiredAttributes.add(KimAttributes.PARAMETER_NAME); |
34 | 0 | requiredAttributes.add(KimAttributes.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(KimAttributes.PARAMETER_NAME); |
41 | 0 | String requestedComponentName = requestedDetails.get(KimAttributes.COMPONENT_NAME); |
42 | 0 | List<KimPermissionInfo> matchingPermissions = new ArrayList<KimPermissionInfo>(); |
43 | 0 | for ( KimPermissionInfo kpi : permissionsList ) { |
44 | 0 | String parameterName = kpi.getDetails().get(KimAttributes.PARAMETER_NAME); |
45 | 0 | String componentName = kpi.getDetails().get(KimAttributes.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 | |
} |