use of org.exist.storage.BrokerPool in project exist by eXist-db.
the class PermissionsFunctionChownTest method changeDocumentGroupToSelfAsNonDBAOwner_clearsSetUidAndSetGid.
/**
* With {@code posix-chown-restricted="false"},
* as the document owner user change the group of {@link #USER1_DOC1} from "user1" to "user1".
* Finally make sure that chown has cleared the setUid and setGid bits.
*/
@Test
public void changeDocumentGroupToSelfAsNonDBAOwner_clearsSetUidAndSetGid() throws AuthenticationException, EXistException, PermissionDeniedException, XPathException {
final BrokerPool pool = existWebServer.getBrokerPool();
final Subject user1 = pool.getSecurityManager().authenticate(USER1_NAME, USER1_PWD);
// check the setUid and setGid bits are set before we begin
assertDocumentSetUidSetGid(user1, TestConstants.TEST_COLLECTION_URI.append(USER1_XQUERY1), IS_SET);
// change the owner
changeGroup(user1, NOT_RESTRICTED, TestConstants.TEST_COLLECTION_URI.append(USER1_XQUERY1), USER1_NAME);
// check the setUid and setGid bits are now cleared
assertDocumentSetUidSetGid(user1, TestConstants.TEST_COLLECTION_URI.append(USER1_XQUERY1), NOT_SET);
}
use of org.exist.storage.BrokerPool in project exist by eXist-db.
the class PermissionsFunctionChownTest method changeCollectionGroupToSelfAsDBA_preservesSetUidAndSetGid_restricted.
/**
* With {@code posix-chown-restricted="true"},
* as the DBA user change the group of {@link #USER1_COL2} from "user1" to "user1".
* Finally make sure that chown has preserved the setUid and setGid bits.
*/
@Test
public void changeCollectionGroupToSelfAsDBA_preservesSetUidAndSetGid_restricted() throws EXistException, PermissionDeniedException, XPathException {
final BrokerPool pool = existWebServer.getBrokerPool();
final Subject user1 = pool.getSecurityManager().getSystemSubject();
// check the setUid and setGid bits are set before we begin
assertCollectionSetUidSetGid(user1, TestConstants.TEST_COLLECTION_URI.append(USER1_COL2), IS_SET);
// change the owner
changeGroup(user1, RESTRICTED, TestConstants.TEST_COLLECTION_URI.append(USER1_COL2), USER1_NAME);
// check the setUid and setGid bits are still set
assertCollectionSetUidSetGid(user1, TestConstants.TEST_COLLECTION_URI.append(USER1_COL2), IS_SET);
}
use of org.exist.storage.BrokerPool in project exist by eXist-db.
the class PermissionsFunctionChownTest method changeDocumentGroupToSelfAsNonDBAOwner_clearsSetUidAndSetGid_restricted.
/**
* With {@code posix-chown-restricted="true"},
* as the document owner user change the group of {@link #USER1_DOC1} from "user1" to "user1".
* Finally make sure that chown has cleared the setUid and setGid bits.
*/
@Test
public void changeDocumentGroupToSelfAsNonDBAOwner_clearsSetUidAndSetGid_restricted() throws AuthenticationException, EXistException, PermissionDeniedException, XPathException {
final BrokerPool pool = existWebServer.getBrokerPool();
final Subject user1 = pool.getSecurityManager().authenticate(USER1_NAME, USER1_PWD);
// check the setUid and setGid bits are set before we begin
assertDocumentSetUidSetGid(user1, TestConstants.TEST_COLLECTION_URI.append(USER1_XQUERY1), IS_SET);
// change the owner
changeGroup(user1, RESTRICTED, TestConstants.TEST_COLLECTION_URI.append(USER1_XQUERY1), USER1_NAME);
// check the setUid and setGid bits are now cleared
assertDocumentSetUidSetGid(user1, TestConstants.TEST_COLLECTION_URI.append(USER1_XQUERY1), NOT_SET);
}
use of org.exist.storage.BrokerPool in project exist by eXist-db.
the class PermissionsFunctionChownTest method changeCollectionOwnerToSelfAsDBA_preservesSetUidAndSetGid_restricted.
/**
* With {@code posix-chown-restricted="true"},
* as the DBA user change the owner of {@link #USER1_COL2} from "user1" to "user1".
* Finally make sure that chown has preserved the setUid and setGid bits.
*/
@Test
public void changeCollectionOwnerToSelfAsDBA_preservesSetUidAndSetGid_restricted() throws EXistException, PermissionDeniedException, XPathException {
final BrokerPool pool = existWebServer.getBrokerPool();
final Subject user1 = pool.getSecurityManager().getSystemSubject();
// check the setUid and setGid bits are set before we begin
assertCollectionSetUidSetGid(user1, TestConstants.TEST_COLLECTION_URI.append(USER1_COL2), IS_SET);
// change the owner
changeOwner(user1, RESTRICTED, TestConstants.TEST_COLLECTION_URI.append(USER1_COL2), USER1_NAME);
// check the setUid and setGid bits are still set
assertCollectionSetUidSetGid(user1, TestConstants.TEST_COLLECTION_URI.append(USER1_COL2), IS_SET);
}
use of org.exist.storage.BrokerPool in project exist by eXist-db.
the class PermissionsFunctionChownTest method changeCollectionGroupToSelfAsDBA_preservesSetUidAndSetGid.
/**
* With {@code posix-chown-restricted="false"},
* as the DBA user change the owner of {@link #USER1_COL2} from "user1" to "user1".
* Finally make sure that chown has preserved the setUid and setGid bits.
*/
@Test
public void changeCollectionGroupToSelfAsDBA_preservesSetUidAndSetGid() throws EXistException, PermissionDeniedException, XPathException {
final BrokerPool pool = existWebServer.getBrokerPool();
final Subject user1 = pool.getSecurityManager().getSystemSubject();
// check the setUid and setGid bits are set before we begin
assertCollectionSetUidSetGid(user1, TestConstants.TEST_COLLECTION_URI.append(USER1_COL2), IS_SET);
// change the owner
changeGroup(user1, NOT_RESTRICTED, TestConstants.TEST_COLLECTION_URI.append(USER1_COL2), USER1_NAME);
// check the setUid and setGid bits are still set
assertCollectionSetUidSetGid(user1, TestConstants.TEST_COLLECTION_URI.append(USER1_COL2), IS_SET);
}
Aggregations