mirror of
https://github.com/getnamingo/registry.git
synced 2025-07-05 18:43:19 +02:00
Fixes in registrar impersonation feature
This commit is contained in:
parent
d07fa5481c
commit
9c419fa079
1 changed files with 13 additions and 4 deletions
|
@ -1409,10 +1409,19 @@ class RegistrarsController extends Controller
|
||||||
if ($args) {
|
if ($args) {
|
||||||
$args = trim($args);
|
$args = trim($args);
|
||||||
|
|
||||||
$registrar_id = $db->selectValue('SELECT id FROM registrar WHERE clid = ?',
|
$user_id = $db->selectValue('
|
||||||
[ $args ]);
|
SELECT ru.user_id
|
||||||
$user_id = $db->selectValue('SELECT user_id FROM registrar_users WHERE registrar_id = ?',
|
FROM registrar r
|
||||||
[ $registrar_id ]);
|
JOIN registrar_users ru ON ru.registrar_id = r.id
|
||||||
|
JOIN users u ON u.id = ru.user_id
|
||||||
|
WHERE r.clid = ? AND u.roles_mask = 4
|
||||||
|
ORDER BY ru.user_id ASC
|
||||||
|
', [ $args ]);
|
||||||
|
|
||||||
|
if (!$user_id) {
|
||||||
|
$this->container->get('flash')->addMessage('error', 'No user with the Registrar role is associated with this registrar');
|
||||||
|
return $response->withHeader('Location', '/registrars')->withStatus(302);
|
||||||
|
}
|
||||||
|
|
||||||
Auth::impersonateUser($user_id);
|
Auth::impersonateUser($user_id);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue