Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Consultant Administrator option to add users page #363

Merged
merged 19 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
d827bc6
feat: add operator-tc to permission list
gabrielg2020 Oct 2, 2024
6213f55
feat: add `user_type` and `permission_type` of operator-tc
gabrielg2020 Oct 2, 2024
eb26463
chore: php.xml
gabrielg2020 Oct 2, 2024
f2d1a92
fix: removed 2 roles have same permissions
gabrielg2020 Oct 2, 2024
b3e67da
fix: add `operator-tc` to user type `transport-manager`
gabrielg2020 Oct 2, 2024
e76e44f
fix: re-added 2 roles on same permission
gabrielg2020 Oct 2, 2024
bde9906
feat: give the role-entity `operator-tc` its own permission
gabrielg2020 Oct 3, 2024
e31a4bb
fix: allowed `operator-tc` permission to be passed as admin
gabrielg2020 Oct 3, 2024
040b975
Merge branch 'main' into 4706-adding-consultant-adim-to-add-user-page
gabrielg2020 Oct 3, 2024
9bdfa7e
chore: removed php.xml
gabrielg2020 Oct 4, 2024
ca50841
Merge branch 'main' into 4706-adding-consultant-adim-to-add-user-page
gabrielg2020 Oct 4, 2024
6ead0b6
fix: removed `operator-tc` user type to follow [ROLE]=[USER_TYPE][PER…
gabrielg2020 Oct 4, 2024
e88c5e9
fix: changed `operator-tc` to `tc` when refrencing the `tc` permission
gabrielg2020 Oct 4, 2024
a196132
wip: unit testing of selfserverCreateUser commandhandler
sdh100shaun Oct 7, 2024
a4f0e31
fix: removed testing for selfserverCreateUser commandhandler
gabrielg2020 Oct 7, 2024
f8f4ea5
Merge branch 'main' into 4706-adding-consultant-adim-to-add-user-page
gabrielg2020 Oct 7, 2024
88705bb
fix: fixed tests
gabrielg2020 Oct 7, 2024
2660f3d
Merge branch 'main' into 4706-adding-consultant-adim-to-add-user-page
gabrielg2020 Oct 8, 2024
d6d0b92
chore: update lock files
gabrielg2020 Oct 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
592 changes: 0 additions & 592 deletions .idea/php.xml

This file was deleted.

12 changes: 6 additions & 6 deletions app/api/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions app/api/module/Api/src/Entity/User/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class User extends AbstractUser implements OrganisationProviderInterface
public const PERMISSION_ADMIN = 'admin';
public const PERMISSION_USER = 'user';
public const PERMISSION_TM = 'tm';
public const PERMISSION_TC = 'tc';

public const USER_TYPE_INTERNAL = 'internal';
public const USER_TYPE_ANON = 'anon';
Expand Down Expand Up @@ -97,12 +98,14 @@ class User extends AbstractUser implements OrganisationProviderInterface
self::PERMISSION_USER => [RoleEntity::ROLE_LOCAL_AUTHORITY_USER],
],
self::USER_TYPE_OPERATOR => [
self::PERMISSION_ADMIN => [RoleEntity::ROLE_OPERATOR_ADMIN, RoleEntity::ROLE_OPERATOR_TC],
self::PERMISSION_TC => [RoleEntity::ROLE_OPERATOR_TC],
self::PERMISSION_ADMIN => [RoleEntity::ROLE_OPERATOR_ADMIN],
self::PERMISSION_USER => [RoleEntity::ROLE_OPERATOR_USER],
self::PERMISSION_TM => [RoleEntity::ROLE_OPERATOR_TM],
],
self::USER_TYPE_TRANSPORT_MANAGER => [
self::PERMISSION_ADMIN => [RoleEntity::ROLE_OPERATOR_ADMIN, RoleEntity::ROLE_OPERATOR_TC],
self::PERMISSION_TC => [RoleEntity::ROLE_OPERATOR_TC],
self::PERMISSION_ADMIN => [RoleEntity::ROLE_OPERATOR_ADMIN],
self::PERMISSION_USER => [RoleEntity::ROLE_OPERATOR_USER],
self::PERMISSION_TM => [RoleEntity::ROLE_OPERATOR_TM],
],
Expand Down Expand Up @@ -502,7 +505,9 @@ private function isAdministrator()
// is admin if has roles for admin permission
return $this->hasRoles(
self::getRolesByUserType($this->getUserType(), self::PERMISSION_ADMIN)
);
) || $this->hasRoles(
self::getRolesByUserType($this->getUserType(), self::PERMISSION_TC)
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Dvsa\Olcs\Api\Entity\Organisation\Organisation as OrganisationEntity;
use Dvsa\Olcs\Api\Entity\Organisation\OrganisationUser as OrganisationUserEntity;
use Dvsa\Olcs\Api\Entity\Tm\TransportManager as TransportManagerEntity;
use Dvsa\Olcs\Api\Entity\User\Role as RoleEntity;
use Dvsa\Olcs\Api\Entity\User\User as UserEntity;
use Dvsa\Olcs\Auth\Service\PasswordService;
use Dvsa\Olcs\Transfer\Command\User\CreateUserSelfserve as Cmd;
Expand Down Expand Up @@ -255,6 +256,7 @@ public function testHandleCommandForTm()
$savedUser = $this->commonHandleCommandTest();

$this->assertEquals(UserEntity::USER_TYPE_OPERATOR, $savedUser->getUserType());

}

public function testHandleCommandThrowsIncorrectUserTypeException()
Expand Down
Loading