Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -53,7 +53,7 @@ class PasswordController extends ControllerAbstract
|
||||
/**
|
||||
* Admin endpoint: Get credential status for a user
|
||||
*/
|
||||
#[AuthenticatedRoute('/admin/status/{uid}', name: 'password.admin.status', methods: ['GET'])]
|
||||
#[AuthenticatedRoute('/status', name: 'password.admin.status', methods: ['POST'], permissions: ['authentication_provider_password.admin.view', 'authentication_provider_password.admin.manage'])]
|
||||
public function getStatus(string $uid): JsonResponse
|
||||
{
|
||||
$tenantId = $this->sessionTenant->identifier();
|
||||
@@ -62,8 +62,6 @@ class PasswordController extends ControllerAbstract
|
||||
return new JsonResponse(['error' => 'Invalid session state'], 400);
|
||||
}
|
||||
|
||||
// TODO: Add permission check for admin operations
|
||||
|
||||
$user = $this->userAccountsService->fetchByIdentifier($uid);
|
||||
if (!$user) {
|
||||
return new JsonResponse(['error' => 'User not found'], 404);
|
||||
@@ -81,7 +79,7 @@ class PasswordController extends ControllerAbstract
|
||||
/**
|
||||
* Admin endpoint: Set/reset user password
|
||||
*/
|
||||
#[AuthenticatedRoute('/admin/reset', name: 'password.admin.reset', methods: ['POST'])]
|
||||
#[AuthenticatedRoute('/reset', name: 'password.admin.reset', methods: ['POST'], permissions: ['authentication_provider_password.admin.manage'])]
|
||||
public function adminReset(string $uid, string $password): JsonResponse
|
||||
{
|
||||
$tenantId = $this->sessionTenant->identifier();
|
||||
@@ -90,8 +88,6 @@ class PasswordController extends ControllerAbstract
|
||||
return new JsonResponse(['error' => 'Invalid session state'], 400);
|
||||
}
|
||||
|
||||
// TODO: Add permission check for admin operations
|
||||
|
||||
if (strlen($password) < 8) {
|
||||
return new JsonResponse(['error' => 'Password must be at least 8 characters'], 400);
|
||||
}
|
||||
@@ -114,7 +110,7 @@ class PasswordController extends ControllerAbstract
|
||||
/**
|
||||
* Admin endpoint: Remove user password
|
||||
*/
|
||||
#[AuthenticatedRoute('/admin/remove/{uid}', name: 'password.admin.remove', methods: ['DELETE'])]
|
||||
#[AuthenticatedRoute('/remove', name: 'password.admin.remove', methods: ['POST'], permissions: ['authentication_provider_password.admin.manage'])]
|
||||
public function adminRemove(string $uid): JsonResponse
|
||||
{
|
||||
$tenantId = $this->sessionTenant->identifier();
|
||||
@@ -123,8 +119,6 @@ class PasswordController extends ControllerAbstract
|
||||
return new JsonResponse(['error' => 'Invalid session state'], 400);
|
||||
}
|
||||
|
||||
// TODO: Add permission check for admin operations
|
||||
|
||||
$user = $this->userAccountsService->fetchByIdentifier($uid);
|
||||
if (!$user) {
|
||||
return new JsonResponse(['error' => 'User not found'], 404);
|
||||
|
||||
@@ -53,6 +53,16 @@ class Module extends ModuleInstanceAbstract implements ModuleConsoleInterface, M
|
||||
'description' => 'View and access the password authentication provider module',
|
||||
'group' => 'Authentication Providers'
|
||||
],
|
||||
'authentication_provider_password.admin.view' => [
|
||||
'label' => 'View Password Status',
|
||||
'description' => 'View whether another user has a password credential configured',
|
||||
'group' => 'Authentication Providers'
|
||||
],
|
||||
'authentication_provider_password.admin.manage' => [
|
||||
'label' => 'Manage User Passwords',
|
||||
'description' => 'Set, reset, or remove password credentials for other users',
|
||||
'group' => 'Authentication Providers'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user