Examples of FolderPermission

This class represents access to a portal content/folder or document. A FolderPermission consists of a pathname and a set of actions valid for that pathname.

Pathname is the pathname of the folder or document granted the specified actions. A pathname that ends in "/*" (where "/" is the separator character) indicates all the folders and documents contained in that folder. A pathname that ends with "/-" indicates (recursively) all documents and subfolders contained in that directory. A pathname consisting of the special token "<<ALL FILES>>" matches any folder or document.

@author David Sean Taylor @author Christophe Lombart @version $Id: FolderPermission.java 516448 2007-03-09 16:25:47Z ate $


Examples of org.apache.jetspeed.security.FolderPermission

     */
    protected void destroyUser() throws Exception
    {
        ums.removeUser("anon");

        FolderPermission perm1 = new FolderPermission("/files/test.xml", "edit");
        FolderPermission perm2 = new FolderPermission("/files/subfolder1/*", "view");
        FolderPermission perm3 = new FolderPermission("/files/subfolder2/-", "view");
        pms.removePermission(perm1);
        pms.removePermission(perm2);
        pms.removePermission(perm3);
    }
View Full Code Here

Examples of org.apache.jetspeed.security.FolderPermission

    {
        // check granted folder permissions unless the check is
        // to be skipped due to explicity granted access
        if (!checkParentsOnly)
        {
            FolderPermission permission = new FolderPermission(path, mask);
            AccessController.checkPermission(permission);
        }

        // if not checking node only, recursively check
        // all parent permissions in hierarchy
View Full Code Here

Examples of org.apache.jetspeed.security.FolderPermission

    {
        // check granted folder permissions unless the check is
        // to be skipped due to explicity granted access
        if (!checkParentsOnly)
        {
            FolderPermission permission = new FolderPermission(path, mask);
            AccessController.checkPermission(permission);
        }

        // if not checking node only, recursively check
        // all parent permissions in hierarchy
View Full Code Here

Examples of org.apache.jetspeed.security.FolderPermission

        {
            JSSubject.doAs(loginContext.getSubject(), new PrivilegedAction()
            {
                public Object run()
                {
                    FolderPermission perm1 = new FolderPermission("/files/test.xml", "edit");
                    AccessController.checkPermission(perm1);
                    return null;
                }
            });
        }
        catch (AccessControlException ace)
        {
            assertTrue("did not authorize view permission on the Folder.", false);
        }

        // Should be denied.
        try
        {
            JSSubject.doAs(loginContext.getSubject(), new PrivilegedAction()
            {
                public Object run()
                {
                    FolderPermission perm2 = new FolderPermission("/files/test.xml", "secure");
                    AccessController.checkPermission(perm2);
                    return null;
                }
            });
            assertTrue("did not deny update permission on the folder.", false);
View Full Code Here

Examples of org.apache.jetspeed.security.FolderPermission

        {
            JSSubject.doAs(loginContext.getSubject(), new PrivilegedAction()
            {
                public Object run()
                {
                    FolderPermission perm1 = new FolderPermission("/files/subfolder1/test.xml", "view");
                    AccessController.checkPermission(perm1);
                    return null;
                }
            });
        }
        catch (AccessControlException ace)
        {
            fail("did not authorize view permission on the Folder.");
        }

       
        try
        {
            JSSubject.doAs(loginContext.getSubject(), new PrivilegedAction()
            {
                public Object run()
                {
                    FolderPermission perm1 = new FolderPermission("/files/subfolder1/foo", "view");
                    AccessController.checkPermission(perm1);
                    return null;
                }
            });
        }
        catch (AccessControlException ace)
        {
            fail("did not authorize view permission on the Folder.");
       
       
        try
        {
            JSSubject.doAs(loginContext.getSubject(), new PrivilegedAction()
            {
                public Object run()
                {
                    FolderPermission perm1 = new FolderPermission("/files/subfolder1/foo/anotherdoc.xml", "view");
                    AccessController.checkPermission(perm1);
                    return null;
                }
            });
            fail("Permission error - should not view the document ");
        }
        catch (AccessControlException ace)
        {
            // Correct behavior - not authorise to view the document
        }        
       
        try
        {
            JSSubject.doAs(loginContext.getSubject(), new PrivilegedAction()
            {
                public Object run()
                {
                    FolderPermission perm1 = new FolderPermission("/files/subfolder2/test.xml", "view");
                    AccessController.checkPermission(perm1);
                    return null;
                }
            });
        }
        catch (AccessControlException ace)
        {
            fail("did not authorize view permission on the Folder.");
        }

       
        try
        {
            JSSubject.doAs(loginContext.getSubject(), new PrivilegedAction()
            {
                public Object run()
                {
                    FolderPermission perm1 = new FolderPermission("/files/subfolder2/foo", "view");
                    AccessController.checkPermission(perm1);
                    return null;
                }
            });
        }
        catch (AccessControlException ace)
        {
            fail("did not authorize view permission on the Folder.");
        }
       
        try
        {
            JSSubject.doAs(loginContext.getSubject(), new PrivilegedAction()
            {
                public Object run()
                {
                    FolderPermission perm1 = new FolderPermission("/files/subfolder2/foo/anotherdoc.xml", "view");
                    AccessController.checkPermission(perm1);
                    return null;
                }
            });
        }
View Full Code Here

Examples of org.apache.jetspeed.security.FolderPermission

        {
        }
       
        UserPrincipal user = new UserPrincipalImpl("anon");

        FolderPermission perm1 = new FolderPermission("/files/test.xml", "edit");
        FolderPermission perm2 = new FolderPermission("/files/subfolder1/*", "view");
        FolderPermission perm3 = new FolderPermission("/files/subfolder2/-", "view");
        try
        {
            pms.addPermission(perm1);
            pms.addPermission(perm2);
            pms.addPermission(perm3);
View Full Code Here

Examples of org.apache.jetspeed.security.FolderPermission

     */
    protected void destroyUser() throws Exception
    {
        ums.removeUser("anon");

        FolderPermission perm1 = new FolderPermission("/files/test.xml", "edit");
        FolderPermission perm2 = new FolderPermission("/files/subfolder1/*", "view");
        FolderPermission perm3 = new FolderPermission("/files/subfolder2/-", "view");
        pms.removePermission(perm1);
        pms.removePermission(perm2);
        pms.removePermission(perm3);
    }
View Full Code Here

Examples of org.apache.jetspeed.security.FolderPermission

    {
        // check granted folder permissions unless the check is
        // to be skipped due to explicity granted access
        if (!checkParentsOnly)
        {
            FolderPermission permission = new FolderPermission(path, mask);
            AccessController.checkPermission(permission);
        }

        // if not checking node only, recursively check
        // all parent permissions in hierarchy
View Full Code Here

Examples of org.apache.jetspeed.security.FolderPermission

        {
            Subject.doAs(loginContext.getSubject(), new PrivilegedAction()
            {
                public Object run()
                {
                    FolderPermission perm1 = new FolderPermission("/files/test.xml", "edit");
                    AccessController.checkPermission(perm1);
                    return null;
                }
            });
        }
        catch (AccessControlException ace)
        {
            assertTrue("did not authorize view permission on the Folder.", false);
        }

        // Should be denied.
        try
        {
            Subject.doAs(loginContext.getSubject(), new PrivilegedAction()
            {
                public Object run()
                {
                    FolderPermission perm2 = new FolderPermission("/files/test.xml", "secure");
                    AccessController.checkPermission(perm2);
                    return null;
                }
            });
            assertTrue("did not deny update permission on the folder.", false);
View Full Code Here

Examples of org.apache.jetspeed.security.FolderPermission

        {
            Subject.doAs(loginContext.getSubject(), new PrivilegedAction()
            {
                public Object run()
                {
                    FolderPermission perm1 = new FolderPermission("/files/subfolder1/test.xml", "view");
                    AccessController.checkPermission(perm1);
                    return null;
                }
            });
        }
        catch (AccessControlException ace)
        {
            fail("did not authorize view permission on the Folder.");
        }

       
        try
        {
            Subject.doAs(loginContext.getSubject(), new PrivilegedAction()
            {
                public Object run()
                {
                    FolderPermission perm1 = new FolderPermission("/files/subfolder1/foo", "view");
                    AccessController.checkPermission(perm1);
                    return null;
                }
            });
        }
        catch (AccessControlException ace)
        {
            fail("did not authorize view permission on the Folder.");
       
       
        try
        {
            Subject.doAs(loginContext.getSubject(), new PrivilegedAction()
            {
                public Object run()
                {
                    FolderPermission perm1 = new FolderPermission("/files/subfolder1/foo/anotherdoc.xml", "view");
                    AccessController.checkPermission(perm1);
                    return null;
                }
            });
            fail("Permission error - should not view the document ");
        }
        catch (AccessControlException ace)
        {
            // Correct behavior - not authorise to view the document
        }        
       
        try
        {
            Subject.doAs(loginContext.getSubject(), new PrivilegedAction()
            {
                public Object run()
                {
                    FolderPermission perm1 = new FolderPermission("/files/subfolder2/test.xml", "view");
                    AccessController.checkPermission(perm1);
                    return null;
                }
            });
        }
        catch (AccessControlException ace)
        {
            fail("did not authorize view permission on the Folder.");
        }

       
        try
        {
            Subject.doAs(loginContext.getSubject(), new PrivilegedAction()
            {
                public Object run()
                {
                    FolderPermission perm1 = new FolderPermission("/files/subfolder2/foo", "view");
                    AccessController.checkPermission(perm1);
                    return null;
                }
            });
        }
        catch (AccessControlException ace)
        {
            fail("did not authorize view permission on the Folder.");
        }
       
        try
        {
            Subject.doAs(loginContext.getSubject(), new PrivilegedAction()
            {
                public Object run()
                {
                    FolderPermission perm1 = new FolderPermission("/files/subfolder2/foo/anotherdoc.xml", "view");
                    AccessController.checkPermission(perm1);
                    return null;
                }
            });
        }
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.