function testValues()
 {
     $aclPlugin = new Sabre_DAVACL_Plugin();
     $this->assertEquals('acl', $aclPlugin->getPluginName());
     $this->assertEquals(array('access-control'), $aclPlugin->getFeatures());
     $this->assertEquals(array('{DAV:}expand-property', '{DAV:}principal-property-search', '{DAV:}principal-search-property-set'), $aclPlugin->getSupportedReportSet(''));
     $this->assertEquals(array('ACL'), $aclPlugin->getMethods(''));
 }
 public function beforeGetProperties($uri, Sabre_DAV_INode $node, &$requestedProperties, &$returnedProperties)
 {
     parent::beforeGetProperties($uri, $node, $requestedProperties, $returnedProperties);
     if (false !== ($index = array_search('{DAV:}principal-URL', $requestedProperties))) {
         unset($requestedProperties[$index]);
         $returnedProperties[200]['{DAV:}principal-URL'] = new Sabre_DAV_Property_Href('principals/users/' . strtolower($_SERVER["PHP_AUTH_USER"]) . '/');
     }
     if (false !== ($index = array_search('{urn:ietf:params:xml:ns:caldav}calendar-home-set', $requestedProperties))) {
         unset($requestedProperties[$index]);
         $returnedProperties[200]['{urn:ietf:params:xml:ns:caldav}calendar-home-set'] = new Sabre_DAV_Property_Href('calendars/' . strtolower($_SERVER["PHP_AUTH_USER"]) . '/');
     }
 }
Ejemplo n.º 3
0
 /**
  * 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()
 {
     $default = Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet();
     // We need to inject 'read-free-busy' in the tree, aggregated under
     // {DAV:}read.
     foreach ($default['aggregates'] as &$agg) {
         if ($agg['privilege'] !== '{DAV:}read') {
             continue;
         }
         $agg['aggregates'][] = array('privilege' => '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}read-free-busy');
     }
     return $default;
 }
Ejemplo n.º 4
0
 /**
  * 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()
 {
     $default = Sabre_DAVACL_Plugin::getDefaultSupportedPrivilegeSet();
     $default['aggregates'][] = array('privilege' => '{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}schedule-query-freebusy');
     return $default;
 }
Ejemplo n.º 5
0
 function testGetFlatPrivilegeSet()
 {
     $expected = array('{DAV:}all' => array('privilege' => '{DAV:}all', 'abstract' => true, 'aggregates' => array('{DAV:}read', '{DAV:}write'), 'concrete' => null), '{DAV:}read' => array('privilege' => '{DAV:}read', 'abstract' => false, 'aggregates' => array('{DAV:}read-acl', '{DAV:}read-current-user-privilege-set'), 'concrete' => '{DAV:}read'), '{DAV:}read-acl' => array('privilege' => '{DAV:}read-acl', 'abstract' => true, 'aggregates' => array(), 'concrete' => '{DAV:}read'), '{DAV:}read-current-user-privilege-set' => array('privilege' => '{DAV:}read-current-user-privilege-set', 'abstract' => true, 'aggregates' => array(), 'concrete' => '{DAV:}read'), '{DAV:}write' => array('privilege' => '{DAV:}write', 'abstract' => false, 'aggregates' => array('{DAV:}write-acl', '{DAV:}write-properties', '{DAV:}write-content', '{DAV:}bind', '{DAV:}unbind', '{DAV:}unlock'), 'concrete' => '{DAV:}write'), '{DAV:}write-acl' => array('privilege' => '{DAV:}write-acl', 'abstract' => true, 'aggregates' => array(), 'concrete' => '{DAV:}write'), '{DAV:}write-properties' => array('privilege' => '{DAV:}write-properties', 'abstract' => true, 'aggregates' => array(), 'concrete' => '{DAV:}write'), '{DAV:}write-content' => array('privilege' => '{DAV:}write-content', 'abstract' => true, 'aggregates' => array(), 'concrete' => '{DAV:}write'), '{DAV:}unlock' => array('privilege' => '{DAV:}unlock', 'abstract' => true, 'aggregates' => array(), 'concrete' => '{DAV:}write'), '{DAV:}bind' => array('privilege' => '{DAV:}bind', 'abstract' => true, 'aggregates' => array(), 'concrete' => '{DAV:}write'), '{DAV:}unbind' => array('privilege' => '{DAV:}unbind', 'abstract' => true, 'aggregates' => array(), 'concrete' => '{DAV:}write'));
     $plugin = new Sabre_DAVACL_Plugin();
     $this->assertEquals($expected, $plugin->getFlatPrivilegeSet());
 }