mirror of
https://github.com/nextcloud/server.git
synced 2026-06-06 07:13:23 -04:00
Merge pull request #39276 from nextcloud/fix/noid/full-upper-const
This commit is contained in:
commit
be74c03de2
9 changed files with 20 additions and 17 deletions
|
|
@ -91,7 +91,7 @@ class Applicable extends Base {
|
|||
return Response::HTTP_NOT_FOUND;
|
||||
}
|
||||
|
||||
if ($mount->getType() === StorageConfig::MOUNT_TYPE_PERSONAl) {
|
||||
if ($mount->getType() === StorageConfig::MOUNT_TYPE_PERSONAL) {
|
||||
$output->writeln('<error>Can\'t change applicables on personal mounts</error>');
|
||||
return self::FAILURE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ class ConfigAdapter implements IMountProvider {
|
|||
}, $storages, $storageConfigs);
|
||||
|
||||
$mounts = array_map(function (StorageConfig $storageConfig, Storage\IStorage $storage) use ($user, $loader) {
|
||||
if ($storageConfig->getType() === StorageConfig::MOUNT_TYPE_PERSONAl) {
|
||||
if ($storageConfig->getType() === StorageConfig::MOUNT_TYPE_PERSONAL) {
|
||||
return new PersonalMount(
|
||||
$this->userStoragesService,
|
||||
$storageConfig,
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ abstract class StoragesController extends Controller {
|
|||
|
||||
$data = $storage->jsonSerialize(true);
|
||||
$isAdmin = $this->groupManager->isAdmin($this->userSession->getUser()->getUID());
|
||||
$data['can_edit'] = $storage->getType() === StorageConfig::MOUNT_TYPE_PERSONAl || $isAdmin;
|
||||
$data['can_edit'] = $storage->getType() === StorageConfig::MOUNT_TYPE_PERSONAL || $isAdmin;
|
||||
|
||||
return new DataResponse(
|
||||
$data,
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ class UserGlobalStoragesController extends StoragesController {
|
|||
|
||||
$data = $storage->jsonSerialize(true);
|
||||
$isAdmin = $this->groupManager->isAdmin($this->userSession->getUser()->getUID());
|
||||
$data['can_edit'] = $storage->getType() === StorageConfig::MOUNT_TYPE_PERSONAl || $isAdmin;
|
||||
$data['can_edit'] = $storage->getType() === StorageConfig::MOUNT_TYPE_PERSONAL || $isAdmin;
|
||||
|
||||
return new DataResponse(
|
||||
$data,
|
||||
|
|
|
|||
|
|
@ -40,6 +40,8 @@ use OCA\Files_External\ResponseDefinitions;
|
|||
*/
|
||||
class StorageConfig implements \JsonSerializable {
|
||||
public const MOUNT_TYPE_ADMIN = 1;
|
||||
public const MOUNT_TYPE_PERSONAL = 2;
|
||||
/** @deprecated use MOUNT_TYPE_PERSONAL (full uppercase) instead */
|
||||
public const MOUNT_TYPE_PERSONAl = 2;
|
||||
|
||||
/**
|
||||
|
|
@ -384,14 +386,14 @@ class StorageConfig implements \JsonSerializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return int self::MOUNT_TYPE_ADMIN or self::MOUNT_TYPE_PERSONAl
|
||||
* @return int self::MOUNT_TYPE_ADMIN or self::MOUNT_TYPE_PERSONAL
|
||||
*/
|
||||
public function getType() {
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $type self::MOUNT_TYPE_ADMIN or self::MOUNT_TYPE_PERSONAl
|
||||
* @param int $type self::MOUNT_TYPE_ADMIN or self::MOUNT_TYPE_PERSONAL
|
||||
*/
|
||||
public function setType($type) {
|
||||
$this->type = $type;
|
||||
|
|
@ -435,7 +437,7 @@ class StorageConfig implements \JsonSerializable {
|
|||
$result['statusMessage'] = $this->statusMessage;
|
||||
}
|
||||
$result['userProvided'] = $this->authMechanism instanceof IUserProvided;
|
||||
$result['type'] = ($this->getType() === self::MOUNT_TYPE_PERSONAl) ? 'personal': 'system';
|
||||
$result['type'] = ($this->getType() === self::MOUNT_TYPE_PERSONAL) ? 'personal': 'system';
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ use OCP\Security\ICrypto;
|
|||
*/
|
||||
class DBConfigService {
|
||||
public const MOUNT_TYPE_ADMIN = 1;
|
||||
public const MOUNT_TYPE_PERSONAL = 2;
|
||||
/** @deprecated use MOUNT_TYPE_PERSONAL (full uppercase) instead */
|
||||
public const MOUNT_TYPE_PERSONAl = 2;
|
||||
|
||||
public const APPLICABLE_TYPE_GLOBAL = 1;
|
||||
|
|
@ -234,7 +236,7 @@ class DBConfigService {
|
|||
public function getUserMountsFor($type, $value) {
|
||||
$builder = $this->connection->getQueryBuilder();
|
||||
$query = $this->getForQuery($builder, $type, $value);
|
||||
$query->andWhere($builder->expr()->eq('m.type', $builder->expr()->literal(self::MOUNT_TYPE_PERSONAl, IQueryBuilder::PARAM_INT)));
|
||||
$query->andWhere($builder->expr()->eq('m.type', $builder->expr()->literal(self::MOUNT_TYPE_PERSONAL, IQueryBuilder::PARAM_INT)));
|
||||
|
||||
return $this->getMountsFromQuery($query);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ namespace OCA\Files_External\Service;
|
|||
use OC\Files\Filesystem;
|
||||
use OCA\Files_External\Lib\StorageConfig;
|
||||
use OCA\Files_External\NotFoundException;
|
||||
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\Files\Config\IUserMountCache;
|
||||
use OCP\IUserSession;
|
||||
|
|
@ -103,7 +102,7 @@ class UserStoragesService extends StoragesService {
|
|||
}
|
||||
|
||||
protected function getType() {
|
||||
return DBConfigService::MOUNT_TYPE_PERSONAl;
|
||||
return DBConfigService::MOUNT_TYPE_PERSONAL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -144,7 +143,7 @@ class UserStoragesService extends StoragesService {
|
|||
}
|
||||
|
||||
protected function isApplicable(StorageConfig $config) {
|
||||
return ($config->getApplicableUsers() === [$this->getUser()->getUID()]) && $config->getType() === StorageConfig::MOUNT_TYPE_PERSONAl;
|
||||
return ($config->getApplicableUsers() === [$this->getUser()->getUID()]) && $config->getType() === StorageConfig::MOUNT_TYPE_PERSONAL;
|
||||
}
|
||||
|
||||
public function removeStorage($id) {
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ class GlobalAuthTest extends TestCase {
|
|||
$this->credentialsManager->expects($this->never())
|
||||
->method('retrieve');
|
||||
|
||||
$storage = $this->getStorageConfig(StorageConfig::MOUNT_TYPE_PERSONAl);
|
||||
$storage = $this->getStorageConfig(StorageConfig::MOUNT_TYPE_PERSONAL);
|
||||
|
||||
$this->instance->manipulateStorageConfig($storage);
|
||||
$this->assertEquals([], $storage->getBackendOptions());
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ class DBConfigServiceTest extends TestCase {
|
|||
|
||||
public function testGetAdminMounts() {
|
||||
$id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN);
|
||||
$this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAl);
|
||||
$this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAL);
|
||||
|
||||
$mounts = $this->dbConfig->getAdminMounts();
|
||||
$this->assertCount(1, $mounts);
|
||||
|
|
@ -208,7 +208,7 @@ class DBConfigServiceTest extends TestCase {
|
|||
public function testGetAdminMountsFor() {
|
||||
$id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN);
|
||||
$this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_ADMIN);
|
||||
$id3 = $this->addMount('/test3', 'foo3', 'bar3', 100, DBConfigService::MOUNT_TYPE_PERSONAl);
|
||||
$id3 = $this->addMount('/test3', 'foo3', 'bar3', 100, DBConfigService::MOUNT_TYPE_PERSONAL);
|
||||
|
||||
$this->dbConfig->addApplicable($id1, DBConfigService::APPLICABLE_TYPE_USER, 'test');
|
||||
$this->dbConfig->addApplicable($id3, DBConfigService::APPLICABLE_TYPE_USER, 'test');
|
||||
|
|
@ -221,8 +221,8 @@ class DBConfigServiceTest extends TestCase {
|
|||
|
||||
public function testGetUserMountsFor() {
|
||||
$id1 = $this->addMount('/test', 'foo', 'bar', 100, DBConfigService::MOUNT_TYPE_ADMIN);
|
||||
$this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAl);
|
||||
$id3 = $this->addMount('/test3', 'foo3', 'bar3', 100, DBConfigService::MOUNT_TYPE_PERSONAl);
|
||||
$this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAL);
|
||||
$id3 = $this->addMount('/test3', 'foo3', 'bar3', 100, DBConfigService::MOUNT_TYPE_PERSONAL);
|
||||
|
||||
$this->dbConfig->addApplicable($id1, DBConfigService::APPLICABLE_TYPE_USER, 'test');
|
||||
$this->dbConfig->addApplicable($id3, DBConfigService::APPLICABLE_TYPE_USER, 'test');
|
||||
|
|
@ -285,7 +285,7 @@ class DBConfigServiceTest extends TestCase {
|
|||
|
||||
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);
|
||||
$id2 = $this->addMount('/test2', 'foo2', 'bar2', 100, DBConfigService::MOUNT_TYPE_PERSONAL);
|
||||
|
||||
$mounts = $this->dbConfig->getAllMounts();
|
||||
$this->assertCount(2, $mounts);
|
||||
|
|
|
|||
Loading…
Reference in a new issue