mirror of
https://github.com/Karaka-Management/oms-Admin.git
synced 2026-01-27 04:28:41 +00:00
Fix tests/coverage
This commit is contained in:
parent
56eded102a
commit
35fb1698fd
|
|
@ -14,9 +14,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
|
||||
use phpOMS\Auth\LoginReturnType;
|
||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
||||
use phpOMS\DataStorage\Database\RelationType;
|
||||
use phpOMS\DataStorage\Database\Query\Builder;
|
||||
|
||||
/**
|
||||
|
|
@ -89,6 +89,27 @@ final class AccountMapper extends DataMapperAbstract
|
|||
*/
|
||||
protected static $createdAt = 'account_created_at';
|
||||
|
||||
/**
|
||||
* Get account with permissions
|
||||
*
|
||||
* @param int $id Account id
|
||||
*
|
||||
* @return Account
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function getWithPermissions(int $id) : Account
|
||||
{
|
||||
$account = AccountMapper::get($id);
|
||||
$groupPermissions = GroupPermissionMapper::getFor(\array_keys($account->getGroups()), 'group', RelationType::ALL, null, 2);
|
||||
$account->addPermissions(\is_array($groupPermissions) ? $groupPermissions : [$groupPermissions]);
|
||||
|
||||
$accountPermissions = AccountPermissionMapper::getFor($id, 'account', RelationType::ALL, null, 2);
|
||||
$account->addPermissions(\is_array($accountPermissions) ? $accountPermissions : [$accountPermissions]);
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
||||
/**
|
||||
* Login user.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -19,17 +19,29 @@ use phpOMS\Message\RequestAbstract;
|
|||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Views\View;
|
||||
|
||||
/**
|
||||
* Component view.
|
||||
*
|
||||
* @package TBD
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class GroupTagSelectorPopupView extends View
|
||||
{
|
||||
private $id = '';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct(ApplicationAbstract $app, RequestAbstract $request, ResponseAbstract $response)
|
||||
{
|
||||
parent::__construct($app, $request, $response);
|
||||
$this->setTemplate('/Modules/Admin/Theme/Backend/Components/GroupTagSelector/group-selector-popup');
|
||||
}
|
||||
|
||||
public function setId(string $id)
|
||||
public function setId(string $id) : void
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
|
@ -39,6 +51,9 @@ class GroupTagSelectorPopupView extends View
|
|||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render(...$data) : string
|
||||
{
|
||||
$this->id = $data[0] ?? $this->id;
|
||||
|
|
|
|||
|
|
@ -19,11 +19,23 @@ use phpOMS\Message\RequestAbstract;
|
|||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Views\View;
|
||||
|
||||
/**
|
||||
* Component view.
|
||||
*
|
||||
* @package TBD
|
||||
* @license OMS License 1.0
|
||||
* @link http://website.orange-management.de
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class GroupTagSelectorView extends View
|
||||
{
|
||||
private $id = '';
|
||||
private $isRequired = false;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct(ApplicationAbstract $app, RequestAbstract $request, ResponseAbstract $response)
|
||||
{
|
||||
parent::__construct($app, $request, $response);
|
||||
|
|
@ -43,6 +55,9 @@ class GroupTagSelectorView extends View
|
|||
return $this->isRequired;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render(...$data) : string
|
||||
{
|
||||
$this->id = $data[0];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user