NIHVIVO-3523 Add DefaultPermissionSetForNewUsers to the User Accounts Model, with a property in PermissionSet and a test in UserAccountsDaoJenaTest.
This commit is contained in:
parent
7d7503fc22
commit
a9c7b3fead
6 changed files with 32 additions and 11 deletions
|
@ -358,6 +358,7 @@ public class UserAccountsDaoJenaTest extends AbstractTestClass {
|
|||
PermissionSet ps2 = new PermissionSet();
|
||||
ps2.setUri(URI_ROLE2);
|
||||
ps2.setLabel("Role 2");
|
||||
ps2.setDefaultForNewUsers(true);
|
||||
expected.add(ps2);
|
||||
|
||||
assertCorrectPermissionSets(expected, dao.getAllPermissionSets());
|
||||
|
@ -450,25 +451,26 @@ public class UserAccountsDaoJenaTest extends AbstractTestClass {
|
|||
Collection<PermissionSet> actual) {
|
||||
Set<Map<String, Object>> expectedMaps = new HashSet<Map<String, Object>>();
|
||||
for (PermissionSet ps : expected) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("uri", ps.getUri());
|
||||
map.put("label", ps.getLabel());
|
||||
map.put("permissions", ps.getPermissionUris());
|
||||
expectedMaps.add(map);
|
||||
expectedMaps.add(buildMapFromPermissionSet(ps));
|
||||
}
|
||||
|
||||
Set<Map<String, Object>> actualMaps = new HashSet<Map<String, Object>>();
|
||||
for (PermissionSet ps : actual) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("uri", ps.getUri());
|
||||
map.put("label", ps.getLabel());
|
||||
map.put("permissions", ps.getPermissionUris());
|
||||
actualMaps.add(map);
|
||||
actualMaps.add(buildMapFromPermissionSet(ps));
|
||||
}
|
||||
|
||||
assertEquals("all permission sets", expectedMaps, actualMaps);
|
||||
}
|
||||
|
||||
private Map<String, Object> buildMapFromPermissionSet(PermissionSet ps) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("uri", ps.getUri());
|
||||
map.put("label", ps.getLabel());
|
||||
map.put("permissions", ps.getPermissionUris());
|
||||
map.put("defaultForNewUsers", ps.isDefaultForNewUsers());
|
||||
return map;
|
||||
}
|
||||
|
||||
private void assertExpectedAccountUris(String label,
|
||||
Set<UserAccount> expectedUserAccounts,
|
||||
Collection<UserAccount> actualUserAccounts) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
||||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
||||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
||||
@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
||||
@prefix auth: <http://vitro.mannlib.cornell.edu/ns/vitro/authorization#> .
|
||||
@prefix mydomain: <http://vivo.mydomain.edu/individual/> .
|
||||
|
@ -30,6 +31,7 @@ mydomain:role1
|
|||
|
||||
mydomain:role2
|
||||
a auth:PermissionSet ;
|
||||
a auth:DefaultPermissionSetForNewUsers ;
|
||||
rdfs:label "Role 2" ;
|
||||
.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue