From d04260f4c664675a1e8b965bdf5380758f4ba514 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 2 Jun 2019 21:14:59 +0200 Subject: [PATCH] show groups_permissions in groups and cleanup module profile --- Controller/BackendController.php | 3 +++ Models/GroupMapper.php | 19 ++++++++++++++ Theme/Backend/modules-single.tpl.php | 37 +++++++++++++++------------- 3 files changed, 42 insertions(+), 17 deletions(-) diff --git a/Controller/BackendController.php b/Controller/BackendController.php index ff0bd72..a78467b 100644 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -311,6 +311,9 @@ final class BackendController extends Controller )); } + $groupPermission = GroupMapper::getPermissionForModule($id); + $view->setData('groupPermissions', $groupPermission); + return $view; } } diff --git a/Models/GroupMapper.php b/Models/GroupMapper.php index a4867d6..85cf55d 100644 --- a/Models/GroupMapper.php +++ b/Models/GroupMapper.php @@ -85,4 +85,23 @@ final class GroupMapper extends DataMapperAbstract 'src' => 'account_group_account', ], ]; + + /** + * Get groups which reference a certain module + * + * @param string $module Module + * + * @return array + * + * @since 1.0.0 + */ + public static function getPermissionForModule(string $module) : array + { + $query = self::getQuery(); + $query->innerJoin(GroupPermissionMapper::getTable()) + ->on(self::$table . '.group_id', '=', GroupPermissionMapper::getTable() . '.group_permission_group') + ->where(GroupPermissionMapper::getTable() . '.group_permission_module', '=', $module); + + return self::getAllByQuery($query); + } } diff --git a/Theme/Backend/modules-single.tpl.php b/Theme/Backend/modules-single.tpl.php index fbfa28c..a682b87 100644 --- a/Theme/Backend/modules-single.tpl.php +++ b/Theme/Backend/modules-single.tpl.php @@ -100,22 +100,25 @@ if ($nav !== null) {
-
-

getHtml('Groups'); ?>

- -
- -
-
-
- -
-
-

getHtml('Permissions'); ?>

- -
- -
-
+ + + + + + getData('groupPermissions'); + foreach ($groupPermissions as $key => $value) : ++$c; + $url = \phpOMS\Uri\UriFactory::build('{/prefix}admin/group/settings?{?}&id=' . $value->getId()); ?> + +
getHtml('Permissions') ?>
getHtml('ID', '0', '0'); ?> + Type + getHtml('Name'); ?> +
+ Group + getName(); ?> + + +
getHtml('Empty', '0', '0'); ?> + +