Revision daf9013d
Added by Katja Luther over 12 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/permission/DescriptionPermissionEvaluator.java | ||
---|---|---|
47 | 47 |
public static boolean hasPermission (Collection<GrantedAuthority> authorities, |
48 | 48 |
DescriptionBase targetDomainObject, AuthorityPermission evalPermission){ |
49 | 49 |
Set<DescriptionElementBase> elements = targetDomainObject.getElements(); |
50 |
for (DescriptionElementBase element: elements){ |
|
51 |
for (GrantedAuthority authority :authorities){ |
|
52 |
if (authority.getAuthority().contains(CdmPermissionClass.DESCRIPTIONBASE.toString())){ |
|
53 |
if (authority.getAuthority().lastIndexOf(".") == authority.getAuthority().indexOf(".") && authority.getAuthority().contains(evalPermission.permission.toString())){ |
|
54 |
return true; |
|
55 |
}else{ |
|
50 |
|
|
51 |
for (GrantedAuthority authority :authorities){ |
|
52 |
if (authority.getAuthority().contains(CdmPermissionClass.DESCRIPTIONBASE.toString())){ |
|
53 |
if (authority.getAuthority().lastIndexOf(".") == authority.getAuthority().indexOf(".") && authority.getAuthority().contains(evalPermission.permission.toString())){ |
|
54 |
return true; |
|
55 |
}else{ |
|
56 |
for (DescriptionElementBase element: elements){ |
|
56 | 57 |
if (authority.getAuthority().contains(element.getFeature().getLabel()) && authority.getAuthority().contains(evalPermission.permission.toString())){ |
57 | 58 |
return true; |
58 | 59 |
} |
... | ... | |
61 | 62 |
} |
62 | 63 |
} |
63 | 64 |
|
65 |
|
|
64 | 66 |
return false; |
65 | 67 |
|
66 | 68 |
} |
Also available in: Unified diff