Package org.apache.jetspeed.om.page

Examples of org.apache.jetspeed.om.page.PageSecurity


     */
    public boolean checkConstraint(String securityConstraintName, String actions)
    {
        try
        {
            PageSecurity security = this.getPageSecurity();
            SecurityConstraintsDef def = security.getSecurityConstraintsDef(securityConstraintName);
            if (def != null)
            {
                return PageManagerSecurityUtils.checkConstraint(def, actions);
            }           
        }
View Full Code Here


        try
        {
            Criteria filter = new Criteria();
            filter.addEqualTo("path", path);
            QueryByCriteria query = QueryFactory.newQuery(PageSecurityImpl.class, filter);
            PageSecurity document = (PageSecurity)getPersistenceBrokerTemplate().getObjectByQuery(query);
           
            // return page or throw exception
            if (document == null)
            {
                throw new DocumentNotFoundException("Document " + path + " not found.");
            }

            // check for view access on document
            document.checkAccess(JetspeedActions.VIEW);

            return document;
        }
        catch (DocumentNotFoundException dnfe)
        {
View Full Code Here

            {
                // query for page security
                Criteria filter = new Criteria();
                filter.addEqualTo("parent", folderImpl.getId());
                QueryByCriteria query = QueryFactory.newQuery(PageSecurityImpl.class, filter);
                PageSecurity document = (PageSecurity)getPersistenceBrokerTemplate().getObjectByQuery(query);

                // cache page security in folder
                folderImpl.resetPageSecurity((PageSecurityImpl)document, true);
            }
            catch (Exception e)
View Full Code Here

            if (links != null)
            {
                all.addAll(links);
            }
            query = QueryFactory.newQuery(PageSecurityImpl.class, filter);
            PageSecurity document = (PageSecurity)getPersistenceBrokerTemplate().getObjectByQuery(query);
            if (document != null)
            {
                all.add(document);
            }
View Full Code Here

                }
            }

            // update page security
            query = QueryFactory.newQuery(PageSecurityImpl.class, filter);
            PageSecurity document = (PageSecurity)getPersistenceBrokerTemplate().getObjectByQuery(query);
            if (document != null)
            {
                updatePageSecurity(document);
            }
View Full Code Here

                }
            }

            // remove page security
            query = QueryFactory.newQuery(PageSecurityImpl.class, filter);
            PageSecurity document = (PageSecurity)getPersistenceBrokerTemplate().getObjectByQuery(query);
            if (document != null)
            {
                removePageSecurity(document);
            }
        }
View Full Code Here

        if (name == null)
            throw new AJAXException("Missing 'name' parameter");
       
        try
        {
            PageSecurity pageSecurity = pageManager.getPageSecurity();       
            SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(name);
            if (def == null)
            {
                return 0;
            }
            List defs = pageSecurity.getSecurityConstraintsDefs();
            defs.remove(def);
            pageSecurity.setSecurityConstraintsDefs(defs);
            pageManager.updatePageSecurity(pageSecurity);
        }
        catch (Exception e)
        {
            throw new AJAXException(e);
View Full Code Here

            SAXBuilder saxBuilder = new SAXBuilder();
            StringReader reader = new StringReader(xml);
            Document document = saxBuilder.build(reader);
            Element root = document.getRootElement();
            String name = root.getAttribute("name").getValue();
            PageSecurity pageSecurity = pageManager.getPageSecurity();
            SecurityConstraintsDef def = pageSecurity.getSecurityConstraintsDef(name);
            int defsSize = 0;
            if (def == null)
            {
                def = pageManager.newSecurityConstraintsDef();
                def.setName(name);
                added = true;
            }
            int xmlSize = root.getChildren("security-constraint").size();
            if (added == false)
            {
                defsSize = def.getSecurityConstraints().size();
            }
            int min = (xmlSize < defsSize) ? xmlSize : defsSize;
            List xmlConstraints = root.getChildren("security-constraint");
            List constraints = def.getSecurityConstraints();
            Element owner = root.getChild("owner");
            if (owner != null)
            {
            }
            for (int ix = 0; ix < min; ix++)
            {
                Element xmlConstraint = (Element)xmlConstraints.get(ix);
                SecurityConstraint constraint =  (SecurityConstraint)constraints.get(ix);               
                updateConstraintValues(xmlConstraint, constraint);
                count++;               
            }
            if (xmlSize < defsSize)
            {
                // remove constraints
                List deletes = new ArrayList(defsSize - xmlSize);
                for (int ix = min; ix < defsSize; ix++)
                {
                    deletes.add(constraints.get(ix));
                }
                for (int ix = 0; ix < deletes.size(); ix++)
                {
                    constraints.remove(deletes.get(ix));
                    count++;                   
                }               
            }
            else if (xmlSize > defsSize)
            {
                // add new constraints
                for (int ix = min; ix < xmlSize; ix++)
                {
                    Element xmlConstraint = (Element)xmlConstraints.get(ix);
                    SecurityConstraint constraint =  pageManager.newPageSecuritySecurityConstraint();                   
                    updateConstraintValues(xmlConstraint, constraint);
                    constraints.add(constraint);                   
                    count++;
                }               
            }
            if (added)
            {               
                pageSecurity.getSecurityConstraintsDefs().add(def);
                pageSecurity.setSecurityConstraintsDefs(pageSecurity.getSecurityConstraintsDefs());
            }
            pageManager.updatePageSecurity(pageSecurity);
        }
        catch (Exception e)
        {
View Full Code Here

        if (name == null)
            throw new AJAXException("Missing 'name' parameter");
       
        try
        {
            PageSecurity pageSecurity = pageManager.getPageSecurity();       
            List globals = pageSecurity.getGlobalSecurityConstraintsRefs();
            if (!globals.contains(name))
            {
                return 0;
            }
            globals.remove(name);
            pageSecurity.setGlobalSecurityConstraintsRefs(globals);
            pageManager.updatePageSecurity(pageSecurity);
            count++;
        }
        catch (Exception e)
        {
View Full Code Here

        if (name == null)
            throw new AJAXException("Missing 'name' parameter");
       
        try
        {
            PageSecurity pageSecurity = pageManager.getPageSecurity();       
            List globals = pageSecurity.getGlobalSecurityConstraintsRefs();
            if (pageSecurity.getSecurityConstraintsDef(name) == null)
            {
                throw new AJAXException("global name doesnt exist in definitions");
            }
            if (globals.contains(name))
            {
                // already exist;
                return count;
            }
            globals.add(name);
            pageSecurity.setGlobalSecurityConstraintsRefs(globals);
            pageManager.updatePageSecurity(pageSecurity);
            count++;
        }
        catch (Exception e)
        {
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.page.PageSecurity

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.