Package org.exist.xmldb

Examples of org.exist.xmldb.UserManagementService.chmod()


        //set the xquery to be owned by 'test1':'users' and set it 'setgid', and set it 'rx' by ohers, so 'test3' can execute it!
        UserManagementService ums = (UserManagementService)test.getService("UserManagementService", "1.0");
        xqueryResource = test.getResource("setgid.xquery");
        ums.chown(xqueryResource, ums.getAccount("test1"), "users");
        ums.chmod(xqueryResource, 02705); //setgid

        //create a collection for the XQuery to write into
        final CollectionManagementService cms = (CollectionManagementService)test.getService("CollectionManagementService", "1.0");
        final Collection colForSetUid = cms.createCollection("forSetGidWrite");
View Full Code Here


        final CollectionManagementService cms = (CollectionManagementService)test.getService("CollectionManagementService", "1.0");
        final Collection colForSetUid = cms.createCollection("forSetGidWrite");

        //only allow the group 'users' to write into the collection
        ums = (UserManagementService)colForSetUid.getService("UserManagementService", "1.0");
        ums.chmod(0570);

        //execute the XQuery as the 'test3' user... it should become 'setgid' of 'users' and succeed.
        final Collection test3 = DatabaseManager.getCollection(baseUri + "/db/securityTest2", "test3", "test3");
        final XPathQueryServiceImpl queryService = (XPathQueryServiceImpl)test3.getService("XPathQueryService", "1.0");
        final ResourceSet result = queryService.executeStoredQuery("/db/securityTest2/setgid.xquery");
View Full Code Here

        test.storeResource(xqueryResource);

        //set the xquery to be owned by 'test1':'users' and set it 'setgid', and set it 'rx' by ohers, so 'test3' can execute it!
        UserManagementService ums = (UserManagementService)test.getService("UserManagementService", "1.0");
        xqueryResource = test.getResource("not_setgid.xquery");
        ums.chmod(xqueryResource, 00705); //NOT setgid

        //create a collection for the XQuery to write into
        final CollectionManagementService cms = (CollectionManagementService)test.getService("CollectionManagementService", "1.0");
        final Collection colForSetUid = cms.createCollection("forSetGidWrite");
View Full Code Here

        final CollectionManagementService cms = (CollectionManagementService)test.getService("CollectionManagementService", "1.0");
        final Collection colForSetUid = cms.createCollection("forSetGidWrite");

        //only allow the group 'users' to write into the collection
        ums = (UserManagementService)colForSetUid.getService("UserManagementService", "1.0");
        ums.chmod(0070);

        //execute the XQuery as the 'test3' user... it should become 'setgid' of 'users' and succeed.
        final Collection test3 = DatabaseManager.getCollection(baseUri + "/db/securityTest2", "test3", "test3");
        final XPathQueryServiceImpl queryService = (XPathQueryServiceImpl)test3.getService("XPathQueryService", "1.0");
        final ResourceSet result = queryService.executeStoredQuery("/db/securityTest2/not_setgid.xquery");
View Full Code Here

        CollectionManagementService cms = (CollectionManagementService)test.getService("CollectionManagementService", "1.0");

        //create /db/securityTest2/parentCollection with owner "test1:users" and mode "rwxr--rwx"
        Collection parentCollection = cms.createCollection("parentCollection");
        UserManagementService ums = (UserManagementService)parentCollection.getService("UserManagementService", "1.0");
        ums.chmod("rwxr--rwx");

        //now create the sub-collection /db/securityTest2/parentCollection/subCollection1
        //as "user3:guest", it should have it's group set to the primary group of user3 i.e. 'guest'
        //as the collection is NOT setUid and it should NOT have the setGid bit set
        parentCollection = DatabaseManager.getCollection(baseUri + "/db/securityTest2/parentCollection", "test3", "test3");
View Full Code Here

        CollectionManagementService cms = (CollectionManagementService)test.getService("CollectionManagementService", "1.0");

        //create /db/securityTest2/parentCollection with owner "test1:users" and mode "rwxrwsrwx"
        Collection parentCollection = cms.createCollection("parentCollection");
        UserManagementService ums = (UserManagementService)parentCollection.getService("UserManagementService", "1.0");
        ums.chmod("rwxrwsrwx");

        //now create the sub-collection /db/securityTest2/parentCollection/subCollection1
        //it should inherit the group ownership 'users' from the parent collection which is setGid
        //and it should inherit the setGid bit
        parentCollection = DatabaseManager.getCollection(baseUri + "/db/securityTest2/parentCollection", "test3", "test3");
View Full Code Here

        CollectionManagementService cms = (CollectionManagementService)test.getService("CollectionManagementService", "1.0");

        //create /db/securityTest2/parentCollection with owner "test1:users" and mode "rwxrwxrwx"
        Collection parentCollection = cms.createCollection("parentCollection");
        UserManagementService ums = (UserManagementService)parentCollection.getService("UserManagementService", "1.0");
        ums.chmod("rwxrwxrwx");

        //now create the sub-resource /db/securityTest2/parentCollection/test.xml
        //as "user3:guest", it should have it's group set to the primary group of user3 i.e. 'guest'
        //as the collection is NOT setGid, the file should NOT have the setGid bit set
        parentCollection = DatabaseManager.getCollection(baseUri + "/db/securityTest2/parentCollection", "test3", "test3");
View Full Code Here

        CollectionManagementService cms = (CollectionManagementService)test.getService("CollectionManagementService", "1.0");

        //create /db/securityTest2/parentCollection with owner "test1:users" and mode "rwxrwsrwx"
        Collection parentCollection = cms.createCollection("parentCollection");
        UserManagementService ums = (UserManagementService)parentCollection.getService("UserManagementService", "1.0");
        ums.chmod("rwxrwsrwx");

        //now as "test3:guest" create the sub-resource /db/securityTest2/parentCollection/test.xml
        //it should inherit the group ownership 'users' from the parent which is setGid
        //but it should not inherit the setGid bit as it is a resource
        parentCollection = DatabaseManager.getCollection(baseUri + "/db/securityTest2/parentCollection", "test3", "test3");
View Full Code Here

        Collection srcCollection = cms.createCollection("src");

        //create /db/securityTest2/parentCollection with owner "test1:users" and mode "rwxrwxrwx"
        Collection parentCollection = cms.createCollection("parentCollection");
        UserManagementService ums = (UserManagementService)parentCollection.getService("UserManagementService", "1.0");
        ums.chmod("rwxrwxrwx");

        //now copy /db/securityTest2/src to /db/securityTest2/parentCollection/src
        //as "user3:guest", it should have it's group set to the primary group of "user3" i.e. 'guest'
        //as the collection is NOT setGid and it should NOT have it's setGid bit set
        test = DatabaseManager.getCollection(baseUri + "/db/securityTest2", "test3", "test3");
View Full Code Here

        ums.chgrp("extusers");

        //create /db/securityTest2/parentCollection with owner "test1:users" and mode "rwxrwsrwx"
        Collection parentCollection = cms.createCollection("parentCollection");
        ums = (UserManagementService)parentCollection.getService("UserManagementService", "1.0");
        ums.chmod("rwxrwsrwx");

        //now copy /db/securityTest2/src to /db/securityTest2/parentCollection/src
        //as "user3:guest", it should inherit the group ownership 'users' from the parent
        //collection which is setGid and it should have its setGid bit set
        test = DatabaseManager.getCollection(baseUri + "/db/securityTest2", "test3", "test3");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.