* A listen the events "create new users" and "create new group" function initTriggers(){ static $abh = null; if($abh === null) { Helper::appLoger('initTriggers'); $connect = new Connect(Helper::getConnection()); } } if( Helper::isAppSettingsUsers()) { initTriggers(); } */ if (Helper::isApp('contacts')) { $user = \OC::$server->getUserSession()->getUser(); $uid = $user ? $user->getUID() : false; if ($uid) { $projectBook = new ProjectBook(); $projectBookInfo = $projectBook->getProjectBook(); if (!$projectBookInfo) { $projectBook->createProjectBook(); } $isShared = $projectBook->shareProjectBookWith($uid); if ($projectBookInfo && !$isShared) { $projectBook->updateProjectBook(); } } } }
/** * @NoAdminRequired * @NoCSRFRequired */ public function index() { // Create PjCn if not exist // $result = $this->connect->addressbook()->shareProjectContact($this->userId); // var_dump($this->cardDavBackend->createCard()); // IURLGenerator $urlGenerator /* $addressBooks = $this->cardDavBackend->getAddressBooksForUser("principals/users/{$this->userId}"); $addressBookInfo = $addressBooks[0]; $addressBook = new \OCA\DAV\CardDAV\AddressBook($this->cardDavBackend, $addressBookInfo); $urlGenerator = \OC::$server->getURLGenerator(); $addressBookImpl = new AddressBookImpl( $addressBook, $addressBookInfo, $this->cardDavBackend, $urlGenerator ); $properties = [ 'URI' => '33684496-3fe7-443e-a547-b2695a18caf4.vcf', 'FN' => 'Change Name', 'EMAIL' => '*****@*****.**', ]; var_dump($addressBookImpl->createOrUpdate($properties)); array (size=23) 0 => array (size=3) 'uid' => string 'aaam3' (length=5) 'displayname' => null 'email' => null */ // $all = $this->connect->users()->getAllWithEmail(); // var_dump($all); $projectBook = new ProjectBook(); $projectBookInfo = $projectBook->getProjectBook(); $projectBook->updateCard($projectBookInfo['id'], 'aam2'); //var_dump($pb->getProjectBook()); // $users = $this->connect->users()->getAllIds(); // foreach ($users as $user) { // if ($user['uid'] == 'collab_user') continue; // //var_dump($pbInfo['id'], $user['uid']); // //$pb->insertCard($pbInfo['id'], $user['uid']); // } // exit; }