Package org.apache.webdav.lib.properties

Examples of org.apache.webdav.lib.properties.AclProperty


    public AclProperty aclfindMethod(String path)
        throws HttpException, IOException {

        setClient();

        AclProperty acl = null;

        Vector properties = new Vector();
        properties.addElement(AclProperty.TAG_NAME);

        // Default depth=0, type=by_name
View Full Code Here


            } else if (LockDiscoveryProperty.TAG_NAME.equals(localName)) {
                property = new LockDiscoveryProperty(response, element);
            } else if (SupportedLockProperty.TAG_NAME.equals(localName)) {
                property = new SupportedLockProperty(response, element);
            } else if (AclProperty.TAG_NAME.equals(localName)) {
                property = new AclProperty(response, element);
            } else if (PrincipalCollectionSetProperty.TAG_NAME.equals(localName)) {
                property = new PrincipalCollectionSetProperty(response, element);
            } else if (OwnerProperty.TAG_NAME.equals(localName)) {
                property = new OwnerProperty(response, element);
            }
View Full Code Here

    void acl(String path)
    {
        try
        {
            AclProperty acl=null;
            if (path!=null) {
                path=checkUri(path);
            }
            else {
                path=webdavResource.getPath();
            }
            acl = webdavResource.aclfindMethod(path);

            if (acl==null)
            {
                out.println("Error: PropFind didn't return an AclProperty!");
                return;
            }
            out.println();
            showAces(path, acl.getAces());
        }
        catch (Exception ex)
        {
            handleException(ex);
        }
View Full Code Here

    }

    private boolean addPermission(WebdavResource webdavResource, QName permission, String path, String principal, boolean negative) throws HttpException, IOException
    {

        AclProperty acl = webdavResource.aclfindMethod(path);
        if (acl==null)
        {
            out.println("Error: PropFind didn't return an AclProperty!");
            return false;
        }
        Ace[] aces=acl.getAces();

        if (aces==null)
            aces=new Ace[0];

        if (debugLevel>5) {
            out.println();
            out.println("ACL from server");
            showAces(path, aces);
        }

        Ace ace=null;
        for (int i=0; i<aces.length && (ace==null); i++)
        {
            if ((aces[i].isNegative()==negative) && !aces[i].isProtected()
                && !aces[i].isInherited() && aces[i].getPrincipal().equals(principal))
            {
                if (debugLevel>5)
                    out.println("found ace");
                ace=aces[i];
            }
        }
        if (ace==null)
        {
            Ace[] oldAces=aces;
            aces=new Ace[oldAces.length+1];
            System.arraycopy(oldAces,0,aces,0,oldAces.length);
            ace=new Ace(principal, negative, false, false,null);
            aces[oldAces.length]=ace;
        }

        Privilege privilege=new Privilege(permission.getNamespaceURI(), permission.getLocalName(), null);
        ace.addPrivilege(privilege);

        if (debugLevel>5) {
            out.println();
            out.println("ACL with updated privileges");
            showAces(path, aces);
        }

        boolean success = webdavResource.aclMethod(path,aces);

        if (!success)
            out.println(webdavResource.getStatusMessage());

        if (debugLevel>5) {
            acl = webdavResource.aclfindMethod(path);
            if (acl==null)
                out.println("Error: PropFind didn't return an AclProperty!");
            else
            {
                aces=acl.getAces();
                out.println();
                out.println("ACL from server after update");
                showAces(path, aces);
            }
        }
View Full Code Here

        return success;
    }

    private boolean removePermission(WebdavResource webdavResource, QName permission, String path, String principal) throws HttpException, IOException
    {
        AclProperty acl = webdavResource.aclfindMethod(path);
        if (acl==null)
        {
            out.println("Error: PropFind didn't return an AclProperty!");
            return false;
        }
        Ace[] aces=acl.getAces();

        if (aces==null)
        {
            out.println("Privilege not found");
            return false;
        }

        if (debugLevel>5) {
            out.println();
            out.println("ACL from server");
            showAces(path, aces);
        }

        boolean found=false;
        Privilege privilege=new Privilege(permission.getNamespaceURI(), permission.getLocalName(), null);
        for (int i=0; i<aces.length; i++)
        {
            if (!aces[i].isProtected() && !aces[i].isInherited() && aces[i].getPrincipal().equals(principal))
            {
                if (debugLevel>5)
                    out.println("found ace");
                boolean removed = aces[i].removePrivilege(privilege);
                found = found || removed;
                if (removed)
                    out.println("Privilege removed");
            }
        }

        if (!found)
        {
            out.println("Privilege not found");
            return false;
        }

        if (debugLevel>5) {
            out.println();
            out.println("ACL with updated privileges");
            showAces(path, aces);
        }

        boolean success = webdavResource.aclMethod(path,aces);

        if (!success)
            out.println(webdavResource.getStatusMessage());

        if (debugLevel>5) {
            acl = webdavResource.aclfindMethod(path);
            if (acl==null)
                out.println("Error: PropFind didn't return an AclProperty!");
            else
            {
                aces=acl.getAces();
                out.println();
                out.println("ACL from server after update");
                showAces(path, aces);
            }
        }
View Full Code Here

    void acl(String path)
    {
        try
        {
            AclProperty acl=null;
            if (path!=null) {
                path=checkUri(path);
            }
            else {
                path=webdavResource.getPath();
            }
            acl = webdavResource.aclfindMethod(path);

            if (acl==null)
            {
                out.println("Error: PropFind didn't return an AclProperty!");
                return;
            }
            out.println();
            showAces(path, acl.getAces());
        }
        catch (Exception ex)
        {
            handleException(ex);
        }
View Full Code Here

    }

    private boolean addPermission(WebdavResource webdavResource, QName permission, String path, String principal, boolean negative) throws HttpException, IOException
    {

        AclProperty acl = webdavResource.aclfindMethod(path);
        if (acl==null)
        {
            out.println("Error: PropFind didn't return an AclProperty!");
            return false;
        }
        Ace[] aces=acl.getAces();

        if (aces==null)
            aces=new Ace[0];

        if (debugLevel>5) {
            out.println();
            out.println("ACL from server");
            showAces(path, aces);
        }

        Ace ace=null;
        for (int i=0; i<aces.length && (ace==null); i++)
        {
            if ((aces[i].isNegative()==negative) && !aces[i].isProtected()
                && !aces[i].isInherited() && aces[i].getPrincipal().equals(principal))
            {
                if (debugLevel>5)
                    out.println("found ace");
                ace=aces[i];
            }
        }
        if (ace==null)
        {
            Ace[] oldAces=aces;
            aces=new Ace[oldAces.length+1];
            System.arraycopy(oldAces,0,aces,0,oldAces.length);
            ace=new Ace(principal, negative, false, false,null);
            aces[oldAces.length]=ace;
        }

        Privilege privilege=new Privilege(permission.getNamespaceURI(), permission.getLocalName(), null);
        ace.addPrivilege(privilege);

        if (debugLevel>5) {
            out.println();
            out.println("ACL with updated privileges");
            showAces(path, aces);
        }

        boolean success = webdavResource.aclMethod(path,aces);

        if (!success)
            out.println(webdavResource.getStatusMessage());

        if (debugLevel>5) {
            acl = webdavResource.aclfindMethod(path);
            if (acl==null)
                out.println("Error: PropFind didn't return an AclProperty!");
            else
            {
                aces=acl.getAces();
                out.println();
                out.println("ACL from server after update");
                showAces(path, aces);
            }
        }
View Full Code Here

        return success;
    }

    private boolean removePermission(WebdavResource webdavResource, QName permission, String path, String principal) throws HttpException, IOException
    {
        AclProperty acl = webdavResource.aclfindMethod(path);
        if (acl==null)
        {
            out.println("Error: PropFind didn't return an AclProperty!");
            return false;
        }
        Ace[] aces=acl.getAces();

        if (aces==null)
        {
            out.println("Privilege not found");
            return false;
        }

        if (debugLevel>5) {
            out.println();
            out.println("ACL from server");
            showAces(path, aces);
        }

        boolean found=false;
        Privilege privilege=new Privilege(permission.getNamespaceURI(), permission.getLocalName(), null);
        for (int i=0; i<aces.length; i++)
        {
            if (!aces[i].isProtected() && !aces[i].isInherited() && aces[i].getPrincipal().equals(principal))
            {
                if (debugLevel>5)
                    out.println("found ace");
                boolean removed = aces[i].removePrivilege(privilege);
                found = found || removed;
                if (removed)
                    out.println("Privilege removed");
            }
        }

        if (!found)
        {
            out.println("Privilege not found");
            return false;
        }

        if (debugLevel>5) {
            out.println();
            out.println("ACL with updated privileges");
            showAces(path, aces);
        }

        boolean success = webdavResource.aclMethod(path,aces);

        if (!success)
            out.println(webdavResource.getStatusMessage());

        if (debugLevel>5) {
            acl = webdavResource.aclfindMethod(path);
            if (acl==null)
                out.println("Error: PropFind didn't return an AclProperty!");
            else
            {
                aces=acl.getAces();
                out.println();
                out.println("ACL from server after update");
                showAces(path, aces);
            }
        }
View Full Code Here

    public AclProperty aclfindMethod(String path)
        throws HttpException, IOException {

        setClient();

        AclProperty acl = null;

        Vector properties = new Vector();
        properties.addElement(AclProperty.TAG_NAME);

        // Default depth=0, type=by_name
View Full Code Here

    public AclProperty aclfindMethod(String path)
        throws HttpException, IOException {

        setClient();

        AclProperty acl = null;

        Vector properties = new Vector();
        properties.addElement(AclProperty.TAG_NAME);

        // Default depth=0, type=by_name
View Full Code Here

TOP

Related Classes of org.apache.webdav.lib.properties.AclProperty

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.