| 188 | | ACL acl = new ACLImpl(); |
|---|
| 189 | | acl.add(new ACE(SecurityConstants.ADMINISTRATORS, SecurityConstants.EVERYTHING, true)); |
|---|
| 190 | | acl.add(new ACE(SecurityConstants.MEMBERS, SecurityConstants.READ, true)); |
|---|
| 191 | | acl.add(new ACE(SecurityConstants.MEMBERS, SecurityConstants.VERSION, true)); |
|---|
| | 188 | } |
|---|
| | 189 | if (acp.listUsernamesForPermission(SecurityConstants.EVERYTHING).length == 0) { |
|---|
| | 190 | // if nobody has the right to manage the repository set a |
|---|
| | 191 | // default ACP that can be later overridden by the content |
|---|
| | 192 | // template manager of NXP |
|---|
| | 193 | |
|---|
| | 194 | ACL acl = acp.getOrCreateACL(); |
|---|
| | 195 | acl.add(new ACE(SecurityConstants.ADMINISTRATORS, |
|---|
| | 196 | SecurityConstants.EVERYTHING, true)); |
|---|
| | 197 | acl.add(new ACE(SecurityConstants.MEMBERS, |
|---|
| | 198 | SecurityConstants.READ, true)); |
|---|
| | 199 | acl.add(new ACE(SecurityConstants.MEMBERS, |
|---|
| | 200 | SecurityConstants.VERSION, true)); |
|---|
| 199 | | } else { |
|---|
| 200 | | Access access = acp.getAccess(SecurityConstants.ADMINISTRATORS, SecurityConstants.EVERYTHING); |
|---|
| 201 | | if (access == Access.GRANT) { |
|---|
| 202 | | return; |
|---|
| 203 | | } |
|---|
| 204 | | ACL acl = acp.getOrCreateACL(); |
|---|
| 205 | | acl.add(new ACE(SecurityConstants.ADMINISTRATORS, SecurityConstants.EVERYTHING, true)); |
|---|
| 206 | | acl.add(new ACE(SecurityConstants.MEMBERS, SecurityConstants.READ, true)); |
|---|
| 207 | | acl.add(new ACE(SecurityConstants.MEMBERS, SecurityConstants.VERSION, true)); |
|---|
| 208 | | // temporary hack to have junit tests running |
|---|
| 209 | | // TODO - update tests to an user from the administrators group |
|---|
| 210 | | acl.add(new ACE(SecurityConstants.ADMINISTRATOR, SecurityConstants.EVERYTHING, true)); |
|---|
| 211 | | session.getSecurityManager().setACP(this, acp, true); |
|---|
| 212 | | // be sure to save the session |
|---|
| 213 | | session.jcrSession().save(); |
|---|