Package org.exist.xmldb

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


        test.storeResource(resource);

        //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/test.xml to /db/securityTest2/parentCollection/test.xml
        //as user3, 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 the setGid bit
        test = DatabaseManager.getCollection(baseUri + "/db/securityTest2", "test3", "test3");
View Full Code Here


        ums.chgrp(resource, "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/test.xml to /db/securityTest2/parentCollection/test.xml
        //as "user3:guest", it should inherit the group ownership 'users' from the parent collection which is setGid
        //and it should NOT have its setGid bit set as it is a resource
        test = DatabaseManager.getCollection(baseUri + "/db/securityTest2", "test3", "test3");
View Full Code Here

    public void setup() {
        try {
            final Collection root = DatabaseManager.getCollection(baseUri + "/db", "admin", "");
            UserManagementService ums = (UserManagementService) root.getService("UserManagementService", "1.0");

            ums.chmod("rwxr-xr-x"); //ensure /db is always 755

            //remove accounts 'test1', 'test2' and 'test3'
            removeAccounts(ums, new String[]{"test1", "test2", "test3"});

            //remove group 'users'
View Full Code Here

            ums = (UserManagementService) test.getService("UserManagementService", "1.0");
            //change ownership to test1
            final Account test1 = ums.getAccount("test1");
            ums.chown(test1, "users");
            // full permissions for user and group, none for world
            ums.chmod(0770);

            test = DatabaseManager.getCollection(baseUri + "/db/securityTest1", "test1", "test1");

            // create a resource /db/securityTest1/test.xml owned by "test1:users" and mode 0770
            Resource resource = test.createResource("test.xml", XMLResource.RESOURCE_TYPE);
View Full Code Here

            // create a resource /db/securityTest1/test.xml owned by "test1:users" and mode 0770
            Resource resource = test.createResource("test.xml", XMLResource.RESOURCE_TYPE);
            resource.setContent("<test/>");
            test.storeResource(resource);
            ums.chmod(resource, 0770);

            resource = test.createResource("test.bin", BinaryResource.RESOURCE_TYPE);
            resource.setContent("binary-test".getBytes());
            test.storeResource(resource);
            ums.chmod(resource, 0770);
View Full Code Here

            ums.chmod(resource, 0770);

            resource = test.createResource("test.bin", BinaryResource.RESOURCE_TYPE);
            resource.setContent("binary-test".getBytes());
            test.storeResource(resource);
            ums.chmod(resource, 0770);

            // create a collection /db/securityTest2 as user "test1"
            cms = (CollectionManagementService)root.getService("CollectionManagementService", "1.0");
            Collection testCol2 = cms.createCollection("securityTest2");
            ums = (UserManagementService) testCol2.getService("UserManagementService", "1.0");
View Full Code Here

            Collection testCol2 = cms.createCollection("securityTest2");
            ums = (UserManagementService) testCol2.getService("UserManagementService", "1.0");
            //change ownership to test1
            ums.chown(test1, "users");
            // full permissions for user and group, none for world
            ums.chmod(0775);

            // create a collection /db/securityTest3 as user "test3"
            cms = (CollectionManagementService)root.getService("CollectionManagementService", "1.0");
            Collection testCol3 = cms.createCollection("securityTest3");
            ums = (UserManagementService) testCol3.getService("UserManagementService", "1.0");
View Full Code Here

            ums = (UserManagementService) testCol3.getService("UserManagementService", "1.0");
            //change ownership to test3
            final Account test3 = ums.getAccount("test3");
            ums.chown(test3, "users");
            // full permissions for all
            ums.chmod(0777);
        } catch(final XMLDBException xmldbe) {
            xmldbe.printStackTrace();
            fail(xmldbe.getMessage());
        }
    }
View Full Code Here

               
                throw new XPathException(this, "Needs a valid user name, not: " + user);
            }

            ums.chown(usr, group);
            ums.chmod(mode);

        } catch(final XMLDBException xe) {
            throw new XPathException(this, "Unable to change collection permissions: " + xe.getMessage(), xe);
        }
View Full Code Here

     */
    public Sequence evalWithCollection(Collection collection, Sequence[] args, Sequence contextSequence)
  throws XPathException {
  try {
            final UserManagementService ums = (UserManagementService) collection.getService("UserManagementService", "1.0");
            ums.chmod(((IntegerValue) args[1].convertTo(Type.INTEGER)).getInt());
        } catch (final XMLDBException xe) {
      logger.error("Unable to change collection mode", xe);
      throw new XPathException(this, "Unable to change collection mode", xe);
  }
  return Sequence.EMPTY_SEQUENCE;
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.