Removed PRIVILEGE_ prefix from constants
This commit is contained in:
parent
8e8e983f28
commit
7c4eddd810
4 changed files with 10 additions and 10 deletions
|
@ -39,7 +39,7 @@ final class UserController extends AbstractController
|
|||
|
||||
public function getFiltered()
|
||||
{
|
||||
$this->privilegeService->assertPrivilege(\Szurubooru\Privilege::PRIVILEGE_LIST_USERS);
|
||||
$this->privilegeService->assertPrivilege(\Szurubooru\Privilege::LIST_USERS);
|
||||
|
||||
$searchFormData = new \Szurubooru\FormData\SearchFormData($this->inputReader);
|
||||
$searchResult = $this->userService->getFiltered($searchFormData);
|
||||
|
@ -52,7 +52,7 @@ final class UserController extends AbstractController
|
|||
|
||||
public function register()
|
||||
{
|
||||
$this->privilegeService->assertPrivilege(\Szurubooru\Privilege::PRIVILEGE_REGISTER);
|
||||
$this->privilegeService->assertPrivilege(\Szurubooru\Privilege::REGISTER);
|
||||
|
||||
$input = new \Szurubooru\FormData\RegistrationFormData($this->inputReader);
|
||||
$user = $this->userService->register($input);
|
||||
|
@ -68,8 +68,8 @@ final class UserController extends AbstractController
|
|||
{
|
||||
$this->privilegeService->assertPrivilege(
|
||||
$this->privilegeService->isLoggedIn($name)
|
||||
? \Szurubooru\Privilege::PRIVILEGE_DELETE_OWN_ACCOUNT
|
||||
: \Szurubooru\Privilege::PRIVILEGE_DELETE_ACCOUNTS);
|
||||
? \Szurubooru\Privilege::DELETE_OWN_ACCOUNT
|
||||
: \Szurubooru\Privilege::DELETE_ACCOUNTS);
|
||||
|
||||
return $this->userService->deleteByName($name);
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@ namespace Szurubooru;
|
|||
|
||||
class Privilege
|
||||
{
|
||||
const PRIVILEGE_REGISTER = 'register';
|
||||
const PRIVILEGE_LIST_USERS = 'listUsers';
|
||||
const PRIVILEGE_DELETE_OWN_ACCOUNT = 'deleteOwnAccount';
|
||||
const PRIVILEGE_DELETE_ALL_ACCOUNTS = 'deleteAllAccounts';
|
||||
const REGISTER = 'register';
|
||||
const LIST_USERS = 'listUsers';
|
||||
const DELETE_OWN_ACCOUNT = 'deleteOwnAccount';
|
||||
const DELETE_ALL_ACCOUNTS = 'deleteAllAccounts';
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ class PrivilegeTest extends \Szurubooru\Tests\AbstractTestCase
|
|||
$refl = new \ReflectionClass(\Szurubooru\Privilege::class);
|
||||
foreach ($refl->getConstants() as $key => $value)
|
||||
{
|
||||
$value = strtoupper('privilege_' . ltrim(preg_replace('/[A-Z]/', '_\0', $value), '_'));
|
||||
$value = strtoupper(ltrim(preg_replace('/[A-Z]/', '_\0', $value), '_'));
|
||||
$this->assertEquals($key, $value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ class PrivilegeServiceTest extends \Szurubooru\Tests\AbstractTestCase
|
|||
$testUser->accessRank = \Szurubooru\Entities\User::ACCESS_RANK_POWER_USER;
|
||||
$this->authServiceMock->method('getLoggedInUser')->willReturn($testUser);
|
||||
|
||||
$privilege = \Szurubooru\Privilege::PRIVILEGE_LIST_USERS;
|
||||
$privilege = \Szurubooru\Privilege::LIST_USERS;
|
||||
$this->configMock->set('security/privileges/' . $privilege, 'powerUser');
|
||||
|
||||
$privilegeService = $this->getPrivilegeService();
|
||||
|
|
Loading…
Reference in a new issue