1
|
package eu.etaxonomy.cdm.permission;
|
2
|
|
3
|
import org.springframework.security.core.Authentication;
|
4
|
|
5
|
import eu.etaxonomy.cdm.model.common.User;
|
6
|
|
7
|
public class UserPermissionEvaluator extends CdmPermissionEvaluator {
|
8
|
|
9
|
public boolean hasPermission(Authentication authentication,
|
10
|
User targetDomainObject, Object permission) {
|
11
|
|
12
|
if (permission.getClass().isEnum()){
|
13
|
|
14
|
}else if (permission.getClass().equals(String.class)){
|
15
|
String permissionString = (String)permission;
|
16
|
if (permissionString.equals("changePassword") && targetDomainObject.equals(authentication.getPrincipal())){
|
17
|
return true;
|
18
|
}
|
19
|
}
|
20
|
|
21
|
|
22
|
|
23
|
return false;
|
24
|
}
|
25
|
}
|