mirror of
https://github.com/Froxlor/Froxlor.git
synced 2024-09-21 18:37:30 +00:00
don't show SU link for yourself
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
parent
c2ec309a01
commit
5b675c25a3
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Froxlor\UI\Callbacks;
|
||||
|
||||
use Froxlor\UI\Panel\UI;
|
||||
@ -21,38 +22,41 @@ use Froxlor\UI\Panel\UI;
|
||||
|
||||
class Impersonate
|
||||
{
|
||||
public static function admin(string $data, array $attributes): array
|
||||
{
|
||||
$linker = UI::getLinker();
|
||||
return [
|
||||
'type' => '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'],
|
||||
]),
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user