Esempio n. 1
0
 protected function tearDown()
 {
     \OC_User::setUserId($this->user);
     foreach ($this->storages as $storage) {
         $cache = $storage->getCache();
         $ids = $cache->getAll();
         $cache->clear();
     }
     if ($this->tempStorage && !\OC_Util::runningOnWindows()) {
         system('rm -rf ' . escapeshellarg($this->tempStorage->getDataDir()));
     }
     $this->logout();
     $this->userObject->delete();
     $this->groupObject->delete();
     parent::tearDown();
 }
 public function testPropagateWhenRemovedFromGroupWithSubdirTarget()
 {
     $this->recipientGroup->addUser($this->recipientUser);
     // relogin to refresh mount points
     $this->loginAsUser($this->recipientUser->getUID());
     $recipientView = new View('/' . $this->recipientUser->getUID() . '/files');
     $this->assertTrue($recipientView->mkdir('sub'));
     $this->assertTrue($recipientView->rename('folder', 'sub/folder'));
     $this->propagationManager->expects($this->once())->method('propagateSharesToUser')->with($this->callback(function ($shares) {
         if (count($shares) !== 1) {
             return false;
         }
         $share = array_values($shares)[0];
         return $share['file_source'] === $this->fileInfo['fileid'] && $share['share_with'] === $this->recipientGroup->getGID() && $share['file_target'] === '/sub/folder';
     }), $this->recipientUser->getUID());
     $this->recipientGroup->removeUser($this->recipientUser);
 }
Esempio n. 3
0
 protected function tearDown()
 {
     \OC_User::setUserId($this->user);
     foreach ($this->storages as $storage) {
         $cache = $storage->getCache();
         $ids = $cache->getAll();
         $cache->clear();
     }
     if ($this->tempStorage && !\OC_Util::runningOnWindows()) {
         system('rm -rf ' . escapeshellarg($this->tempStorage->getDataDir()));
     }
     $this->logout();
     $this->userObject->delete();
     $this->groupObject->delete();
     $mountProviderCollection = \OC::$server->getMountProviderCollection();
     \Test\TestCase::invokePrivate($mountProviderCollection, 'providers', [[]]);
     parent::tearDown();
 }
Esempio n. 4
0
 /**
  * delete all SubAdmins by $group
  * @param IGroup $group
  * @return boolean
  */
 private function post_deleteGroup($group)
 {
     $qb = $this->dbConn->getQueryBuilder();
     $qb->delete('group_admin')->where($qb->expr()->eq('gid', $qb->createNamedParameter($group->getGID())))->execute();
     return true;
 }
Esempio n. 5
0
 /**
  * creates an array containing the group meta data
  * @param \OCP\IGroup $group
  * @param string $userSearch
  * @return array with the keys 'id', 'name' and 'usercount'
  */
 private function generateGroupMetaData(\OCP\IGroup $group, $userSearch)
 {
     return array('id' => $group->getGID(), 'name' => $group->getGID(), 'usercount' => $this->sorting === self::SORT_USERCOUNT ? $group->count($userSearch) : 0);
 }
 /**
  * @param IGroup $group
  * @return array
  */
 protected function groupToPrincipal($group)
 {
     $groupId = $group->getGID();
     $principal = ['uri' => "principals/groups/{$groupId}", '{DAV:}displayname' => $groupId];
     return $principal;
 }