mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-07 08:58:49 +00:00
Initial Release of the calendar plugin
This commit is contained in:
parent
45cc9885fc
commit
7115197a33
561 changed files with 189494 additions and 0 deletions
154
dav/SabreDAV/lib/Sabre/DAVACL/AbstractPrincipalCollection.php
Normal file
154
dav/SabreDAV/lib/Sabre/DAVACL/AbstractPrincipalCollection.php
Normal file
|
@ -0,0 +1,154 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Principals Collection
|
||||
*
|
||||
* This is a helper class that easily allows you to create a collection that
|
||||
* has a childnode for every principal.
|
||||
*
|
||||
* To use this class, simply implement the getChildForPrincipal method.
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAVACL
|
||||
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
abstract class Sabre_DAVACL_AbstractPrincipalCollection extends Sabre_DAV_Collection {
|
||||
|
||||
/**
|
||||
* Node or 'directory' name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $path;
|
||||
|
||||
/**
|
||||
* Principal backend
|
||||
*
|
||||
* @var Sabre_DAVACL_IPrincipalBackend
|
||||
*/
|
||||
protected $principalBackend;
|
||||
|
||||
/**
|
||||
* If this value is set to true, it effectively disables listing of users
|
||||
* it still allows user to find other users if they have an exact url.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
public $disableListing = false;
|
||||
|
||||
/**
|
||||
* Creates the object
|
||||
*
|
||||
* This object must be passed the principal backend. This object will
|
||||
* filter all principals from a specified prefix ($principalPrefix). The
|
||||
* default is 'principals', if your principals are stored in a different
|
||||
* collection, override $principalPrefix
|
||||
*
|
||||
*
|
||||
* @param Sabre_DAVACL_IPrincipalBackend $principalBackend
|
||||
* @param string $principalPrefix
|
||||
*/
|
||||
public function __construct(Sabre_DAVACL_IPrincipalBackend $principalBackend, $principalPrefix = 'principals') {
|
||||
|
||||
$this->principalPrefix = $principalPrefix;
|
||||
$this->principalBackend = $principalBackend;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns a node for a principal.
|
||||
*
|
||||
* The passed array contains principal information, and is guaranteed to
|
||||
* at least contain a uri item. Other properties may or may not be
|
||||
* supplied by the authentication backend.
|
||||
*
|
||||
* @param array $principalInfo
|
||||
* @return Sabre_DAVACL_IPrincipal
|
||||
*/
|
||||
abstract function getChildForPrincipal(array $principalInfo);
|
||||
|
||||
/**
|
||||
* Returns the name of this collection.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName() {
|
||||
|
||||
list(,$name) = Sabre_DAV_URLUtil::splitPath($this->principalPrefix);
|
||||
return $name;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of users
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getChildren() {
|
||||
|
||||
if ($this->disableListing)
|
||||
throw new Sabre_DAV_Exception_MethodNotAllowed('Listing members of this collection is disabled');
|
||||
|
||||
$children = array();
|
||||
foreach($this->principalBackend->getPrincipalsByPrefix($this->principalPrefix) as $principalInfo) {
|
||||
|
||||
$children[] = $this->getChildForPrincipal($principalInfo);
|
||||
|
||||
|
||||
}
|
||||
return $children;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a child object, by its name.
|
||||
*
|
||||
* @param string $name
|
||||
* @throws Sabre_DAV_Exception_NotFound
|
||||
* @return Sabre_DAVACL_IPrincipal
|
||||
*/
|
||||
public function getChild($name) {
|
||||
|
||||
$principalInfo = $this->principalBackend->getPrincipalByPath($this->principalPrefix . '/' . $name);
|
||||
if (!$principalInfo) throw new Sabre_DAV_Exception_NotFound('Principal with name ' . $name . ' not found');
|
||||
return $this->getChildForPrincipal($principalInfo);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to search for principals matching a set of
|
||||
* properties.
|
||||
*
|
||||
* This search is specifically used by RFC3744's principal-property-search
|
||||
* REPORT. You should at least allow searching on
|
||||
* http://sabredav.org/ns}email-address.
|
||||
*
|
||||
* The actual search should be a unicode-non-case-sensitive search. The
|
||||
* keys in searchProperties are the WebDAV property names, while the values
|
||||
* are the property values to search on.
|
||||
*
|
||||
* If multiple properties are being searched on, the search should be
|
||||
* AND'ed.
|
||||
*
|
||||
* This method should simply return a list of 'child names', which may be
|
||||
* used to call $this->getChild in the future.
|
||||
*
|
||||
* @param array $searchProperties
|
||||
* @return array
|
||||
*/
|
||||
public function searchPrincipals(array $searchProperties) {
|
||||
|
||||
$result = $this->principalBackend->searchPrincipals($this->principalPrefix, $searchProperties);
|
||||
$r = array();
|
||||
|
||||
foreach($result as $row) {
|
||||
list(, $r[]) = Sabre_DAV_URLUtil::splitPath($row);
|
||||
}
|
||||
|
||||
return $r;
|
||||
|
||||
}
|
||||
|
||||
}
|
32
dav/SabreDAV/lib/Sabre/DAVACL/Exception/AceConflict.php
Normal file
32
dav/SabreDAV/lib/Sabre/DAVACL/Exception/AceConflict.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Sabre_DAVACL_Exception_AceConflict
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAVACL
|
||||
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Sabre_DAVACL_Exception_AceConflict extends Sabre_DAV_Exception_Conflict {
|
||||
|
||||
/**
|
||||
* Adds in extra information in the xml response.
|
||||
*
|
||||
* This method adds the {DAV:}no-ace-conflict element as defined in rfc3744
|
||||
*
|
||||
* @param Sabre_DAV_Server $server
|
||||
* @param DOMElement $errorNode
|
||||
* @return void
|
||||
*/
|
||||
public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
|
||||
|
||||
$doc = $errorNode->ownerDocument;
|
||||
|
||||
$np = $doc->createElementNS('DAV:','d:no-ace-conflict');
|
||||
$errorNode->appendChild($np);
|
||||
|
||||
}
|
||||
|
||||
}
|
81
dav/SabreDAV/lib/Sabre/DAVACL/Exception/NeedPrivileges.php
Normal file
81
dav/SabreDAV/lib/Sabre/DAVACL/Exception/NeedPrivileges.php
Normal file
|
@ -0,0 +1,81 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* NeedPrivileges
|
||||
*
|
||||
* The 403-need privileges is thrown when a user didn't have the appropriate
|
||||
* permissions to perform an operation
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAVACL
|
||||
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Sabre_DAVACL_Exception_NeedPrivileges extends Sabre_DAV_Exception_Forbidden {
|
||||
|
||||
/**
|
||||
* The relevant uri
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $uri;
|
||||
|
||||
/**
|
||||
* The privileges the user didn't have.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $privileges;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $uri
|
||||
* @param array $privileges
|
||||
*/
|
||||
public function __construct($uri,array $privileges) {
|
||||
|
||||
$this->uri = $uri;
|
||||
$this->privileges = $privileges;
|
||||
|
||||
parent::__construct('User did not have the required privileges (' . implode(',', $privileges) . ') for path "' . $uri . '"');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds in extra information in the xml response.
|
||||
*
|
||||
* This method adds the {DAV:}need-privileges element as defined in rfc3744
|
||||
*
|
||||
* @param Sabre_DAV_Server $server
|
||||
* @param DOMElement $errorNode
|
||||
* @return void
|
||||
*/
|
||||
public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
|
||||
|
||||
$doc = $errorNode->ownerDocument;
|
||||
|
||||
$np = $doc->createElementNS('DAV:','d:need-privileges');
|
||||
$errorNode->appendChild($np);
|
||||
|
||||
foreach($this->privileges as $privilege) {
|
||||
|
||||
$resource = $doc->createElementNS('DAV:','d:resource');
|
||||
$np->appendChild($resource);
|
||||
|
||||
$resource->appendChild($doc->createElementNS('DAV:','d:href',$server->getBaseUri() . $this->uri));
|
||||
|
||||
$priv = $doc->createElementNS('DAV:','d:privilege');
|
||||
$resource->appendChild($priv);
|
||||
|
||||
preg_match('/^{([^}]*)}(.*)$/',$privilege,$privilegeParts);
|
||||
$priv->appendChild($doc->createElementNS($privilegeParts[1],'d:' . $privilegeParts[2]));
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
32
dav/SabreDAV/lib/Sabre/DAVACL/Exception/NoAbstract.php
Normal file
32
dav/SabreDAV/lib/Sabre/DAVACL/Exception/NoAbstract.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Sabre_DAVACL_Exception_NoAbstract
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAVACL
|
||||
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Sabre_DAVACL_Exception_NoAbstract extends Sabre_DAV_Exception_PreconditionFailed {
|
||||
|
||||
/**
|
||||
* Adds in extra information in the xml response.
|
||||
*
|
||||
* This method adds the {DAV:}no-abstract element as defined in rfc3744
|
||||
*
|
||||
* @param Sabre_DAV_Server $server
|
||||
* @param DOMElement $errorNode
|
||||
* @return void
|
||||
*/
|
||||
public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
|
||||
|
||||
$doc = $errorNode->ownerDocument;
|
||||
|
||||
$np = $doc->createElementNS('DAV:','d:no-abstract');
|
||||
$errorNode->appendChild($np);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Sabre_DAVACL_Exception_NotRecognizedPrincipal
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAVACL
|
||||
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Sabre_DAVACL_Exception_NotRecognizedPrincipal extends Sabre_DAV_Exception_PreconditionFailed {
|
||||
|
||||
/**
|
||||
* Adds in extra information in the xml response.
|
||||
*
|
||||
* This method adds the {DAV:}recognized-principal element as defined in rfc3744
|
||||
*
|
||||
* @param Sabre_DAV_Server $server
|
||||
* @param DOMElement $errorNode
|
||||
* @return void
|
||||
*/
|
||||
public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
|
||||
|
||||
$doc = $errorNode->ownerDocument;
|
||||
|
||||
$np = $doc->createElementNS('DAV:','d:recognized-principal');
|
||||
$errorNode->appendChild($np);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Sabre_DAVACL_Exception_NotSupportedPrivilege
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAVACL
|
||||
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Sabre_DAVACL_Exception_NotSupportedPrivilege extends Sabre_DAV_Exception_PreconditionFailed {
|
||||
|
||||
/**
|
||||
* Adds in extra information in the xml response.
|
||||
*
|
||||
* This method adds the {DAV:}not-supported-privilege element as defined in rfc3744
|
||||
*
|
||||
* @param Sabre_DAV_Server $server
|
||||
* @param DOMElement $errorNode
|
||||
* @return void
|
||||
*/
|
||||
public function serialize(Sabre_DAV_Server $server,DOMElement $errorNode) {
|
||||
|
||||
$doc = $errorNode->ownerDocument;
|
||||
|
||||
$np = $doc->createElementNS('DAV:','d:not-supported-privilege');
|
||||
$errorNode->appendChild($np);
|
||||
|
||||
}
|
||||
|
||||
}
|
73
dav/SabreDAV/lib/Sabre/DAVACL/IACL.php
Normal file
73
dav/SabreDAV/lib/Sabre/DAVACL/IACL.php
Normal file
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* ACL-enabled node
|
||||
*
|
||||
* If you want to add WebDAV ACL to a node, you must implement this class
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAVACL
|
||||
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
interface Sabre_DAVACL_IACL extends Sabre_DAV_INode {
|
||||
|
||||
/**
|
||||
* Returns the owner principal
|
||||
*
|
||||
* This must be a url to a principal, or null if there's no owner
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
function getOwner();
|
||||
|
||||
/**
|
||||
* Returns a group principal
|
||||
*
|
||||
* This must be a url to a principal, or null if there's no owner
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
function getGroup();
|
||||
|
||||
/**
|
||||
* Returns a list of ACE's for this node.
|
||||
*
|
||||
* Each ACE has the following properties:
|
||||
* * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
|
||||
* currently the only supported privileges
|
||||
* * 'principal', a url to the principal who owns the node
|
||||
* * 'protected' (optional), indicating that this ACE is not allowed to
|
||||
* be updated.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getACL();
|
||||
|
||||
/**
|
||||
* Updates the ACL
|
||||
*
|
||||
* This method will receive a list of new ACE's as an array argument.
|
||||
*
|
||||
* @param array $acl
|
||||
* @return void
|
||||
*/
|
||||
function setACL(array $acl);
|
||||
|
||||
/**
|
||||
* Returns the list of supported privileges for this node.
|
||||
*
|
||||
* The returned data structure is a list of nested privileges.
|
||||
* See Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet for a simple
|
||||
* standard structure.
|
||||
*
|
||||
* If null is returned from this method, the default privilege set is used,
|
||||
* which is fine for most common usecases.
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
function getSupportedPrivilegeSet();
|
||||
|
||||
|
||||
}
|
75
dav/SabreDAV/lib/Sabre/DAVACL/IPrincipal.php
Normal file
75
dav/SabreDAV/lib/Sabre/DAVACL/IPrincipal.php
Normal file
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* IPrincipal interface
|
||||
*
|
||||
* Implement this interface to define your own principals
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAVACL
|
||||
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
interface Sabre_DAVACL_IPrincipal extends Sabre_DAV_INode {
|
||||
|
||||
/**
|
||||
* Returns a list of alternative urls for a principal
|
||||
*
|
||||
* This can for example be an email address, or ldap url.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getAlternateUriSet();
|
||||
|
||||
/**
|
||||
* Returns the full principal url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getPrincipalUrl();
|
||||
|
||||
/**
|
||||
* Returns the list of group members
|
||||
*
|
||||
* If this principal is a group, this function should return
|
||||
* all member principal uri's for the group.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getGroupMemberSet();
|
||||
|
||||
/**
|
||||
* Returns the list of groups this principal is member of
|
||||
*
|
||||
* If this principal is a member of a (list of) groups, this function
|
||||
* should return a list of principal uri's for it's members.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
function getGroupMembership();
|
||||
|
||||
/**
|
||||
* Sets a list of group members
|
||||
*
|
||||
* If this principal is a group, this method sets all the group members.
|
||||
* The list of members is always overwritten, never appended to.
|
||||
*
|
||||
* This method should throw an exception if the members could not be set.
|
||||
*
|
||||
* @param array $principals
|
||||
* @return void
|
||||
*/
|
||||
function setGroupMemberSet(array $principals);
|
||||
|
||||
/**
|
||||
* Returns the displayname
|
||||
*
|
||||
* This should be a human readable name for the principal.
|
||||
* If none is available, return the nodename.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getDisplayName();
|
||||
|
||||
}
|
153
dav/SabreDAV/lib/Sabre/DAVACL/IPrincipalBackend.php
Normal file
153
dav/SabreDAV/lib/Sabre/DAVACL/IPrincipalBackend.php
Normal file
|
@ -0,0 +1,153 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Implement this interface to create your own principal backends.
|
||||
*
|
||||
* Creating backends for principals is entirely optional. You can also
|
||||
* implement Sabre_DAVACL_IPrincipal directly. This interface is used solely by
|
||||
* Sabre_DAVACL_AbstractPrincipalCollection.
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAVACL
|
||||
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
interface Sabre_DAVACL_IPrincipalBackend {
|
||||
|
||||
/**
|
||||
* Returns a list of principals based on a prefix.
|
||||
*
|
||||
* This prefix will often contain something like 'principals'. You are only
|
||||
* expected to return principals that are in this base path.
|
||||
*
|
||||
* You are expected to return at least a 'uri' for every user, you can
|
||||
* return any additional properties if you wish so. Common properties are:
|
||||
* {DAV:}displayname
|
||||
* {http://sabredav.org/ns}email-address - This is a custom SabreDAV
|
||||
* field that's actually injected in a number of other properties. If
|
||||
* you have an email address, use this property.
|
||||
*
|
||||
* @param string $prefixPath
|
||||
* @return array
|
||||
*/
|
||||
function getPrincipalsByPrefix($prefixPath);
|
||||
|
||||
/**
|
||||
* Returns a specific principal, specified by it's path.
|
||||
* The returned structure should be the exact same as from
|
||||
* getPrincipalsByPrefix.
|
||||
*
|
||||
* @param string $path
|
||||
* @return array
|
||||
*/
|
||||
function getPrincipalByPath($path);
|
||||
|
||||
/**
|
||||
* Updates one ore more webdav properties on a principal.
|
||||
*
|
||||
* The list of mutations is supplied as an array. Each key in the array is
|
||||
* a propertyname, such as {DAV:}displayname.
|
||||
*
|
||||
* Each value is the actual value to be updated. If a value is null, it
|
||||
* must be deleted.
|
||||
*
|
||||
* This method should be atomic. It must either completely succeed, or
|
||||
* completely fail. Success and failure can simply be returned as 'true' or
|
||||
* 'false'.
|
||||
*
|
||||
* It is also possible to return detailed failure information. In that case
|
||||
* an array such as this should be returned:
|
||||
*
|
||||
* array(
|
||||
* 200 => array(
|
||||
* '{DAV:}prop1' => null,
|
||||
* ),
|
||||
* 201 => array(
|
||||
* '{DAV:}prop2' => null,
|
||||
* ),
|
||||
* 403 => array(
|
||||
* '{DAV:}prop3' => null,
|
||||
* ),
|
||||
* 424 => array(
|
||||
* '{DAV:}prop4' => null,
|
||||
* ),
|
||||
* );
|
||||
*
|
||||
* In this previous example prop1 was successfully updated or deleted, and
|
||||
* prop2 was succesfully created.
|
||||
*
|
||||
* prop3 failed to update due to '403 Forbidden' and because of this prop4
|
||||
* also could not be updated with '424 Failed dependency'.
|
||||
*
|
||||
* This last example was actually incorrect. While 200 and 201 could appear
|
||||
* in 1 response, if there's any error (403) the other properties should
|
||||
* always fail with 423 (failed dependency).
|
||||
*
|
||||
* But anyway, if you don't want to scratch your head over this, just
|
||||
* return true or false.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $mutations
|
||||
* @return array|bool
|
||||
*/
|
||||
function updatePrincipal($path, $mutations);
|
||||
|
||||
/**
|
||||
* This method is used to search for principals matching a set of
|
||||
* properties.
|
||||
*
|
||||
* This search is specifically used by RFC3744's principal-property-search
|
||||
* REPORT. You should at least allow searching on
|
||||
* http://sabredav.org/ns}email-address.
|
||||
*
|
||||
* The actual search should be a unicode-non-case-sensitive search. The
|
||||
* keys in searchProperties are the WebDAV property names, while the values
|
||||
* are the property values to search on.
|
||||
*
|
||||
* If multiple properties are being searched on, the search should be
|
||||
* AND'ed.
|
||||
*
|
||||
* This method should simply return an array with full principal uri's.
|
||||
*
|
||||
* If somebody attempted to search on a property the backend does not
|
||||
* support, you should simply return 0 results.
|
||||
*
|
||||
* You can also just return 0 results if you choose to not support
|
||||
* searching at all, but keep in mind that this may stop certain features
|
||||
* from working.
|
||||
*
|
||||
* @param string $prefixPath
|
||||
* @param array $searchProperties
|
||||
* @return array
|
||||
*/
|
||||
function searchPrincipals($prefixPath, array $searchProperties);
|
||||
|
||||
/**
|
||||
* Returns the list of members for a group-principal
|
||||
*
|
||||
* @param string $principal
|
||||
* @return array
|
||||
*/
|
||||
function getGroupMemberSet($principal);
|
||||
|
||||
/**
|
||||
* Returns the list of groups a principal is a member of
|
||||
*
|
||||
* @param string $principal
|
||||
* @return array
|
||||
*/
|
||||
function getGroupMembership($principal);
|
||||
|
||||
/**
|
||||
* Updates the list of group members for a group principal.
|
||||
*
|
||||
* The principals should be passed as a list of uri's.
|
||||
*
|
||||
* @param string $principal
|
||||
* @param array $members
|
||||
* @return void
|
||||
*/
|
||||
function setGroupMemberSet($principal, array $members);
|
||||
|
||||
}
|
1349
dav/SabreDAV/lib/Sabre/DAVACL/Plugin.php
Normal file
1349
dav/SabreDAV/lib/Sabre/DAVACL/Plugin.php
Normal file
File diff suppressed because it is too large
Load diff
279
dav/SabreDAV/lib/Sabre/DAVACL/Principal.php
Normal file
279
dav/SabreDAV/lib/Sabre/DAVACL/Principal.php
Normal file
|
@ -0,0 +1,279 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Principal class
|
||||
*
|
||||
* This class is a representation of a simple principal
|
||||
*
|
||||
* Many WebDAV specs require a user to show up in the directory
|
||||
* structure.
|
||||
*
|
||||
* This principal also has basic ACL settings, only allowing the principal
|
||||
* access it's own principal.
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAVACL
|
||||
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Sabre_DAVACL_Principal extends Sabre_DAV_Node implements Sabre_DAVACL_IPrincipal, Sabre_DAV_IProperties, Sabre_DAVACL_IACL {
|
||||
|
||||
/**
|
||||
* Struct with principal information.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $principalProperties;
|
||||
|
||||
/**
|
||||
* Principal backend
|
||||
*
|
||||
* @var Sabre_DAVACL_IPrincipalBackend
|
||||
*/
|
||||
protected $principalBackend;
|
||||
|
||||
/**
|
||||
* Creates the principal object
|
||||
*
|
||||
* @param Sabre_DAVACL_IPrincipalBackend $principalBackend
|
||||
* @param array $principalProperties
|
||||
*/
|
||||
public function __construct(Sabre_DAVACL_IPrincipalBackend $principalBackend, array $principalProperties = array()) {
|
||||
|
||||
if (!isset($principalProperties['uri'])) {
|
||||
throw new Sabre_DAV_Exception('The principal properties must at least contain the \'uri\' key');
|
||||
}
|
||||
$this->principalBackend = $principalBackend;
|
||||
$this->principalProperties = $principalProperties;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the full principal url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPrincipalUrl() {
|
||||
|
||||
return $this->principalProperties['uri'];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of alternative urls for a principal
|
||||
*
|
||||
* This can for example be an email address, or ldap url.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAlternateUriSet() {
|
||||
|
||||
$uris = array();
|
||||
if (isset($this->principalProperties['{DAV:}alternate-URI-set'])) {
|
||||
|
||||
$uris = $this->principalProperties['{DAV:}alternate-URI-set'];
|
||||
|
||||
}
|
||||
|
||||
if (isset($this->principalProperties['{http://sabredav.org/ns}email-address'])) {
|
||||
$uris[] = 'mailto:' . $this->principalProperties['{http://sabredav.org/ns}email-address'];
|
||||
}
|
||||
|
||||
return array_unique($uris);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of group members
|
||||
*
|
||||
* If this principal is a group, this function should return
|
||||
* all member principal uri's for the group.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getGroupMemberSet() {
|
||||
|
||||
return $this->principalBackend->getGroupMemberSet($this->principalProperties['uri']);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of groups this principal is member of
|
||||
*
|
||||
* If this principal is a member of a (list of) groups, this function
|
||||
* should return a list of principal uri's for it's members.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getGroupMembership() {
|
||||
|
||||
return $this->principalBackend->getGroupMemberShip($this->principalProperties['uri']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets a list of group members
|
||||
*
|
||||
* If this principal is a group, this method sets all the group members.
|
||||
* The list of members is always overwritten, never appended to.
|
||||
*
|
||||
* This method should throw an exception if the members could not be set.
|
||||
*
|
||||
* @param array $groupMembers
|
||||
* @return void
|
||||
*/
|
||||
public function setGroupMemberSet(array $groupMembers) {
|
||||
|
||||
$this->principalBackend->setGroupMemberSet($this->principalProperties['uri'], $groupMembers);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns this principals name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName() {
|
||||
|
||||
$uri = $this->principalProperties['uri'];
|
||||
list(, $name) = Sabre_DAV_URLUtil::splitPath($uri);
|
||||
return $name;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the user
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDisplayName() {
|
||||
|
||||
if (isset($this->principalProperties['{DAV:}displayname'])) {
|
||||
return $this->principalProperties['{DAV:}displayname'];
|
||||
} else {
|
||||
return $this->getName();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of properties
|
||||
*
|
||||
* @param array $requestedProperties
|
||||
* @return array
|
||||
*/
|
||||
public function getProperties($requestedProperties) {
|
||||
|
||||
$newProperties = array();
|
||||
foreach($requestedProperties as $propName) {
|
||||
|
||||
if (isset($this->principalProperties[$propName])) {
|
||||
$newProperties[$propName] = $this->principalProperties[$propName];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $newProperties;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates this principals properties.
|
||||
*
|
||||
* @param array $mutations
|
||||
* @see Sabre_DAV_IProperties::updateProperties
|
||||
* @return bool|array
|
||||
*/
|
||||
public function updateProperties($mutations) {
|
||||
|
||||
return $this->principalBackend->updatePrincipal($this->principalProperties['uri'], $mutations);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the owner principal
|
||||
*
|
||||
* This must be a url to a principal, or null if there's no owner
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getOwner() {
|
||||
|
||||
return $this->principalProperties['uri'];
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a group principal
|
||||
*
|
||||
* This must be a url to a principal, or null if there's no owner
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getGroup() {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of ACE's for this node.
|
||||
*
|
||||
* Each ACE has the following properties:
|
||||
* * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
|
||||
* currently the only supported privileges
|
||||
* * 'principal', a url to the principal who owns the node
|
||||
* * 'protected' (optional), indicating that this ACE is not allowed to
|
||||
* be updated.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getACL() {
|
||||
|
||||
return array(
|
||||
array(
|
||||
'privilege' => '{DAV:}read',
|
||||
'principal' => $this->getPrincipalUrl(),
|
||||
'protected' => true,
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the ACL
|
||||
*
|
||||
* This method will receive a list of new ACE's.
|
||||
*
|
||||
* @param array $acl
|
||||
* @return void
|
||||
*/
|
||||
public function setACL(array $acl) {
|
||||
|
||||
throw new Sabre_DAV_Exception_MethodNotAllowed('Updating ACLs is not allowed here');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of supported privileges for this node.
|
||||
*
|
||||
* The returned data structure is a list of nested privileges.
|
||||
* See Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet for a simple
|
||||
* standard structure.
|
||||
*
|
||||
* If null is returned from this method, the default privilege set is used,
|
||||
* which is fine for most common usecases.
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function getSupportedPrivilegeSet() {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
}
|
427
dav/SabreDAV/lib/Sabre/DAVACL/PrincipalBackend/PDO.php
Normal file
427
dav/SabreDAV/lib/Sabre/DAVACL/PrincipalBackend/PDO.php
Normal file
|
@ -0,0 +1,427 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* PDO principal backend
|
||||
*
|
||||
* This is a simple principal backend that maps exactly to the users table, as
|
||||
* used by Sabre_DAV_Auth_Backend_PDO.
|
||||
*
|
||||
* It assumes all principals are in a single collection. The default collection
|
||||
* is 'principals/', but this can be overriden.
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAVACL
|
||||
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Sabre_DAVACL_PrincipalBackend_PDO implements Sabre_DAVACL_IPrincipalBackend {
|
||||
|
||||
/**
|
||||
* pdo
|
||||
*
|
||||
* @var PDO
|
||||
*/
|
||||
protected $pdo;
|
||||
|
||||
/**
|
||||
* PDO table name for 'principals'
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $tableName;
|
||||
|
||||
/**
|
||||
* PDO table name for 'group members'
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $groupMembersTableName;
|
||||
|
||||
/**
|
||||
* A list of additional fields to support
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fieldMap = array(
|
||||
|
||||
/**
|
||||
* This property can be used to display the users' real name.
|
||||
*/
|
||||
'{DAV:}displayname' => array(
|
||||
'dbField' => 'displayname',
|
||||
),
|
||||
|
||||
/**
|
||||
* This property is actually used by the CardDAV plugin, where it gets
|
||||
* mapped to {http://calendarserver.orgi/ns/}me-card.
|
||||
*
|
||||
* The reason we don't straight-up use that property, is because
|
||||
* me-card is defined as a property on the users' addressbook
|
||||
* collection.
|
||||
*/
|
||||
'{http://sabredav.org/ns}vcard-url' => array(
|
||||
'dbField' => 'vcardurl',
|
||||
),
|
||||
/**
|
||||
* This is the users' primary email-address.
|
||||
*/
|
||||
'{http://sabredav.org/ns}email-address' => array(
|
||||
'dbField' => 'email',
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Sets up the backend.
|
||||
*
|
||||
* @param PDO $pdo
|
||||
* @param string $tableName
|
||||
* @param string $groupMembersTableName
|
||||
*/
|
||||
public function __construct(PDO $pdo, $tableName = 'principals', $groupMembersTableName = 'groupmembers') {
|
||||
|
||||
$this->pdo = $pdo;
|
||||
$this->tableName = $tableName;
|
||||
$this->groupMembersTableName = $groupMembersTableName;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a list of principals based on a prefix.
|
||||
*
|
||||
* This prefix will often contain something like 'principals'. You are only
|
||||
* expected to return principals that are in this base path.
|
||||
*
|
||||
* You are expected to return at least a 'uri' for every user, you can
|
||||
* return any additional properties if you wish so. Common properties are:
|
||||
* {DAV:}displayname
|
||||
* {http://sabredav.org/ns}email-address - This is a custom SabreDAV
|
||||
* field that's actualy injected in a number of other properties. If
|
||||
* you have an email address, use this property.
|
||||
*
|
||||
* @param string $prefixPath
|
||||
* @return array
|
||||
*/
|
||||
public function getPrincipalsByPrefix($prefixPath) {
|
||||
|
||||
$fields = array(
|
||||
'uri',
|
||||
);
|
||||
|
||||
foreach($this->fieldMap as $key=>$value) {
|
||||
$fields[] = $value['dbField'];
|
||||
}
|
||||
$result = $this->pdo->query('SELECT '.implode(',', $fields).' FROM '. $this->tableName);
|
||||
|
||||
$principals = array();
|
||||
|
||||
while($row = $result->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
// Checking if the principal is in the prefix
|
||||
list($rowPrefix) = Sabre_DAV_URLUtil::splitPath($row['uri']);
|
||||
if ($rowPrefix !== $prefixPath) continue;
|
||||
|
||||
$principal = array(
|
||||
'uri' => $row['uri'],
|
||||
);
|
||||
foreach($this->fieldMap as $key=>$value) {
|
||||
if ($row[$value['dbField']]) {
|
||||
$principal[$key] = $row[$value['dbField']];
|
||||
}
|
||||
}
|
||||
$principals[] = $principal;
|
||||
|
||||
}
|
||||
|
||||
return $principals;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a specific principal, specified by it's path.
|
||||
* The returned structure should be the exact same as from
|
||||
* getPrincipalsByPrefix.
|
||||
*
|
||||
* @param string $path
|
||||
* @return array
|
||||
*/
|
||||
public function getPrincipalByPath($path) {
|
||||
|
||||
$fields = array(
|
||||
'id',
|
||||
'uri',
|
||||
);
|
||||
|
||||
foreach($this->fieldMap as $key=>$value) {
|
||||
$fields[] = $value['dbField'];
|
||||
}
|
||||
$stmt = $this->pdo->prepare('SELECT '.implode(',', $fields).' FROM '. $this->tableName . ' WHERE uri = ?');
|
||||
$stmt->execute(array($path));
|
||||
|
||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
if (!$row) return;
|
||||
|
||||
$principal = array(
|
||||
'id' => $row['id'],
|
||||
'uri' => $row['uri'],
|
||||
);
|
||||
foreach($this->fieldMap as $key=>$value) {
|
||||
if ($row[$value['dbField']]) {
|
||||
$principal[$key] = $row[$value['dbField']];
|
||||
}
|
||||
}
|
||||
return $principal;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates one ore more webdav properties on a principal.
|
||||
*
|
||||
* The list of mutations is supplied as an array. Each key in the array is
|
||||
* a propertyname, such as {DAV:}displayname.
|
||||
*
|
||||
* Each value is the actual value to be updated. If a value is null, it
|
||||
* must be deleted.
|
||||
*
|
||||
* This method should be atomic. It must either completely succeed, or
|
||||
* completely fail. Success and failure can simply be returned as 'true' or
|
||||
* 'false'.
|
||||
*
|
||||
* It is also possible to return detailed failure information. In that case
|
||||
* an array such as this should be returned:
|
||||
*
|
||||
* array(
|
||||
* 200 => array(
|
||||
* '{DAV:}prop1' => null,
|
||||
* ),
|
||||
* 201 => array(
|
||||
* '{DAV:}prop2' => null,
|
||||
* ),
|
||||
* 403 => array(
|
||||
* '{DAV:}prop3' => null,
|
||||
* ),
|
||||
* 424 => array(
|
||||
* '{DAV:}prop4' => null,
|
||||
* ),
|
||||
* );
|
||||
*
|
||||
* In this previous example prop1 was successfully updated or deleted, and
|
||||
* prop2 was succesfully created.
|
||||
*
|
||||
* prop3 failed to update due to '403 Forbidden' and because of this prop4
|
||||
* also could not be updated with '424 Failed dependency'.
|
||||
*
|
||||
* This last example was actually incorrect. While 200 and 201 could appear
|
||||
* in 1 response, if there's any error (403) the other properties should
|
||||
* always fail with 423 (failed dependency).
|
||||
*
|
||||
* But anyway, if you don't want to scratch your head over this, just
|
||||
* return true or false.
|
||||
*
|
||||
* @param string $path
|
||||
* @param array $mutations
|
||||
* @return array|bool
|
||||
*/
|
||||
public function updatePrincipal($path, $mutations) {
|
||||
|
||||
$updateAble = array();
|
||||
foreach($mutations as $key=>$value) {
|
||||
|
||||
// We are not aware of this field, we must fail.
|
||||
if (!isset($this->fieldMap[$key])) {
|
||||
|
||||
$response = array(
|
||||
403 => array(
|
||||
$key => null,
|
||||
),
|
||||
424 => array(),
|
||||
);
|
||||
|
||||
// Adding the rest to the response as a 424
|
||||
foreach($mutations as $subKey=>$subValue) {
|
||||
if ($subKey !== $key) {
|
||||
$response[424][$subKey] = null;
|
||||
}
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
$updateAble[$this->fieldMap[$key]['dbField']] = $value;
|
||||
|
||||
}
|
||||
|
||||
// No fields to update
|
||||
$query = "UPDATE " . $this->tableName . " SET ";
|
||||
|
||||
$first = true;
|
||||
foreach($updateAble as $key => $value) {
|
||||
if (!$first) {
|
||||
$query.= ', ';
|
||||
}
|
||||
$first = false;
|
||||
$query.= "$key = :$key ";
|
||||
}
|
||||
$query.='WHERE uri = :uri';
|
||||
$stmt = $this->pdo->prepare($query);
|
||||
$updateAble['uri'] = $path;
|
||||
$stmt->execute($updateAble);
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to search for principals matching a set of
|
||||
* properties.
|
||||
*
|
||||
* This search is specifically used by RFC3744's principal-property-search
|
||||
* REPORT. You should at least allow searching on
|
||||
* http://sabredav.org/ns}email-address.
|
||||
*
|
||||
* The actual search should be a unicode-non-case-sensitive search. The
|
||||
* keys in searchProperties are the WebDAV property names, while the values
|
||||
* are the property values to search on.
|
||||
*
|
||||
* If multiple properties are being searched on, the search should be
|
||||
* AND'ed.
|
||||
*
|
||||
* This method should simply return an array with full principal uri's.
|
||||
*
|
||||
* If somebody attempted to search on a property the backend does not
|
||||
* support, you should simply return 0 results.
|
||||
*
|
||||
* You can also just return 0 results if you choose to not support
|
||||
* searching at all, but keep in mind that this may stop certain features
|
||||
* from working.
|
||||
*
|
||||
* @param string $prefixPath
|
||||
* @param array $searchProperties
|
||||
* @return array
|
||||
*/
|
||||
public function searchPrincipals($prefixPath, array $searchProperties) {
|
||||
|
||||
$query = 'SELECT uri FROM ' . $this->tableName . ' WHERE 1=1 ';
|
||||
$values = array();
|
||||
foreach($searchProperties as $property => $value) {
|
||||
|
||||
switch($property) {
|
||||
|
||||
case '{DAV:}displayname' :
|
||||
$query.=' AND displayname LIKE ?';
|
||||
$values[] = '%' . $value . '%';
|
||||
break;
|
||||
case '{http://sabredav.org/ns}email-address' :
|
||||
$query.=' AND email LIKE ?';
|
||||
$values[] = '%' . $value . '%';
|
||||
break;
|
||||
default :
|
||||
// Unsupported property
|
||||
return array();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
$stmt = $this->pdo->prepare($query);
|
||||
$stmt->execute($values);
|
||||
|
||||
$principals = array();
|
||||
while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
|
||||
// Checking if the principal is in the prefix
|
||||
list($rowPrefix) = Sabre_DAV_URLUtil::splitPath($row['uri']);
|
||||
if ($rowPrefix !== $prefixPath) continue;
|
||||
|
||||
$principals[] = $row['uri'];
|
||||
|
||||
}
|
||||
|
||||
return $principals;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of members for a group-principal
|
||||
*
|
||||
* @param string $principal
|
||||
* @return array
|
||||
*/
|
||||
public function getGroupMemberSet($principal) {
|
||||
|
||||
$principal = $this->getPrincipalByPath($principal);
|
||||
if (!$principal) throw new Sabre_DAV_Exception('Principal not found');
|
||||
|
||||
$stmt = $this->pdo->prepare('SELECT principals.uri as uri FROM '.$this->groupMembersTableName.' AS groupmembers LEFT JOIN '.$this->tableName.' AS principals ON groupmembers.member_id = principals.id WHERE groupmembers.principal_id = ?');
|
||||
$stmt->execute(array($principal['id']));
|
||||
|
||||
$result = array();
|
||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$result[] = $row['uri'];
|
||||
}
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of groups a principal is a member of
|
||||
*
|
||||
* @param string $principal
|
||||
* @return array
|
||||
*/
|
||||
public function getGroupMembership($principal) {
|
||||
|
||||
$principal = $this->getPrincipalByPath($principal);
|
||||
if (!$principal) throw new Sabre_DAV_Exception('Principal not found');
|
||||
|
||||
$stmt = $this->pdo->prepare('SELECT principals.uri as uri FROM '.$this->groupMembersTableName.' AS groupmembers LEFT JOIN '.$this->tableName.' AS principals ON groupmembers.principal_id = principals.id WHERE groupmembers.member_id = ?');
|
||||
$stmt->execute(array($principal['id']));
|
||||
|
||||
$result = array();
|
||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$result[] = $row['uri'];
|
||||
}
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the list of group members for a group principal.
|
||||
*
|
||||
* The principals should be passed as a list of uri's.
|
||||
*
|
||||
* @param string $principal
|
||||
* @param array $members
|
||||
* @return void
|
||||
*/
|
||||
public function setGroupMemberSet($principal, array $members) {
|
||||
|
||||
// Grabbing the list of principal id's.
|
||||
$stmt = $this->pdo->prepare('SELECT id, uri FROM '.$this->tableName.' WHERE uri IN (? ' . str_repeat(', ? ', count($members)) . ');');
|
||||
$stmt->execute(array_merge(array($principal), $members));
|
||||
|
||||
$memberIds = array();
|
||||
$principalId = null;
|
||||
|
||||
while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ($row['uri'] == $principal) {
|
||||
$principalId = $row['id'];
|
||||
} else {
|
||||
$memberIds[] = $row['id'];
|
||||
}
|
||||
}
|
||||
if (!$principalId) throw new Sabre_DAV_Exception('Principal not found');
|
||||
|
||||
// Wiping out old members
|
||||
$stmt = $this->pdo->prepare('DELETE FROM '.$this->groupMembersTableName.' WHERE principal_id = ?;');
|
||||
$stmt->execute(array($principalId));
|
||||
|
||||
foreach($memberIds as $memberId) {
|
||||
|
||||
$stmt = $this->pdo->prepare('INSERT INTO '.$this->groupMembersTableName.' (principal_id, member_id) VALUES (?, ?);');
|
||||
$stmt->execute(array($principalId, $memberId));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
35
dav/SabreDAV/lib/Sabre/DAVACL/PrincipalCollection.php
Normal file
35
dav/SabreDAV/lib/Sabre/DAVACL/PrincipalCollection.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Principals Collection
|
||||
*
|
||||
* This collection represents a list of users. It uses
|
||||
* Sabre_DAV_Auth_Backend to determine which users are available on the list.
|
||||
*
|
||||
* The users are instances of Sabre_DAV_Auth_Principal
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAVACL
|
||||
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Sabre_DAVACL_PrincipalCollection extends Sabre_DAVACL_AbstractPrincipalCollection {
|
||||
|
||||
/**
|
||||
* This method returns a node for a principal.
|
||||
*
|
||||
* The passed array contains principal information, and is guaranteed to
|
||||
* at least contain a uri item. Other properties may or may not be
|
||||
* supplied by the authentication backend.
|
||||
*
|
||||
* @param array $principal
|
||||
* @return Sabre_DAV_INode
|
||||
*/
|
||||
public function getChildForPrincipal(array $principal) {
|
||||
|
||||
return new Sabre_DAVACL_Principal($this->principalBackend, $principal);
|
||||
|
||||
}
|
||||
|
||||
}
|
209
dav/SabreDAV/lib/Sabre/DAVACL/Property/Acl.php
Normal file
209
dav/SabreDAV/lib/Sabre/DAVACL/Property/Acl.php
Normal file
|
@ -0,0 +1,209 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This class represents the {DAV:}acl property
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAVACL
|
||||
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Sabre_DAVACL_Property_Acl extends Sabre_DAV_Property {
|
||||
|
||||
/**
|
||||
* List of privileges
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $privileges;
|
||||
|
||||
/**
|
||||
* Whether or not the server base url is required to be prefixed when
|
||||
* serializing the property.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $prefixBaseUrl;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* This object requires a structure similar to the return value from
|
||||
* Sabre_DAVACL_Plugin::getACL().
|
||||
*
|
||||
* Each privilege is a an array with at least a 'privilege' property, and a
|
||||
* 'principal' property. A privilege may have a 'protected' property as
|
||||
* well.
|
||||
*
|
||||
* The prefixBaseUrl should be set to false, if the supplied principal urls
|
||||
* are already full urls. If this is kept to true, the servers base url
|
||||
* will automatically be prefixed.
|
||||
*
|
||||
* @param bool $prefixBaseUrl
|
||||
* @param array $privileges
|
||||
*/
|
||||
public function __construct(array $privileges, $prefixBaseUrl = true) {
|
||||
|
||||
$this->privileges = $privileges;
|
||||
$this->prefixBaseUrl = $prefixBaseUrl;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the list of privileges for this property
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getPrivileges() {
|
||||
|
||||
return $this->privileges;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the property into a DOMElement
|
||||
*
|
||||
* @param Sabre_DAV_Server $server
|
||||
* @param DOMElement $node
|
||||
* @return void
|
||||
*/
|
||||
public function serialize(Sabre_DAV_Server $server,DOMElement $node) {
|
||||
|
||||
$doc = $node->ownerDocument;
|
||||
foreach($this->privileges as $ace) {
|
||||
|
||||
$this->serializeAce($doc, $node, $ace, $server);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Unserializes the {DAV:}acl xml element.
|
||||
*
|
||||
* @param DOMElement $dom
|
||||
* @return Sabre_DAVACL_Property_Acl
|
||||
*/
|
||||
static public function unserialize(DOMElement $dom) {
|
||||
|
||||
$privileges = array();
|
||||
$xaces = $dom->getElementsByTagNameNS('urn:DAV','ace');
|
||||
for($ii=0; $ii < $xaces->length; $ii++) {
|
||||
|
||||
$xace = $xaces->item($ii);
|
||||
$principal = $xace->getElementsByTagNameNS('urn:DAV','principal');
|
||||
if ($principal->length !== 1) {
|
||||
throw new Sabre_DAV_Exception_BadRequest('Each {DAV:}ace element must have one {DAV:}principal element');
|
||||
}
|
||||
$principal = Sabre_DAVACL_Property_Principal::unserialize($principal->item(0));
|
||||
|
||||
switch($principal->getType()) {
|
||||
case Sabre_DAVACL_Property_Principal::HREF :
|
||||
$principal = $principal->getHref();
|
||||
break;
|
||||
case Sabre_DAVACL_Property_Principal::AUTHENTICATED :
|
||||
$principal = '{DAV:}authenticated';
|
||||
break;
|
||||
case Sabre_DAVACL_Property_Principal::UNAUTHENTICATED :
|
||||
$principal = '{DAV:}unauthenticated';
|
||||
break;
|
||||
case Sabre_DAVACL_Property_Principal::ALL :
|
||||
$principal = '{DAV:}all';
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
$protected = false;
|
||||
|
||||
if ($xace->getElementsByTagNameNS('urn:DAV','protected')->length > 0) {
|
||||
$protected = true;
|
||||
}
|
||||
|
||||
$grants = $xace->getElementsByTagNameNS('urn:DAV','grant');
|
||||
if ($grants->length < 1) {
|
||||
throw new Sabre_DAV_Exception_NotImplemented('Every {DAV:}ace element must have a {DAV:}grant element. {DAV:}deny is not yet supported');
|
||||
}
|
||||
$grant = $grants->item(0);
|
||||
|
||||
$xprivs = $grant->getElementsByTagNameNS('urn:DAV','privilege');
|
||||
for($jj=0; $jj<$xprivs->length; $jj++) {
|
||||
|
||||
$xpriv = $xprivs->item($jj);
|
||||
|
||||
$privilegeName = null;
|
||||
|
||||
for ($kk=0;$kk<$xpriv->childNodes->length;$kk++) {
|
||||
|
||||
$childNode = $xpriv->childNodes->item($kk);
|
||||
if ($t = Sabre_DAV_XMLUtil::toClarkNotation($childNode)) {
|
||||
$privilegeName = $t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (is_null($privilegeName)) {
|
||||
throw new Sabre_DAV_Exception_BadRequest('{DAV:}privilege elements must have a privilege element contained within them.');
|
||||
}
|
||||
|
||||
$privileges[] = array(
|
||||
'principal' => $principal,
|
||||
'protected' => $protected,
|
||||
'privilege' => $privilegeName,
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return new self($privileges);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes a single access control entry.
|
||||
*
|
||||
* @param DOMDocument $doc
|
||||
* @param DOMElement $node
|
||||
* @param array $ace
|
||||
* @param Sabre_DAV_Server $server
|
||||
* @return void
|
||||
*/
|
||||
private function serializeAce($doc,$node,$ace, $server) {
|
||||
|
||||
$xace = $doc->createElementNS('DAV:','d:ace');
|
||||
$node->appendChild($xace);
|
||||
|
||||
$principal = $doc->createElementNS('DAV:','d:principal');
|
||||
$xace->appendChild($principal);
|
||||
switch($ace['principal']) {
|
||||
case '{DAV:}authenticated' :
|
||||
$principal->appendChild($doc->createElementNS('DAV:','d:authenticated'));
|
||||
break;
|
||||
case '{DAV:}unauthenticated' :
|
||||
$principal->appendChild($doc->createElementNS('DAV:','d:unauthenticated'));
|
||||
break;
|
||||
case '{DAV:}all' :
|
||||
$principal->appendChild($doc->createElementNS('DAV:','d:all'));
|
||||
break;
|
||||
default:
|
||||
$principal->appendChild($doc->createElementNS('DAV:','d:href',($this->prefixBaseUrl?$server->getBaseUri():'') . $ace['principal'] . '/'));
|
||||
}
|
||||
|
||||
$grant = $doc->createElementNS('DAV:','d:grant');
|
||||
$xace->appendChild($grant);
|
||||
|
||||
$privParts = null;
|
||||
|
||||
preg_match('/^{([^}]*)}(.*)$/',$ace['privilege'],$privParts);
|
||||
|
||||
$xprivilege = $doc->createElementNS('DAV:','d:privilege');
|
||||
$grant->appendChild($xprivilege);
|
||||
|
||||
$xprivilege->appendChild($doc->createElementNS($privParts[1],'d:'.$privParts[2]));
|
||||
|
||||
if (isset($ace['protected']) && $ace['protected'])
|
||||
$xace->appendChild($doc->createElement('d:protected'));
|
||||
|
||||
}
|
||||
|
||||
}
|
32
dav/SabreDAV/lib/Sabre/DAVACL/Property/AclRestrictions.php
Normal file
32
dav/SabreDAV/lib/Sabre/DAVACL/Property/AclRestrictions.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* AclRestrictions property
|
||||
*
|
||||
* This property represents {DAV:}acl-restrictions, as defined in RFC3744.
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAVACL
|
||||
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Sabre_DAVACL_Property_AclRestrictions extends Sabre_DAV_Property {
|
||||
|
||||
/**
|
||||
* Serializes the property into a DOMElement
|
||||
*
|
||||
* @param Sabre_DAV_Server $server
|
||||
* @param DOMElement $elem
|
||||
* @return void
|
||||
*/
|
||||
public function serialize(Sabre_DAV_Server $server,DOMElement $elem) {
|
||||
|
||||
$doc = $elem->ownerDocument;
|
||||
|
||||
$elem->appendChild($doc->createElementNS('DAV:','d:grant-only'));
|
||||
$elem->appendChild($doc->createElementNS('DAV:','d:no-invert'));
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* CurrentUserPrivilegeSet
|
||||
*
|
||||
* This class represents the current-user-privilege-set property. When
|
||||
* requested, it contain all the privileges a user has on a specific node.
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAVACL
|
||||
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Sabre_DAVACL_Property_CurrentUserPrivilegeSet extends Sabre_DAV_Property {
|
||||
|
||||
/**
|
||||
* List of privileges
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $privileges;
|
||||
|
||||
/**
|
||||
* Creates the object
|
||||
*
|
||||
* Pass the privileges in clark-notation
|
||||
*
|
||||
* @param array $privileges
|
||||
*/
|
||||
public function __construct(array $privileges) {
|
||||
|
||||
$this->privileges = $privileges;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the property in the DOM
|
||||
*
|
||||
* @param Sabre_DAV_Server $server
|
||||
* @param DOMElement $node
|
||||
* @return void
|
||||
*/
|
||||
public function serialize(Sabre_DAV_Server $server,DOMElement $node) {
|
||||
|
||||
$doc = $node->ownerDocument;
|
||||
foreach($this->privileges as $privName) {
|
||||
|
||||
$this->serializePriv($doc,$node,$privName);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes one privilege
|
||||
*
|
||||
* @param DOMDocument $doc
|
||||
* @param DOMElement $node
|
||||
* @param string $privName
|
||||
* @return void
|
||||
*/
|
||||
protected function serializePriv($doc,$node,$privName) {
|
||||
|
||||
$xp = $doc->createElementNS('DAV:','d:privilege');
|
||||
$node->appendChild($xp);
|
||||
|
||||
$privParts = null;
|
||||
preg_match('/^{([^}]*)}(.*)$/',$privName,$privParts);
|
||||
|
||||
$xp->appendChild($doc->createElementNS($privParts[1],'d:'.$privParts[2]));
|
||||
|
||||
}
|
||||
|
||||
}
|
160
dav/SabreDAV/lib/Sabre/DAVACL/Property/Principal.php
Normal file
160
dav/SabreDAV/lib/Sabre/DAVACL/Property/Principal.php
Normal file
|
@ -0,0 +1,160 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Principal property
|
||||
*
|
||||
* The principal property represents a principal from RFC3744 (ACL).
|
||||
* The property can be used to specify a principal or pseudo principals.
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAVACL
|
||||
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Sabre_DAVACL_Property_Principal extends Sabre_DAV_Property implements Sabre_DAV_Property_IHref {
|
||||
|
||||
/**
|
||||
* To specify a not-logged-in user, use the UNAUTHENTICATED principal
|
||||
*/
|
||||
const UNAUTHENTICATED = 1;
|
||||
|
||||
/**
|
||||
* To specify any principal that is logged in, use AUTHENTICATED
|
||||
*/
|
||||
const AUTHENTICATED = 2;
|
||||
|
||||
/**
|
||||
* Specific principals can be specified with the HREF
|
||||
*/
|
||||
const HREF = 3;
|
||||
|
||||
/**
|
||||
* Everybody, basically
|
||||
*/
|
||||
const ALL = 4;
|
||||
|
||||
/**
|
||||
* Principal-type
|
||||
*
|
||||
* Must be one of the UNAUTHENTICATED, AUTHENTICATED or HREF constants.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $type;
|
||||
|
||||
/**
|
||||
* Url to principal
|
||||
*
|
||||
* This value is only used for the HREF principal type.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $href;
|
||||
|
||||
/**
|
||||
* Creates the property.
|
||||
*
|
||||
* The 'type' argument must be one of the type constants defined in this class.
|
||||
*
|
||||
* 'href' is only required for the HREF type.
|
||||
*
|
||||
* @param int $type
|
||||
* @param string|null $href
|
||||
*/
|
||||
public function __construct($type, $href = null) {
|
||||
|
||||
$this->type = $type;
|
||||
|
||||
if ($type===self::HREF && is_null($href)) {
|
||||
throw new Sabre_DAV_Exception('The href argument must be specified for the HREF principal type.');
|
||||
}
|
||||
$this->href = $href;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the principal type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getType() {
|
||||
|
||||
return $this->type;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the principal uri.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHref() {
|
||||
|
||||
return $this->href;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the property into a DOMElement.
|
||||
*
|
||||
* @param Sabre_DAV_Server $server
|
||||
* @param DOMElement $node
|
||||
* @return void
|
||||
*/
|
||||
public function serialize(Sabre_DAV_Server $server, DOMElement $node) {
|
||||
|
||||
$prefix = $server->xmlNamespaces['DAV:'];
|
||||
switch($this->type) {
|
||||
|
||||
case self::UNAUTHENTICATED :
|
||||
$node->appendChild(
|
||||
$node->ownerDocument->createElement($prefix . ':unauthenticated')
|
||||
);
|
||||
break;
|
||||
case self::AUTHENTICATED :
|
||||
$node->appendChild(
|
||||
$node->ownerDocument->createElement($prefix . ':authenticated')
|
||||
);
|
||||
break;
|
||||
case self::HREF :
|
||||
$href = $node->ownerDocument->createElement($prefix . ':href');
|
||||
$href->nodeValue = $server->getBaseUri() . $this->href;
|
||||
$node->appendChild($href);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Deserializes a DOM element into a property object.
|
||||
*
|
||||
* @param DOMElement $dom
|
||||
* @return Sabre_DAVACL_Property_Principal
|
||||
*/
|
||||
static public function unserialize(DOMElement $dom) {
|
||||
|
||||
$parent = $dom->firstChild;
|
||||
while(!Sabre_DAV_XMLUtil::toClarkNotation($parent)) {
|
||||
$parent = $parent->nextSibling;
|
||||
}
|
||||
|
||||
switch(Sabre_DAV_XMLUtil::toClarkNotation($parent)) {
|
||||
|
||||
case '{DAV:}unauthenticated' :
|
||||
return new self(self::UNAUTHENTICATED);
|
||||
case '{DAV:}authenticated' :
|
||||
return new self(self::AUTHENTICATED);
|
||||
case '{DAV:}href':
|
||||
return new self(self::HREF, $parent->textContent);
|
||||
case '{DAV:}all':
|
||||
return new self(self::ALL);
|
||||
default :
|
||||
throw new Sabre_DAV_Exception_BadRequest('Unexpected element (' . Sabre_DAV_XMLUtil::toClarkNotation($parent) . '). Could not deserialize');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* SupportedPrivilegeSet property
|
||||
*
|
||||
* This property encodes the {DAV:}supported-privilege-set property, as defined
|
||||
* in rfc3744. Please consult the rfc for details about it's structure.
|
||||
*
|
||||
* This class expects a structure like the one given from
|
||||
* Sabre_DAVACL_Plugin::getSupportedPrivilegeSet as the argument in its
|
||||
* constructor.
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAVACL
|
||||
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Sabre_DAVACL_Property_SupportedPrivilegeSet extends Sabre_DAV_Property {
|
||||
|
||||
/**
|
||||
* privileges
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $privileges;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $privileges
|
||||
*/
|
||||
public function __construct(array $privileges) {
|
||||
|
||||
$this->privileges = $privileges;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes the property into a domdocument.
|
||||
*
|
||||
* @param Sabre_DAV_Server $server
|
||||
* @param DOMElement $node
|
||||
* @return void
|
||||
*/
|
||||
public function serialize(Sabre_DAV_Server $server,DOMElement $node) {
|
||||
|
||||
$doc = $node->ownerDocument;
|
||||
$this->serializePriv($doc, $node, $this->privileges);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes a property
|
||||
*
|
||||
* This is a recursive function.
|
||||
*
|
||||
* @param DOMDocument $doc
|
||||
* @param DOMElement $node
|
||||
* @param array $privilege
|
||||
* @return void
|
||||
*/
|
||||
private function serializePriv($doc,$node,$privilege) {
|
||||
|
||||
$xsp = $doc->createElementNS('DAV:','d:supported-privilege');
|
||||
$node->appendChild($xsp);
|
||||
|
||||
$xp = $doc->createElementNS('DAV:','d:privilege');
|
||||
$xsp->appendChild($xp);
|
||||
|
||||
$privParts = null;
|
||||
preg_match('/^{([^}]*)}(.*)$/',$privilege['privilege'],$privParts);
|
||||
|
||||
$xp->appendChild($doc->createElementNS($privParts[1],'d:'.$privParts[2]));
|
||||
|
||||
if (isset($privilege['abstract']) && $privilege['abstract']) {
|
||||
$xsp->appendChild($doc->createElementNS('DAV:','d:abstract'));
|
||||
}
|
||||
|
||||
if (isset($privilege['description'])) {
|
||||
$xsp->appendChild($doc->createElementNS('DAV:','d:description',$privilege['description']));
|
||||
}
|
||||
|
||||
if (isset($privilege['aggregates'])) {
|
||||
foreach($privilege['aggregates'] as $subPrivilege) {
|
||||
$this->serializePriv($doc,$xsp,$subPrivilege);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
24
dav/SabreDAV/lib/Sabre/DAVACL/Version.php
Normal file
24
dav/SabreDAV/lib/Sabre/DAVACL/Version.php
Normal file
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This class contains the SabreDAV version constants.
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAVACL
|
||||
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
class Sabre_DAVACL_Version {
|
||||
|
||||
/**
|
||||
* Full version number
|
||||
*/
|
||||
const VERSION = '1.6.0';
|
||||
|
||||
/**
|
||||
* Stability : alpha, beta, stable
|
||||
*/
|
||||
const STABILITY = 'stable';
|
||||
|
||||
}
|
38
dav/SabreDAV/lib/Sabre/DAVACL/includes.php
Normal file
38
dav/SabreDAV/lib/Sabre/DAVACL/includes.php
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Sabre_DAVACL includes file
|
||||
*
|
||||
* Including this file will automatically include all files from the
|
||||
* Sabre_DAVACL package.
|
||||
*
|
||||
* This often allows faster loadtimes, as autoload-speed is often quite slow.
|
||||
*
|
||||
* @package Sabre
|
||||
* @subpackage DAVACL
|
||||
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
|
||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||
*/
|
||||
|
||||
// Begin includes
|
||||
include __DIR__ . '/AbstractPrincipalCollection.php';
|
||||
include __DIR__ . '/Exception/AceConflict.php';
|
||||
include __DIR__ . '/Exception/NeedPrivileges.php';
|
||||
include __DIR__ . '/Exception/NoAbstract.php';
|
||||
include __DIR__ . '/Exception/NotRecognizedPrincipal.php';
|
||||
include __DIR__ . '/Exception/NotSupportedPrivilege.php';
|
||||
include __DIR__ . '/IACL.php';
|
||||
include __DIR__ . '/IPrincipal.php';
|
||||
include __DIR__ . '/IPrincipalBackend.php';
|
||||
include __DIR__ . '/Plugin.php';
|
||||
include __DIR__ . '/Principal.php';
|
||||
include __DIR__ . '/PrincipalBackend/PDO.php';
|
||||
include __DIR__ . '/PrincipalCollection.php';
|
||||
include __DIR__ . '/Property/Acl.php';
|
||||
include __DIR__ . '/Property/AclRestrictions.php';
|
||||
include __DIR__ . '/Property/CurrentUserPrivilegeSet.php';
|
||||
include __DIR__ . '/Property/Principal.php';
|
||||
include __DIR__ . '/Property/SupportedPrivilegeSet.php';
|
||||
include __DIR__ . '/Version.php';
|
||||
// End includes
|
Loading…
Add table
Add a link
Reference in a new issue