Package org.exist.xmldb

Examples of org.exist.xmldb.UserManagementService


    @Override
    protected void createGroup(String group_uid, String uid, String pwd) throws ApiException {
        Collection col = null;
        try {
            col = DatabaseManager.getCollection(baseUri + "/db", uid, pwd);
            final UserManagementService ums = (UserManagementService) col.getService("UserManagementService", "1.0");

            Group group = new GroupAider("exist", group_uid);
            ums.addGroup(group);
        } catch(final XMLDBException xmldbe) {
            throw new ApiException(xmldbe);
        } finally {
            if(col != null) {
                try {
View Full Code Here


     */
    @Test
    public void dbaChownGidResource() throws XMLDBException {
        final Collection test = DatabaseManager.getCollection(baseUri + "/db/securityTest1", "admin", "");
        final Resource resource = test.getResource("test.xml");
        final UserManagementService ums = (UserManagementService)test.getService("UserManagementService", "1.0");

        // attempt to change uid ownership of /db/securityTest1/test.xml to the guest group
        ums.chgrp(resource, "guest");
    }
View Full Code Here

     */
    @Test(expected=XMLDBException.class)
    public void ownerChownUidResource() throws XMLDBException {
        final Collection test = DatabaseManager.getCollection(baseUri + "/db/securityTest1", "test1", "test1");
        final Resource resource = test.getResource("test.xml");
        final UserManagementService ums = (UserManagementService)test.getService("UserManagementService", "1.0");

        // attempt to change uid ownership of /db/securityTest1/test.xml to the test2 user
        final Account test2 = ums.getAccount("test2");
        ums.chown(resource, test2);
    }
View Full Code Here

     */
    @Test(expected=XMLDBException.class)
    public void ownerChownGidResource() throws XMLDBException {
        final Collection test = DatabaseManager.getCollection(baseUri + "/db/securityTest1", "test1", "test1");
        final Resource resource = test.getResource("test.xml");
        final UserManagementService ums = (UserManagementService)test.getService("UserManagementService", "1.0");

        // attempt to change gid ownership of /db/securityTest1/test.xml to the guest group
        ums.chgrp(resource, "guest");
    }
View Full Code Here

     */
    @Test(expected=XMLDBException.class)
    public void groupMemberChownUidResource() throws XMLDBException {
        final Collection test = DatabaseManager.getCollection(baseUri + "/db/securityTest1", "test2", "test2");
        final Resource resource = test.getResource("test.xml");
        final UserManagementService ums = (UserManagementService)test.getService("UserManagementService", "1.0");

        // attempt to take uid ownership of /db/securityTest1/test.xml
        final Account test2 = ums.getAccount("test2");
        ums.chown(resource, test2);
    }
View Full Code Here

     */
    @Test
    public void ownerAndGroupMemberChownGidResource() throws XMLDBException {
        final Collection test = DatabaseManager.getCollection(baseUri + "/db/securityTest1", "test1", "test1");
        final Resource resource = test.getResource("test.xml");
        final UserManagementService ums = (UserManagementService)test.getService("UserManagementService", "1.0");

        // attempt to take gid ownership of /db/securityTest1
        ums.chgrp(resource, "extusers");

        final Permission perms = ums.getPermissions(resource);
        assertEquals("extusers", perms.getGroup().getName());
    }
View Full Code Here

     */
    @Test(expected=XMLDBException.class)
    public void groupMemberChownGidResource() throws XMLDBException {
        final Collection test = DatabaseManager.getCollection(baseUri + "/db/securityTest1", "test2", "test2");
        final Resource resource = test.getResource("test.xml");
        final UserManagementService ums = (UserManagementService)test.getService("UserManagementService", "1.0");

        // attempt to take gid ownership of /db/securityTest1/test.xml
        ums.chgrp(resource, "users");

        final Permission perms = ums.getPermissions(resource);
        assertEquals("users", perms.getGroup().getName());
    }
View Full Code Here

     */
    @Test(expected=XMLDBException.class)
    public void groupNonMemberChownGidResource() throws XMLDBException {
        final Collection test = DatabaseManager.getCollection(baseUri + "/db/securityTest1", "test2", "test2");
        final Resource resource = test.getResource("test.xml");
        final UserManagementService ums = (UserManagementService)test.getService("UserManagementService", "1.0");

        // attempt to take gid ownership of /db/securityTest1/test.xml
        ums.chgrp(resource, "guest");
    }
View Full Code Here

    }

    @Test
    public void onlyExecuteRequiredToOpenCollectionContent() throws XMLDBException {
        final Collection test = DatabaseManager.getCollection(baseUri + "/db/securityTest1", "test1", "test1");
        final UserManagementService ums = (UserManagementService) test.getService("UserManagementService", "1.0");

        ums.chmod("--x------");
        test.close();

        DatabaseManager.getCollection(baseUri + "/db/securityTest1", "test1", "test1");
    }
View Full Code Here

    }

    @Test(expected=XMLDBException.class)
    public void cannotOpenCollectionWithoutExecute() throws XMLDBException {
        final Collection test = DatabaseManager.getCollection(baseUri + "/db/securityTest1", "test1", "test1");
        final UserManagementService ums = (UserManagementService) test.getService("UserManagementService", "1.0");

        ums.chmod("rw-rw-rw-");
        test.close();

        DatabaseManager.getCollection(baseUri + "/db/securityTest1", "test1", "test1");
    }
View Full Code Here

TOP

Related Classes of org.exist.xmldb.UserManagementService

Copyright © 2018 www.massapicom. 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.