/** * Retrieve a Caldav Principal from a jackrabbit-webdav Ace. * If ace.getprincipal is set to "property", it returns directly the underlying property * @param ace Ace to retrieve the Principal from. * @return CalDav Principal associated with the Ace. */ public static Principal getDavPrincipal(AclProperty.Ace ace) { return ace.getPrincipal(); } }
public static Ace createGrantAce(Principal principal, Privilege[] privileges, boolean invert, boolean isProtected, AclResource inheritedFrom) { Ace ace = new Ace(principal, invert, privileges, true, isProtected, inheritedFrom); return ace; }
/** * Private constructor * * @param principal * @param invert * @param privileges * @param grant * @param isProtected * @param inherited */ private Ace(Principal principal, boolean invert, Privilege[] privileges, boolean grant, boolean isProtected, AclResource inherited) { this(principal, invert, privileges, grant, isProtected, ((inherited != null) ? inherited.getHref() : null)); }
private static void fillSupportedPrivilegeMap(List<SupportedPrivilege> sps, Map<Name, SupportedPrivilege> spMap, NameFactory nameFactory) throws NamespaceException, IllegalNameException { for (SupportedPrivilege sp : sps) { Privilege p = sp.getPrivilege(); Name privName = nameFactory.create(p.getNamespace().getURI(), p.getName()); spMap.put(privName, sp); List<SupportedPrivilege> agg = Arrays.asList(sp.getSupportedPrivileges()); if (!agg.isEmpty()) { fillSupportedPrivilegeMap(agg, spMap, nameFactory); } } }
/** * @see XmlSerializable#toXml(Document) */ public Element toXml(Document document) { Element spElem = DomUtil.createElement(document, XML_SUPPORTED_PRIVILEGE, SecurityConstants.NAMESPACE); spElem.appendChild(privilege.toXml(document)); if (isAbstract) { DomUtil.addChildElement(spElem, XML_ABSTRACT, SecurityConstants.NAMESPACE); } if (description != null) { Element desc = DomUtil.addChildElement(spElem, XML_DESCRIPTION, SecurityConstants.NAMESPACE, description); if (descriptionLanguage != null) { DomUtil.setAttribute(desc, "lang", Namespace.XML_NAMESPACE, descriptionLanguage); } } if (supportedPrivileges != null) { for (SupportedPrivilege supportedPrivilege : supportedPrivileges) { spElem.appendChild(supportedPrivilege.toXml(document)); } } return spElem; }
/** * @see DavProperty#toXml(Document) */ public Element toXml(Document document) { Element elem = getName().toXml(document); if (grantOnly) { DomUtil.addChildElement(elem, XML_GRANT_ONLY, SecurityConstants.NAMESPACE); } if (noInvert) { DomUtil.addChildElement(elem, XML_NO_INVERT, SecurityConstants.NAMESPACE); } if (denyBeforeGrant) { DomUtil.addChildElement(elem, XML_DENY_BEFORE_GRANT, SecurityConstants.NAMESPACE); } if (requiredPrincipal != null) { elem.appendChild(requiredPrincipal.toXml(document)); } return elem; }
/** * @see XmlSerializable#toXml(Document) */ public Element toXml(Document document) { Element ace = DomUtil.createElement(document, XML_ACE, SecurityConstants.NAMESPACE); if (invert) { Element inv = DomUtil.addChildElement(ace, XML_INVERT, SecurityConstants.NAMESPACE); inv.appendChild(principal.toXml(document)); } else { ace.appendChild(principal.toXml(document)); } Element gd = DomUtil.addChildElement(ace, ((grant) ? XML_GRANT : XML_DENY), SecurityConstants.NAMESPACE); for (int i = 0; i < privileges.length; i++) { gd.appendChild(privileges[i].toXml(document)); } if (isProtected) { DomUtil.addChildElement(ace, XML_PROTECTED, SecurityConstants.NAMESPACE); } if (inheritedHref != null) { Element inh = DomUtil.addChildElement(ace, XML_INHERITED, SecurityConstants.NAMESPACE); inh.appendChild(DomUtil.hrefToXml(inheritedHref, document)); } return ace; }
public static Principal getHrefPrincipal(String href) { if (href == null) { throw new IllegalArgumentException("Href-Principal must contain a valid href."); } return new Principal(href); }
/** * @see XmlSerializable#toXml(Document) */ public Element toXml(Document document) { Element spElem = DomUtil.createElement(document, XML_SUPPORTED_PRIVILEGE, SecurityConstants.NAMESPACE); spElem.appendChild(privilege.toXml(document)); if (isAbstract) { DomUtil.addChildElement(spElem, XML_ABSTRACT, SecurityConstants.NAMESPACE); } if (description != null) { Element desc = DomUtil.addChildElement(spElem, XML_DESCRIPTION, SecurityConstants.NAMESPACE, description); if (descriptionLanguage != null) { DomUtil.setAttribute(desc, "lang", Namespace.XML_NAMESPACE, descriptionLanguage); } } if (supportedPrivileges != null) { for (int i = 0; i < supportedPrivileges.length; i++) { spElem.appendChild(supportedPrivileges[i].toXml(document)); } } return spElem; } }
/** * @see DavProperty#toXml(Document) */ @Override public Element toXml(Document document) { Element elem = getName().toXml(document); if (grantOnly) { DomUtil.addChildElement(elem, XML_GRANT_ONLY, SecurityConstants.NAMESPACE); } if (noInvert) { DomUtil.addChildElement(elem, XML_NO_INVERT, SecurityConstants.NAMESPACE); } if (denyBeforeGrant) { DomUtil.addChildElement(elem, XML_DENY_BEFORE_GRANT, SecurityConstants.NAMESPACE); } if (requiredPrincipal != null) { elem.appendChild(requiredPrincipal.toXml(document)); } return elem; }
/** * @see XmlSerializable#toXml(Document) */ public Element toXml(Document document) { Element ace = DomUtil.createElement(document, XML_ACE, SecurityConstants.NAMESPACE); if (invert) { Element inv = DomUtil.addChildElement(ace, XML_INVERT, SecurityConstants.NAMESPACE); inv.appendChild(principal.toXml(document)); } else { ace.appendChild(principal.toXml(document)); } Element gd = DomUtil.addChildElement(ace, ((grant) ? XML_GRANT : XML_DENY), SecurityConstants.NAMESPACE); for (Privilege privilege : privileges) { gd.appendChild(privilege.toXml(document)); } if (isProtected) { DomUtil.addChildElement(ace, XML_PROTECTED, SecurityConstants.NAMESPACE); } if (inheritedHref != null) { Element inh = DomUtil.addChildElement(ace, XML_INHERITED, SecurityConstants.NAMESPACE); inh.appendChild(DomUtil.hrefToXml(inheritedHref, document)); } return ace; }
public static Ace createGrantAce(Principal principal, Privilege[] privileges, boolean invert, boolean isProtected, AclResource inheritedFrom) { return new Ace(principal, invert, privileges, true, isProtected, inheritedFrom); }
/** * Private constructor * * @param principal * @param invert * @param privileges * @param grant * @param isProtected * @param inherited */ private Ace(Principal principal, boolean invert, Privilege[] privileges, boolean grant, boolean isProtected, AclResource inherited) { this(principal, invert, privileges, grant, isProtected, ((inherited != null) ? inherited.getHref() : null)); }
public static Principal getHrefPrincipal(String href) { if (href == null) { throw new IllegalArgumentException("Href-Principal must contain a valid href."); } return new Principal(href); }
public static Ace createGrantAce(Principal principal, Privilege[] privileges, boolean invert, boolean isProtected, AclResource inheritedFrom) { return new Ace(principal, invert, privileges, true, isProtected, inheritedFrom); }
/** * Private constructor * * @param principal * @param invert * @param privileges * @param grant * @param isProtected * @param inherited */ private Ace(Principal principal, boolean invert, Privilege[] privileges, boolean grant, boolean isProtected, AclResource inherited) { this(principal, invert, privileges, grant, isProtected, ((inherited != null) ? inherited.getHref() : null)); }
public static Principal getHrefPrincipal(String href) { if (href == null) { throw new IllegalArgumentException("Href-Principal must contain a valid href."); } return new Principal(href); }
public static Ace createDenyAce(Principal principal, Privilege[] privileges, boolean invert, boolean isProtected, AclResource inheritedFrom) { Ace ace = new Ace(principal, invert, privileges, false, isProtected, inheritedFrom); return ace; }
public static Ace createDenyAce(Principal principal, Privilege[] privileges, boolean invert, boolean isProtected, AclResource inheritedFrom) { return new Ace(principal, invert, privileges, false, isProtected, inheritedFrom); }
public static Ace createDenyAce(Principal principal, Privilege[] privileges, boolean invert, boolean isProtected, AclResource inheritedFrom) { return new Ace(principal, invert, privileges, false, isProtected, inheritedFrom); }