Browse Source

full uppercase const

Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
tags/v29.0.0beta1
Maxence Lange 11 months ago
parent
commit
1a5b545fe8

+ 1
- 1
apps/files_external/lib/Command/Applicable.php View File

@@ -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;
}

+ 1
- 1
apps/files_external/lib/Config/ConfigAdapter.php View File

@@ -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,

+ 1
- 1
apps/files_external/lib/Controller/StoragesController.php View File

@@ -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,

+ 1
- 1
apps/files_external/lib/Controller/UserGlobalStoragesController.php View File

@@ -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,

+ 4
- 4
apps/files_external/lib/Lib/StorageConfig.php View File

@@ -40,7 +40,7 @@ use OCA\Files_External\ResponseDefinitions;
*/
class StorageConfig implements \JsonSerializable {
public const MOUNT_TYPE_ADMIN = 1;
public const MOUNT_TYPE_PERSONAl = 2;
public const MOUNT_TYPE_PERSONAL = 2;

/**
* Storage config id
@@ -384,14 +384,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 +435,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;
}


+ 2
- 2
apps/files_external/lib/Service/DBConfigService.php View File

@@ -37,7 +37,7 @@ use OCP\Security\ICrypto;
*/
class DBConfigService {
public const MOUNT_TYPE_ADMIN = 1;
public const MOUNT_TYPE_PERSONAl = 2;
public const MOUNT_TYPE_PERSONAL = 2;

public const APPLICABLE_TYPE_GLOBAL = 1;
public const APPLICABLE_TYPE_GROUP = 2;
@@ -234,7 +234,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);
}

+ 2
- 3
apps/files_external/lib/Service/UserStoragesService.php View File

@@ -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) {

+ 1
- 1
apps/files_external/tests/Auth/Password/GlobalAuth.php View File

@@ -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());

+ 5
- 5
apps/files_external/tests/Service/DBConfigServiceTest.php View File

@@ -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…
Cancel
Save