diff --git a/lib/Froxlor/UI/Callbacks/Impersonate.php b/lib/Froxlor/UI/Callbacks/Impersonate.php index c9b508f1..3d3bea32 100644 --- a/lib/Froxlor/UI/Callbacks/Impersonate.php +++ b/lib/Froxlor/UI/Callbacks/Impersonate.php @@ -1,4 +1,5 @@ 'link', - 'data' => [ - 'text' => $data, - 'href' => $linker->getLink([ - 'section' => 'admins', - 'page' => 'admins', - 'action' => 'su', - 'id' => $attributes['adminid'], - ]), - ] - ]; - } + public static function admin(string $data, array $attributes): mixed + { + if (UI::getCurrentUser()['adminid'] != $attributes['adminid']) { + $linker = UI::getLinker(); + return [ + 'type' => 'link', + 'data' => [ + 'text' => $data, + 'href' => $linker->getLink([ + 'section' => 'admins', + 'page' => 'admins', + 'action' => 'su', + 'id' => $attributes['adminid'], + ]), + ] + ]; + } + return $data; + } - public static function customer(string $data, array $attributes): array - { - $linker = UI::getLinker(); - return [ - 'type' => 'link', - 'data' => [ - 'text' => $data, - 'href' => $linker->getLink([ - 'section' => 'customers', - 'page' => 'customers', - 'action' => 'su', - 'sort' => $attributes['loginname'], - 'id' => $attributes['customerid'], - ]), - ] - ]; - } + public static function customer(string $data, array $attributes): array + { + $linker = UI::getLinker(); + return [ + 'type' => 'link', + 'data' => [ + 'text' => $data, + 'href' => $linker->getLink([ + 'section' => 'customers', + 'page' => 'customers', + 'action' => 'su', + 'sort' => $attributes['loginname'], + 'id' => $attributes['customerid'], + ]), + ] + ]; + } }