major update
This commit is contained in:
@@ -2,13 +2,11 @@
|
||||
|
||||
use MintyPHP\Http\Request;
|
||||
use MintyPHP\Router;
|
||||
use MintyPHP\Service\Access\AccessServicesFactory;
|
||||
use MintyPHP\Service\Access\UserAuthorizationPolicy;
|
||||
use MintyPHP\Service\User\UserServicesFactory;
|
||||
use MintyPHP\Support\Guard;
|
||||
|
||||
Guard::requireLogin();
|
||||
$authorizationService = (new AccessServicesFactory())->createAuthorizationService();
|
||||
$authorizationService = app(\MintyPHP\Service\Access\AuthorizationService::class);
|
||||
$decision = $authorizationService->authorize(UserAuthorizationPolicy::ABILITY_ADMIN_USERS_VIEW, [
|
||||
'actor_user_id' => (int) ($_SESSION['user']['id'] ?? 0),
|
||||
]);
|
||||
@@ -21,26 +19,26 @@ if (!$decision->isAllowed()) {
|
||||
Router::redirect('error/forbidden?url=' . urlencode(Request::pathWithQuery()));
|
||||
return;
|
||||
}
|
||||
$userAccountService = (new UserServicesFactory())->createUserAccountService();
|
||||
$userAccountService = app(\MintyPHP\Service\User\UserAccountService::class);
|
||||
|
||||
$currentUserId = (int) ($_SESSION['user']['id'] ?? 0);
|
||||
|
||||
$search = trim((string) ($_GET['search'] ?? ''));
|
||||
$order = (string) ($_GET['order'] ?? 'id');
|
||||
$dir = strtolower((string) ($_GET['dir'] ?? 'desc')) === 'asc' ? 'asc' : 'desc';
|
||||
$active = $_GET['active'] ?? 'all';
|
||||
$createdFrom = trim((string) ($_GET['created_from'] ?? ''));
|
||||
$createdTo = trim((string) ($_GET['created_to'] ?? ''));
|
||||
$tenant = trim((string) ($_GET['tenant'] ?? ''));
|
||||
$roles = $_GET['roles'] ?? '';
|
||||
$departments = $_GET['departments'] ?? '';
|
||||
$search = trim((string) (requestInput()->queryAll()['search'] ?? ''));
|
||||
$order = (string) (requestInput()->queryAll()['order'] ?? 'id');
|
||||
$dir = strtolower((string) (requestInput()->queryAll()['dir'] ?? 'desc')) === 'asc' ? 'asc' : 'desc';
|
||||
$active = requestInput()->queryAll()['active'] ?? 'all';
|
||||
$createdFrom = trim((string) (requestInput()->queryAll()['created_from'] ?? ''));
|
||||
$createdTo = trim((string) (requestInput()->queryAll()['created_to'] ?? ''));
|
||||
$tenant = trim((string) (requestInput()->queryAll()['tenant'] ?? ''));
|
||||
$roles = requestInput()->queryAll()['roles'] ?? '';
|
||||
$departments = requestInput()->queryAll()['departments'] ?? '';
|
||||
|
||||
$allowedOrder = ['id', 'uuid', 'first_name', 'last_name', 'email', 'locale', 'theme', 'created', 'modified', 'active'];
|
||||
if (!in_array($order, $allowedOrder, true)) {
|
||||
$order = 'id';
|
||||
}
|
||||
|
||||
$limit = (int) ($_GET['limit'] ?? 5000);
|
||||
$limit = (int) (requestInput()->queryAll()['limit'] ?? 5000);
|
||||
if ($limit < 1) {
|
||||
$limit = 5000;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user