1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.student.common.ui.server.gwt; |
17 |
|
|
18 |
|
import org.kuali.rice.kim.bo.types.dto.AttributeSet; |
19 |
|
import org.kuali.rice.kim.service.IdentityManagementService; |
20 |
|
import org.kuali.student.common.rice.StudentIdentityConstants; |
21 |
|
import org.kuali.student.common.rice.authorization.PermissionType; |
22 |
|
import org.kuali.student.common.ui.client.service.SecurityRpcService; |
23 |
|
import org.kuali.student.common.ui.client.service.exceptions.OperationFailedException; |
24 |
|
import org.kuali.student.common.util.security.SecurityUtils; |
25 |
|
|
26 |
|
import com.google.gwt.user.server.rpc.RemoteServiceServlet; |
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
@author |
32 |
|
|
33 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 5 |
Complexity Density: 0.42 |
|
34 |
|
public class SecurityRpcGwtServlet extends RemoteServiceServlet implements SecurityRpcService{ |
35 |
|
|
36 |
|
private static final long serialVersionUID = 1L; |
37 |
|
private IdentityManagementService permissionService; |
38 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
39 |
0
|
public String getPrincipalUsername(){... |
40 |
0
|
return SecurityUtils.getPrincipalUserName(); |
41 |
|
} |
42 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
|
43 |
0
|
@Override... |
44 |
|
public Boolean checkAdminPermission(String principalId, String screenComponent) throws OperationFailedException { |
45 |
0
|
System.out.println("SecurityRpcGwtServlet.checkAdminPermission for : " + principalId + " component " + screenComponent); |
46 |
0
|
AttributeSet permDetails = new AttributeSet(); |
47 |
0
|
permDetails.put(StudentIdentityConstants.SCREEN_COMPONENT,screenComponent); |
48 |
0
|
boolean hasAccess = false; |
49 |
0
|
hasAccess = getPermissionService().isAuthorizedByTemplateName(principalId, |
50 |
|
PermissionType.KS_ADMIN_SCREEN.getPermissionNamespace(), |
51 |
|
PermissionType.KS_ADMIN_SCREEN.getPermissionTemplateName(), permDetails, |
52 |
|
permDetails); |
53 |
0
|
System.out.println(principalId + " has access : " + hasAccess); |
54 |
0
|
return hasAccess; |
55 |
|
} |
56 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
57 |
0
|
public void setPermissionService(IdentityManagementService permissionService) {... |
58 |
0
|
this.permissionService = permissionService; |
59 |
|
} |
60 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
61 |
0
|
public IdentityManagementService getPermissionService()throws OperationFailedException{... |
62 |
0
|
if(permissionService==null){ |
63 |
0
|
throw new OperationFailedException("Permission Service is unavailable"); |
64 |
|
} |
65 |
|
|
66 |
0
|
return permissionService; |
67 |
|
} |
68 |
|
} |