use of javax.jcr.security.Privilege in project jackrabbit by apache.
the class ReadTest method testDenyGroupPathAllowEveryoneChildPath.
public void testDenyGroupPathAllowEveryoneChildPath() throws Exception {
Privilege[] privileges = privilegesFromName(Privilege.JCR_READ);
Principal group = getTestGroup().getPrincipal();
Principal everyone = ((JackrabbitSession) superuser).getPrincipalManager().getEveryone();
/*
deny READ privilege for group at 'path'
*/
withdrawPrivileges(path, group, privileges, getRestrictions(superuser, path));
/*
allow READ privilege for everyone at 'childNPath'
*/
givePrivileges(path, everyone, privileges, getRestrictions(superuser, childNPath));
Session testSession = getTestSession();
assertTrue(testSession.nodeExists(childNPath));
}
use of javax.jcr.security.Privilege in project jackrabbit by apache.
the class ReadTest method testDenyUserAllowGroup.
public void testDenyUserAllowGroup() throws Exception {
Privilege[] privileges = privilegesFromName(Privilege.JCR_READ);
Principal group = getTestGroup().getPrincipal();
/*
deny READ privilege for testUser at 'path'
*/
withdrawPrivileges(path, testUser.getPrincipal(), privileges, getRestrictions(superuser, path));
/*
allow READ privilege for group at 'path'
*/
givePrivileges(path, group, privileges, getRestrictions(superuser, path));
Session testSession = getTestSession();
assertFalse(testSession.nodeExists(path));
}
use of javax.jcr.security.Privilege in project jackrabbit by apache.
the class ReadTest method testAllowEveryoneDenyGroup.
public void testAllowEveryoneDenyGroup() throws Exception {
Privilege[] privileges = privilegesFromName(Privilege.JCR_READ);
Principal group = getTestGroup().getPrincipal();
Principal everyone = ((JackrabbitSession) superuser).getPrincipalManager().getEveryone();
/*
allow READ privilege for everyone at 'path'
*/
givePrivileges(path, everyone, privileges, getRestrictions(superuser, path));
/*
deny READ privilege for group at 'path'
*/
withdrawPrivileges(path, group, privileges, getRestrictions(superuser, path));
Session testSession = getTestSession();
assertFalse(testSession.nodeExists(path));
}
use of javax.jcr.security.Privilege in project jackrabbit by apache.
the class ReadTest method testDenyGroupPathAllowUserChildPath.
public void testDenyGroupPathAllowUserChildPath() throws Exception {
Privilege[] privileges = privilegesFromName(Privilege.JCR_READ);
Principal group = getTestGroup().getPrincipal();
/*
deny READ privilege for group at 'path'
*/
withdrawPrivileges(path, group, privileges, getRestrictions(superuser, path));
/*
allow READ privilege for testUser at 'childNPath'
*/
givePrivileges(path, testUser.getPrincipal(), privileges, getRestrictions(superuser, childNPath));
Session testSession = getTestSession();
assertTrue(testSession.nodeExists(childNPath));
}
use of javax.jcr.security.Privilege in project jackrabbit by apache.
the class ReadTest method testDenyGroupAllowEveryone.
public void testDenyGroupAllowEveryone() throws Exception {
Privilege[] privileges = privilegesFromName(Privilege.JCR_READ);
Principal group = getTestGroup().getPrincipal();
Principal everyone = ((JackrabbitSession) superuser).getPrincipalManager().getEveryone();
/*
deny READ privilege for group at 'path'
*/
withdrawPrivileges(path, group, privileges, getRestrictions(superuser, path));
/*
allow READ privilege for everyone at 'path'
*/
givePrivileges(path, everyone, privileges, getRestrictions(superuser, path));
Session testSession = getTestSession();
assertTrue(testSession.nodeExists(path));
}
Aggregations