当前位置: 首页>>代码示例>>PHP>>正文


PHP Tinebase_Core::getUser方法代码示例

本文整理汇总了PHP中Tinebase_Core::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Core::getUser方法的具体用法?PHP Tinebase_Core::getUser怎么用?PHP Tinebase_Core::getUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tinebase_Core的用法示例。


在下文中一共展示了Tinebase_Core::getUser方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: authenticate

 /**
  * (non-PHPdoc)
  * @see Sabre_DAV_Auth_IBackend::authenticate()
  */
 public function authenticate(Sabre_DAV_Server $_server, $_realm)
 {
     if (Tinebase_Core::getUser() instanceof Tinebase_Model_FullUser) {
         return true;
     }
     return false;
 }
开发者ID:,项目名称:,代码行数:11,代码来源:

示例2: __construct

 public function __construct()
 {
     $applications = is_object(Tinebase_Core::getUser()) ? Tinebase_Core::getUser()->getApplications() : new Tinebase_Record_RecordSet('Tinebase_Model_Application');
     parent::__construct('root', array(new \Sabre\DAV\SimpleCollection('principals', array(new Tinebase_WebDav_PrincipalCollection(new Tinebase_WebDav_PrincipalBackend(), Tinebase_WebDav_PrincipalBackend::PREFIX_USERS), new Tinebase_WebDav_PrincipalCollection(new Tinebase_WebDav_PrincipalBackend(), Tinebase_WebDav_PrincipalBackend::PREFIX_GROUPS), new Tinebase_WebDav_PrincipalCollection(new Tinebase_WebDav_PrincipalBackend(), Tinebase_WebDav_PrincipalBackend::PREFIX_INTELLIGROUPS)))));
     if ($applications->find('name', 'Calendar')) {
         $this->addChild(new Calendar_Frontend_WebDAV(\Sabre\CalDAV\Plugin::CALENDAR_ROOT, true));
     }
     if ($applications->find('name', 'Tasks')) {
         $this->addChild(new Tasks_Frontend_WebDAV('tasks', true));
     }
     if ($applications->find('name', 'Addressbook')) {
         $this->addChild(new Addressbook_Frontend_WebDAV(\Sabre\CardDAV\Plugin::ADDRESSBOOK_ROOT, true));
     }
     // main entry point for ownCloud
     if ($applications->find('name', 'Filemanager')) {
         $this->addChild(new \Sabre\DAV\SimpleCollection('remote.php', array(new Filemanager_Frontend_WebDAV('webdav'))));
     }
     // webdav tree
     $webDAVCollection = new \Sabre\DAV\SimpleCollection('webdav');
     foreach ($applications as $application) {
         $applicationClass = $application->name . '_Frontend_WebDAV';
         if (@class_exists($applicationClass)) {
             $webDAVCollection->addChild(new $applicationClass($application->name));
         }
     }
     $this->addChild($webDAVCollection);
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:27,代码来源:Root.php

示例3: testGetProperties

 /**
  * test testGetProperties method
  */
 public function testGetProperties()
 {
     $body = '<?xml version="1.0" encoding="utf-8"?>
              <propfind xmlns="DAV:">
                 <prop>
                     <default-alarm-vevent-date xmlns="urn:ietf:params:xml:ns:caldav"/>
                     <default-alarm-vevent-datetime xmlns="urn:ietf:params:xml:ns:caldav"/>
                     <default-alarm-vtodo-date xmlns="urn:ietf:params:xml:ns:caldav"/>
                     <default-alarm-vtodo-datetime xmlns="urn:ietf:params:xml:ns:caldav"/>
                 </prop>
              </propfind>';
     $request = new Sabre\HTTP\Request(array('REQUEST_METHOD' => 'PROPFIND', 'REQUEST_URI' => '/calendars/' . Tinebase_Core::getUser()->contact_id, 'HTTP_DEPTH' => '0'));
     $request->setBody($body);
     $this->server->httpRequest = $request;
     $this->server->exec();
     //var_dump($this->response->body);
     $this->assertEquals('HTTP/1.1 207 Multi-Status', $this->response->status);
     $responseDoc = new DOMDocument();
     $responseDoc->loadXML($this->response->body);
     //$responseDoc->formatOutput = true; echo $responseDoc->saveXML();
     $xpath = new DomXPath($responseDoc);
     $xpath->registerNamespace('cal', 'urn:ietf:params:xml:ns:caldav');
     $nodes = $xpath->query('//d:multistatus/d:response/d:propstat/d:prop/cal:default-alarm-vevent-datetime');
     $this->assertEquals(1, $nodes->length, $responseDoc->saveXML());
     $this->assertNotEmpty($nodes->item(0)->nodeValue, $responseDoc->saveXML());
     $nodes = $xpath->query('//d:multistatus/d:response/d:propstat/d:prop/cal:default-alarm-vevent-date');
     $this->assertEquals(1, $nodes->length, $responseDoc->saveXML());
     $this->assertNotEmpty($nodes->item(0)->nodeValue, $responseDoc->saveXML());
     $nodes = $xpath->query('//d:multistatus/d:response/d:propstat/d:prop/cal:default-alarm-vtodo-datetime');
     $this->assertEquals(1, $nodes->length, $responseDoc->saveXML());
     $this->assertNotEmpty($nodes->item(0)->nodeValue, $responseDoc->saveXML());
     $nodes = $xpath->query('//d:multistatus/d:response/d:propstat/d:prop/cal:default-alarm-vtodo-date');
     $this->assertEquals(1, $nodes->length, $responseDoc->saveXML());
     $this->assertNotEmpty($nodes->item(0)->nodeValue, $responseDoc->saveXML());
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:38,代码来源:PluginDefaultAlarmsTest.php

示例4: _onAfterExportRecords

 protected function _onAfterExportRecords($result)
 {
     $user = Tinebase_Core::getUser();
     $this->_docTemplate->setValue('date', Tinebase_DateTime::now()->format('Y-m-d'));
     $this->_docTemplate->setValue('account_n_given', $user->accountFirstName);
     $this->_docTemplate->setValue('account_n_family', $user->accountLastName);
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:7,代码来源:Doc.php

示例5: testSearchEvents

 public function testSearchEvents()
 {
     $from = '2009-04-03 00:00:00';
     $until = '2009-04-10 23:59:59';
     $events = new Tinebase_Record_RecordSet('Calendar_Model_Event', array(array('dtstart' => '2009-04-02 22:00:00', 'dtend' => '2009-04-02 23:59:59', 'summary' => 'non recur event ending before search period => should _not_ be found', 'attendee' => $this->_getAttendee(), 'container_id' => $this->_testCalendar->getId(), 'organizer' => Tinebase_Core::getUser()->getId(), 'uid' => Calendar_Model_Event::generateUID(), Tinebase_Model_Grants::GRANT_READ => true), array('dtstart' => '2009-04-02 23:30:00', 'dtend' => '2009-04-03 00:30:00', 'summary' => 'non recur event ending within search period => should be found', 'attendee' => $this->_getAttendee(), 'container_id' => $this->_testCalendar->getId(), 'organizer' => Tinebase_Core::getUser()->getId(), 'uid' => Calendar_Model_Event::generateUID(), Tinebase_Model_Grants::GRANT_READ => true), array('dtstart' => '2009-04-06 12:00:00', 'dtend' => '2009-04-07 12:00:00', 'summary' => 'non recur event completly within search period => should be found', 'attendee' => $this->_getAttendee(), 'container_id' => $this->_testCalendar->getId(), 'organizer' => Tinebase_Core::getUser()->getId(), 'uid' => Calendar_Model_Event::generateUID(), Tinebase_Model_Grants::GRANT_READ => true), array('dtstart' => '2009-04-10 23:30:00', 'dtend' => '2009-04-11 00:30:00', 'summary' => 'non recur event starting within search period => should be found', 'attendee' => $this->_getAttendee(), 'container_id' => $this->_testCalendar->getId(), 'organizer' => Tinebase_Core::getUser()->getId(), 'uid' => Calendar_Model_Event::generateUID(), Tinebase_Model_Grants::GRANT_READ => true), array('dtstart' => '2009-04-11 00:00:00', 'dtend' => '2009-04-11 02:00:00', 'summary' => 'non recur event starting after search period => should _not_ be found', 'attendee' => $this->_getAttendee(), 'container_id' => $this->_testCalendar->getId(), 'organizer' => Tinebase_Core::getUser()->getId(), 'uid' => Calendar_Model_Event::generateUID(), Tinebase_Model_Grants::GRANT_READ => true), array('dtstart' => '2009-03-27 22:00:00', 'dtend' => '2009-03-27 23:59:59', 'rrule' => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-04-02 23:59:59', 'summary' => 'recur event ending before search period => should _not_ be found', 'attendee' => $this->_getAttendee(), 'container_id' => $this->_testCalendar->getId(), 'organizer' => Tinebase_Core::getUser()->getId(), 'uid' => Calendar_Model_Event::generateUID(), 'rrule_until' => '2009-04-02 23:59:59', Tinebase_Model_Grants::GRANT_READ => true), array('dtstart' => '2009-03-27 22:00:00', 'dtend' => '2009-03-27 23:59:59', 'rrule' => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-04-05 23:59:59', 'summary' => 'recur event ending within search period => should be found', 'attendee' => $this->_getAttendee(), 'container_id' => $this->_testCalendar->getId(), 'organizer' => Tinebase_Core::getUser()->getId(), 'uid' => Calendar_Model_Event::generateUID(), 'rrule_until' => '2009-04-05 23:59:59', Tinebase_Model_Grants::GRANT_READ => true), array('dtstart' => '2009-04-03 22:00:00', 'dtend' => '2009-04-03 23:59:59', 'rrule' => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-04-06 23:59:59', 'summary' => 'recur event completly within search period => should be found', 'attendee' => $this->_getAttendee(), 'container_id' => $this->_testCalendar->getId(), 'organizer' => Tinebase_Core::getUser()->getId(), 'uid' => Calendar_Model_Event::generateUID(), 'rrule_until' => '2009-04-06 23:59:59', Tinebase_Model_Grants::GRANT_READ => true), array('dtstart' => '2009-04-03 22:00:00', 'dtend' => '2009-04-03 23:59:59', 'rrule' => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-04-12 23:59:59', 'summary' => 'recur event starting within search period => should be found', 'attendee' => $this->_getAttendee(), 'container_id' => $this->_testCalendar->getId(), 'organizer' => Tinebase_Core::getUser()->getId(), 'uid' => Calendar_Model_Event::generateUID(), 'rrule_until' => '2009-04-12 23:59:59', Tinebase_Model_Grants::GRANT_READ => true), array('dtstart' => '2009-04-11 00:00:00', 'dtend' => '2009-04-11 02:00:00', 'rrule' => 'FREQ=DAILY;INTERVAL=1;UNTIL=2009-04-15 02:00:00', 'summary' => 'recur event starting after search period => should _not_ be found', 'attendee' => $this->_getAttendee(), 'container_id' => $this->_testCalendar->getId(), 'organizer' => Tinebase_Core::getUser()->getId(), 'uid' => Calendar_Model_Event::generateUID(), 'rrule_until' => '2009-04-15 02:00:00', Tinebase_Model_Grants::GRANT_READ => true)));
     foreach ($events as $event) {
         $persistentEvent = $this->_backend->create($event);
         $event->attendee->cal_event_id = $persistentEvent->getId();
         foreach ($event->attendee as $attender) {
             $this->_backend->createAttendee($attender);
         }
     }
     $filter = new Calendar_Model_EventFilter(array(array('field' => 'container_id', 'operator' => 'equals', 'value' => $this->_testCalendar->getId()), array('field' => 'period', 'operator' => 'within', 'value' => array('from' => $from, 'until' => $until))));
     $eventsFound = $this->_backend->search($filter, new Tinebase_Model_Pagination());
     $eventsFoundIds = $eventsFound->getArrayOfIds();
     foreach ($events as $event) {
         $eventId = $event->getId();
         if (strpos($event->summary, '_not_') === false) {
             $this->assertTrue(in_array($eventId, $eventsFoundIds), 'The following event is missing in the search result :' . print_r($event->toArray(), true));
         } else {
             $this->assertFalse(in_array($eventId, $eventsFoundIds), 'The following event is in the search result, but should not be :' . print_r($event->toArray(), true));
         }
     }
     $expectedAttendee = $this->_getAttendee();
     foreach ($eventsFound as $fetchedEvent) {
         $this->_assertAttendee($expectedAttendee, $fetchedEvent->attendee);
     }
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:28,代码来源:SqlTest.php

示例6: testExpandProperty

 public function testExpandProperty()
 {
     $list = Tinebase_Group::getInstance()->getGroupById(Tinebase_Core::getUser()->accountPrimaryGroup);
     $body = '<?xml version="1.0" encoding="UTF-8"?>
             <A:expand-property xmlns:A="DAV:">
               <A:property name="expanded-group-member-set" namespace="http://calendarserver.org/ns/">
                 <A:property name="last-name" namespace="http://calendarserver.org/ns/"/>
                 <A:property name="principal-URL" namespace="DAV:"/>
                 <A:property name="calendar-user-type" namespace="urn:ietf:params:xml:ns:caldav"/>
                 <A:property name="calendar-user-address-set" namespace="urn:ietf:params:xml:ns:caldav"/>
                 <A:property name="first-name" namespace="http://calendarserver.org/ns/"/>
                 <A:property name="record-type" namespace="http://calendarserver.org/ns/"/>
                 <A:property name="displayname" namespace="DAV:"/>
               </A:property>
             </A:expand-property>';
     $request = new Sabre\HTTP\Request(array('REQUEST_METHOD' => 'REPORT', 'REQUEST_URI' => '/principals/groups/' . $list->list_id . '/'));
     $request->setBody($body);
     $this->server->httpRequest = $request;
     $this->server->exec();
     $responseDoc = new DOMDocument();
     $responseDoc->loadXML($this->response->body);
     #$responseDoc->formatOutput = true; echo $responseDoc->saveXML();
     $xpath = new DomXPath($responseDoc);
     $xpath->registerNamespace('cal', 'urn:ietf:params:xml:ns:caldav');
     $xpath->registerNamespace('cs', 'http://calendarserver.org/ns/');
     $nodes = $xpath->query('///cs:expanded-group-member-set/d:response/d:href[text()="/principals/groups/' . $list->list_id . '/"]');
     $this->assertEquals(1, $nodes->length, 'group itself (not shown by client) is missing');
     $nodes = $xpath->query('///cs:expanded-group-member-set/d:response/d:href[text()="/principals/intelligroups/' . $list->list_id . '/"]');
     $this->assertEquals(1, $nodes->length, 'intelligroup (to keep group itself) is missing');
     $nodes = $xpath->query('///cs:expanded-group-member-set/d:response/d:href[text()="/principals/users/' . Tinebase_Core::getUser()->contact_id . '/"]');
     $this->assertEquals(1, $nodes->length, 'user is missing');
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:32,代码来源:ExpandedPropertiesReportTest.php

示例7: update

 /**
  * update one phone
  *
  * @param Voipmanager_Model_Snom_Phone $_phone
  * @return Voipmanager_Model_Snom_Phone
  * @throws Voipmanager_Exception_Validation
  *
  * @todo do not overwrite update() -> use inspectBefore/After functions
  */
 public function update(Tinebase_Record_Interface $_phone)
 {
     $oldRecord = $this->get($_phone->getId());
     $rights = $this->_backend->getPhoneRights($_phone->getId());
     $currentAccountId = Tinebase_Core::getUser()->getId();
     $hasRight = false;
     foreach ($rights as $right) {
         if ($right->account_id == $currentAccountId) {
             // if  user has the right to dial and read the phone, he or she may edit the lines
             if ($right->dial_right && $right->read_right) {
                 $hasRight = true;
             }
         }
     }
     if (!$hasRight) {
         throw new Tinebase_Exception_AccessDenied('You are not allowed to edit this phone!');
     }
     // user is not allowed to add or remove lines
     $diff = $oldRecord->lines->diff($_phone->lines);
     if (count($diff->added) > 0 || count($diff->removed) > 0) {
         throw new Tinebase_Exception_AccessDenied('You are not allowed to add or remove lines of this phone!');
     }
     // user may just edit the lines and settings of the phone
     $oldRecord->lines = $_phone->lines;
     $oldRecord->settings = $_phone->settings;
     return parent::update($oldRecord);
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:36,代码来源:MyPhone.php

示例8: tearDown

 /**
  * Tears down the fixture
  * This method is called after a test is executed.
  *
  * @access protected
  */
 protected function tearDown()
 {
     $currentUser = Tinebase_Core::getUser();
     if ($currentUser->accountLoginName !== $this->_testUser->accountLoginName) {
         Tinebase_Core::set(Tinebase_Core::USER, $this->_testUser);
     }
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:13,代码来源:CliTest.php

示例9: __construct

 /**
  * the constructor
  *
  * don't use the constructor. use the singleton
  */
 private function __construct()
 {
     $this->_modelName = 'Felamimail_Model_Message';
     $this->_doContainerACLChecks = FALSE;
     $this->_backend = Felamimail_Backend_Message::getInstance();
     $this->_currentAccount = Tinebase_Core::getUser();
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:12,代码来源:Message.php

示例10: handle

 /**
  * process the XML file and add, change, delete or fetches data 
  *
  * @return resource
  */
 public function handle()
 {
     $defaultAccountId = Tinebase_Core::getPreference('Felamimail')->{Felamimail_Preference::DEFAULTACCOUNT};
     try {
         $this->_account = Felamimail_Controller_Account::getInstance()->get($defaultAccountId);
     } catch (Tinebase_Exception_NotFound $ten) {
         if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
             Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . " no email account configured");
         }
         throw new ActiveSync_Exception('no email account configured');
     }
     if (empty(Tinebase_Core::getUser()->accountEmailAddress)) {
         throw new ActiveSync_Exception('no email address set for current user');
     }
     $this->_saveInSent = isset($_GET['SaveInSent']) && (bool) $_GET['SaveInSent'] == 'T';
     if (!is_resource($this->_inputStream)) {
         $this->_inputStream = fopen("php://input", 'r');
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         $debugStream = fopen("php://temp", 'r+');
         stream_copy_to_stream($this->_inputStream, $debugStream);
         rewind($debugStream);
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " email to send:" . stream_get_contents($debugStream));
         }
         // replace original stream wirh debug stream, as php://input can't be rewinded
         $this->_inputStream = $debugStream;
         rewind($this->_inputStream);
     }
     $this->_incomingMessage = new Zend_Mail_Message(array('file' => $this->_inputStream));
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:36,代码来源:SendMail.php

示例11: appendFilterSql

 /**
  * appends sql to given select statement
  *
  * @param Zend_Db_Select                $_select
  * @param Tinebase_Backend_Sql_Abstract $_backend
  */
 public function appendFilterSql($_select, $_backend)
 {
     $db = $_backend->getAdapter();
     // prepare value
     $value = $this->_value ? 1 : 0;
     if ($value) {
         // nothing to do -> show all contacts!
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Query all account contacts.');
         }
     } else {
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Only query visible and enabled account contacts.');
         }
         if (Tinebase_Core::getUser() instanceof Tinebase_Model_FullUser) {
             $where = '/* is no user */ ' . Tinebase_Backend_Sql_Command::getIfIsNull($db, $db->quoteIdentifier('accounts.id'), 'true', 'false') . ' OR /* is user */ (' . Tinebase_Backend_Sql_Command::getIfIsNull($db, $db->quoteIdentifier('accounts.id'), 'false', 'true') . ' AND ' . $db->quoteInto($db->quoteIdentifier('accounts.status') . ' = ?', 'enabled') . " AND " . '(' . $db->quoteInto($db->quoteIdentifier('accounts.visibility') . ' = ?', 'displayed') . ' OR ' . $db->quoteInto($db->quoteIdentifier('accounts.id') . ' = ?', Tinebase_Core::getUser()->getId()) . ')' . ")";
         } else {
             $where = '/* is no user */ ' . Tinebase_Backend_Sql_Command::getIfIsNull($db, $db->quoteIdentifier('accounts.id'), 'true', 'false') . ' OR /* is user */ (' . Tinebase_Backend_Sql_Command::getIfIsNull($db, $db->quoteIdentifier('accounts.id'), 'false', 'true') . ' AND ' . $db->quoteInto($db->quoteIdentifier('accounts.status') . ' = ?', 'enabled') . " AND " . $db->quoteInto($db->quoteIdentifier('accounts.visibility') . ' = ?', 'displayed') . ")";
         }
         $_select->where($where);
         $select = $_select instanceof Zend_Db_Select ? $_select : $_select->getSelect();
         $select = Tinebase_Backend_Sql_Abstract::traitGroup($db, $_backend->getTablePrefix(), $select);
         $_select instanceof Zend_Db_Select ? $_select = $select : $_select->setSelect($select);
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' contacts query ' . $_select->assemble());
         }
     }
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:34,代码来源:ContactDisabledFilter.php

示例12: getChild

 /**
  * @see Tinebase_WebDav_Collection_AbstractContainerTree::getChild()
  * @param string $name
  * @return Tinebase_WebDav_Container_Abstract|Tinebase_WebDav_Collection_AbstractContainerTree|Tinebase_Frontend_WebDAV_RecordCollection
  */
 public function getChild($name)
 {
     if (count($this->_getPathParts()) === 2 && $name == Addressbook_Frontend_CardDAV_AllContacts::NAME) {
         return new Addressbook_Frontend_CardDAV_AllContacts(Tinebase_Core::getUser());
     }
     return parent::getChild($name);
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:12,代码来源:WebDAV.php

示例13: __construct

 /**
  * the constructor
  *
  * don't use the constructor. use the singleton 
  */
 private function __construct()
 {
     $this->_applicationName = 'Sales';
     $this->_backend = new Sales_Backend_Contract();
     $this->_modelName = 'Sales_Model_Contract';
     $this->_currentAccount = Tinebase_Core::getUser();
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:12,代码来源:Contract.php

示例14: testGetProperties

 /**
  * test testGetProperties method
  */
 public function testGetProperties()
 {
     $body = '<?xml version="1.0" encoding="utf-8"?>
              <propfind xmlns="DAV:">
                 <prop>
                     <getlastmodified xmlns="DAV:"/>
                     <getcontentlength xmlns="DAV:"/>
                     <resourcetype xmlns="DAV:"/>
                     <getetag xmlns="DAV:"/>
                     <id xmlns="http://owncloud.org/ns"/>
                 </prop>
              </propfind>';
     $request = new Sabre\HTTP\Request(array('REQUEST_METHOD' => 'PROPFIND', 'REQUEST_URI' => '/remote.php/webdav/' . Tinebase_Core::getUser()->accountDisplayName, 'HTTP_DEPTH' => '0'));
     $request->setBody($body);
     $this->server->httpRequest = $request;
     $this->server->exec();
     //var_dump($this->response->body);
     $this->assertEquals('HTTP/1.1 207 Multi-Status', $this->response->status);
     $responseDoc = new DOMDocument();
     $responseDoc->loadXML($this->response->body);
     //$responseDoc->formatOutput = true; echo $responseDoc->saveXML();
     $xpath = new DomXPath($responseDoc);
     $xpath->registerNamespace('owncloud', 'http://owncloud.org/ns');
     $nodes = $xpath->query('//d:multistatus/d:response/d:propstat/d:prop/owncloud:id');
     $this->assertEquals(1, $nodes->length, $responseDoc->saveXML());
     $this->assertNotEmpty($nodes->item(0)->nodeValue, $responseDoc->saveXML());
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:30,代码来源:OwnCloudTest.php

示例15: testEmailsToAttendeeWithGroups

 /**
  * @return void
  */
 public function testEmailsToAttendeeWithGroups()
 {
     if (Tinebase_User::getConfiguredBackend() === Tinebase_User::LDAP || Tinebase_User::getConfiguredBackend() === Tinebase_User::ACTIVEDIRECTORY) {
         $this->markTestSkipped('FIXME: Does not work with LDAP/AD backend');
     }
     $event = $this->_getEvent();
     $persistentEvent = Calendar_Controller_Event::getInstance()->create($event);
     $primaryGroup = Tinebase_Group::getInstance()->getGroupById(Tinebase_Core::getUser()->accountPrimaryGroup);
     $newAttendees = array(array('userType' => Calendar_Model_Attender::USERTYPE_USER, 'firstName' => $this->_originalTestUser->accountFirstName, 'lastName' => $this->_originalTestUser->accountLastName, 'partStat' => Calendar_Model_Attender::STATUS_TENTATIVE, 'role' => Calendar_Model_Attender::ROLE_REQUIRED, 'email' => $this->_originalTestUser->accountEmailAddress), array('userType' => Calendar_Model_Attender::USERTYPE_GROUP, 'displayName' => $primaryGroup->name, 'partStat' => Calendar_Model_Attender::STATUS_NEEDSACTION, 'role' => Calendar_Model_Attender::ROLE_REQUIRED, 'email' => 'foobar@example.org'));
     Calendar_Model_Attender::emailsToAttendee($persistentEvent, $newAttendees, TRUE);
     $persistentEvent = Calendar_Controller_Event::getInstance()->update($persistentEvent);
     $attendees = clone $persistentEvent->attendee;
     Calendar_Model_Attender::resolveAttendee($attendees);
     $newAttendees = array();
     foreach ($attendees as $attendee) {
         $newAttendees[] = array('userType' => $attendee->user_type == 'group' ? Calendar_Model_Attender::USERTYPE_GROUP : Calendar_Model_Attender::USERTYPE_USER, 'partStat' => Calendar_Model_Attender::STATUS_TENTATIVE, 'role' => Calendar_Model_Attender::ROLE_REQUIRED, 'email' => $attendee->user_type == 'group' ? $attendee->user_id->getId() : $attendee->user_id->email, 'displayName' => $attendee->user_type == 'group' ? $attendee->user_id->name : $attendee->user_id->n_fileas);
     }
     Calendar_Model_Attender::emailsToAttendee($persistentEvent, $newAttendees, TRUE);
     $persistentEvent = Calendar_Controller_Event::getInstance()->update($persistentEvent);
     //         print_r($persistentEvent->attendee->toArray());
     // there must be more than 2 attendees the user, the group + the groupmembers
     $this->assertGreaterThan(2, count($persistentEvent->attendee));
     // current account must not be a groupmember
     $this->assertFalse(!!Calendar_Model_Attender::getAttendee($persistentEvent->attendee, new Calendar_Model_Attender(array('user_type' => Calendar_Model_Attender::USERTYPE_GROUPMEMBER, 'user_id' => $this->_originalTestUser->contact_id))), 'found user as groupmember');
     $this->assertEquals(Calendar_Model_Attender::STATUS_TENTATIVE, Calendar_Model_Attender::getOwnAttender($persistentEvent->attendee)->status);
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:29,代码来源:AttenderTests.php


注:本文中的Tinebase_Core::getUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。