public function addMount($mountPoint, $storageBackend, $authBackend, $priority, $type) { $id = parent::addMount($mountPoint, $storageBackend, $authBackend, $priority, $type); // TODO: Change the autogenerated stub $this->mountIds[] = $id; return $id; }
public function testGetMountsForDuplicateByGroup() { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->addApplicable($id1, DBConfigService::APPLICABLE_TYPE_GROUP, 'group1'); $this->dbConfig->addApplicable($id1, DBConfigService::APPLICABLE_TYPE_GROUP, 'group2'); $mounts = $this->dbConfig->getAdminMountsForMultiple(DBConfigService::APPLICABLE_TYPE_GROUP, ['group1', 'group2']); $this->assertCount(1, $mounts); $this->assertEquals($id1, $mounts[0]['mount_id']); }
public function testGetAdminMountsForGlobal() { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->addApplicable($id1, DBConfigService::APPLICABLE_TYPE_GLOBAL, null); $mounts = $this->dbConfig->getAdminMountsFor(DBConfigService::APPLICABLE_TYPE_GLOBAL, null); $this->assertCount(1, $mounts); $this->assertEquals($id1, $mounts[0]['mount_id']); $this->assertEquals([['type' => DBConfigService::APPLICABLE_TYPE_GLOBAL, 'value' => null, 'mount_id' => $id1]], $mounts[0]['applicable']); }
public function testGetAllMounts() { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $id2 = $this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAl); $mounts = $this->dbConfig->getAllMounts(); $this->assertCount(2, $mounts); $this->assertEquals($id1, $mounts[0]['mount_id']); $this->assertEquals($id2, $mounts[1]['mount_id']); }
public function testSetAuthBackend() { $id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $id2 = $this->addMount('/foo', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN); $this->dbConfig->setAuthBackend($id1, 'none'); $mount = $this->dbConfig->getMountById($id1); $this->assertEquals('none', $mount['auth_backend']); // remains unchanged $mount = $this->dbConfig->getMountById($id2); $this->assertEquals('bar', $mount['auth_backend']); }
/** * Delete the storage with the given id. * * @param int $id storage id * * @throws NotFoundException if no storage was found with the given id */ public function removeStorage($id) { $existingMount = $this->dbConfig->getMountById($id); if (!is_array($existingMount)) { throw new NotFoundException('Storage with id "' . $id . '" not found'); } $this->dbConfig->removeMount($id); $deletedStorage = $this->getStorageConfigFromDBMount($existingMount); $this->triggerHooks($deletedStorage, Filesystem::signal_delete_mount); // delete oc_storages entries and oc_filecache try { $rustyStorageId = $this->getRustyStorageIdFromConfig($deletedStorage); \OC\Files\Cache\Storage::remove($rustyStorageId); } catch (\Exception $e) { // can happen either for invalid configs where the storage could not // be instantiated or whenever $user vars where used, in which case // the storage id could not be computed \OCP\Util::writeLog('files_external', 'Exception: "' . $e->getMessage() . '"', \OCP\Util::ERROR); } }