diff --git a/Admin/Install/db.json b/Admin/Install/db.json index fc06f1f..d7309f2 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -981,6 +981,13 @@ "default": null, "null": true }, + "group_permission_defaultcperm": { + "description": "Default permissions a user receives when creating (only relevant if hascreate is true, if null => CRU)", + "name": "group_permission_defaultcperm", + "type": "VARCHAR(5)", + "default": null, + "null": true + }, "group_permission_hasmodify": { "name": "group_permission_hasmodify", "type": "TINYINT(1)", @@ -998,6 +1005,13 @@ "type": "TINYINT(1)", "default": null, "null": true + }, + "group_permission_defaultpperm": { + "description": "Default permissions a user is allowed to change (only relevant if haspermission is true, if null => all)", + "name": "group_permission_defaultpperm", + "type": "TEXT", + "default": null, + "null": true } } }, @@ -1359,6 +1373,13 @@ "default": null, "null": true }, + "account_permission_defaultcperm": { + "description": "Default permissions a user receives when creating (only relevant if hascreate is true, if null => CRU)", + "name": "account_permission_defaultcperm", + "type": "VARCHAR(5)", + "default": null, + "null": true + }, "account_permission_hasmodify": { "name": "account_permission_hasmodify", "type": "TINYINT(1)", @@ -1376,6 +1397,13 @@ "type": "TINYINT(1)", "default": null, "null": true + }, + "account_permission_defaultpperm": { + "description": "Default permissions a user is allowed to change (only relevant if haspermission is true, if null => all)", + "name": "account_permission_defaultpperm", + "type": "TEXT", + "default": null, + "null": true } } }, diff --git a/Models/AccountMapper.php b/Models/AccountMapper.php index 79a95aa..fdedc45 100755 --- a/Models/AccountMapper.php +++ b/Models/AccountMapper.php @@ -159,7 +159,8 @@ class AccountMapper extends DataMapperFactory ->with('permissions') ->with('l11n') ->where('id', $id) - ->where('permission/element', null) + ->where('permissions/element', null) + ->where('groups/permissions/element', null) ->execute(); return $account; diff --git a/Models/AccountPermissionMapper.php b/Models/AccountPermissionMapper.php index 17a5fcf..173dfb3 100755 --- a/Models/AccountPermissionMapper.php +++ b/Models/AccountPermissionMapper.php @@ -47,9 +47,11 @@ final class AccountPermissionMapper extends DataMapperFactory 'account_permission_component' => ['name' => 'account_permission_component', 'type' => 'int', 'internal' => 'component'], 'account_permission_hasread' => ['name' => 'account_permission_hasread', 'type' => 'bool', 'internal' => 'hasRead'], 'account_permission_hascreate' => ['name' => 'account_permission_hascreate', 'type' => 'bool', 'internal' => 'hasCreate'], + 'account_permission_defaultcperm' => ['name' => 'account_permission_defaultcperm', 'type' => 'string', 'internal' => 'defaultCPermissions'], 'account_permission_hasmodify' => ['name' => 'account_permission_hasmodify', 'type' => 'bool', 'internal' => 'hasModify'], 'account_permission_hasdelete' => ['name' => 'account_permission_hasdelete', 'type' => 'bool', 'internal' => 'hasDelete'], 'account_permission_haspermission' => ['name' => 'account_permission_haspermission', 'type' => 'bool', 'internal' => 'hasPermission'], + 'account_permission_defaultpperm' => ['name' => 'account_permission_defaultpperm', 'type' => 'string', 'internal' => 'defaultPPermissions'], ]; /** diff --git a/Models/GroupPermissionMapper.php b/Models/GroupPermissionMapper.php index 3f2fbbb..258c641 100755 --- a/Models/GroupPermissionMapper.php +++ b/Models/GroupPermissionMapper.php @@ -47,9 +47,11 @@ final class GroupPermissionMapper extends DataMapperFactory 'group_permission_component' => ['name' => 'group_permission_component', 'type' => 'int', 'internal' => 'component'], 'group_permission_hasread' => ['name' => 'group_permission_hasread', 'type' => 'bool', 'internal' => 'hasRead'], 'group_permission_hascreate' => ['name' => 'group_permission_hascreate', 'type' => 'bool', 'internal' => 'hasCreate'], + 'group_permission_defaultcperm' => ['name' => 'group_permission_defaultcperm', 'type' => 'string', 'internal' => 'defaultCPermissions'], 'group_permission_hasmodify' => ['name' => 'group_permission_hasmodify', 'type' => 'bool', 'internal' => 'hasModify'], 'group_permission_hasdelete' => ['name' => 'group_permission_hasdelete', 'type' => 'bool', 'internal' => 'hasDelete'], 'group_permission_haspermission' => ['name' => 'group_permission_haspermission', 'type' => 'bool', 'internal' => 'hasPermission'], + 'group_permission_defaultpperm' => ['name' => 'group_permission_defaultpperm', 'type' => 'string', 'internal' => 'defaultPPermissions'], ]; /** diff --git a/Theme/Backend/Components/AccountPermissionSelector/BaseView.php b/Theme/Backend/Components/AccountPermissionSelector/BaseView.php index e69de29..c4bb59e 100644 --- a/Theme/Backend/Components/AccountPermissionSelector/BaseView.php +++ b/Theme/Backend/Components/AccountPermissionSelector/BaseView.php @@ -0,0 +1,81 @@ +setTemplate('/Modules/Admin/Theme/Backend/Components/AccountPermissionSelector/account-permission-selector'); + } + + /** + * {@inheritdoc} + */ + public function render(mixed ...$data) : string + { + /** @var array{0:string, 1?:string, 2?:string} $data */ + $this->form = $data[0]; + $this->name = $data[1] ?? 'UNDEFINED'; + $this->virtualPath = $data[2] ?? $this->virtualPath; + $this->permissions = $data[3] ?? $this->permissions; + + return parent::render(); + } +} diff --git a/Theme/Backend/Components/AccountPermissionSelector/account-permission-selector.tpl.php b/Theme/Backend/Components/AccountPermissionSelector/account-permission-selector.tpl.php index 4aa1492..752b3fb 100644 --- a/Theme/Backend/Components/AccountPermissionSelector/account-permission-selector.tpl.php +++ b/Theme/Backend/Components/AccountPermissionSelector/account-permission-selector.tpl.php @@ -12,130 +12,244 @@ */ declare(strict_types=1); +use phpOMS\Account\PermissionType; use phpOMS\Localization\ISO639Enum; use phpOMS\Uri\UriFactory; -$account = $this->accounts; +$permissions = $this->permissions; $categories = ISO639Enum::getConstants(); ?> -
-
-
-
getHtml('Attribute', 'Attribute', 'Backend'); ?>
+
+
+
+
getHtml('PermissionSelector', 'Admin', 'Backend'); ?>
- - + +
+
+ + + + + + +
+
+
+
- + +
- - +
- - -
+ +
+ + + -
- -

+                        
+                            
+                        
+
+                        
+                            
+                        
+
+                        
+                            
+                        
+
+                        
+                            
+                        
+                    
+ +
+ +
+ + + + + + + + + + + + + + + + + + + +
- - - +
- -
-
+
+
-
-
-
getHtml('Attributes', 'Attribute', 'Backend'); ?>
-
- - - - - - $value) : ++$c; ?> - - -
- getHtml('ID', '0', '0'); ?> - getHtml('Name', 'Attribute', 'Backend'); ?> - getHtml('Value', 'Attribute', 'Backend'); ?> - getHtml('Unit', 'Attribute', 'Backend'); ?> -
- - type->isRequired) : ?> - - - - - - - - id; ?> - printHtml($value->type->getL11n()); ?> - value->getValue() instanceof \DateTime ? $value->value->getValue()->format('Y-m-d') : $this->printHtml((string) $value->value->getValue()); ?> - printHtml($value->value->unit); ?> - - -
getHtml('Empty', '0', '0'); ?> - -
-
-
-
+ getHtml('ID', '0', '0'); ?> + getHtml('Account', 'Admin', 'Backend'); ?> + getHtml('Category', 'Admin', 'Backend'); ?> + getHtml('Element', 'Admin', 'Backend'); ?> + + + $value) : ++$c; ?> + + + + type->isRequired) : ?> + + + + + + + + id; ?> + printHtml($value->type->getL11n()); ?> + value->getValue() instanceof \DateTime ? $value->value->getValue()->format('Y-m-d') : $this->printHtml((string) $value->value->getValue()); ?> + printHtml($value->value->unit); ?> + + + + getHtml('Empty', '0', '0'); ?> + + + + + + \ No newline at end of file diff --git a/Theme/Backend/groups-single.tpl.php b/Theme/Backend/groups-single.tpl.php index 8c48fb3..a3b1030 100755 --- a/Theme/Backend/groups-single.tpl.php +++ b/Theme/Backend/groups-single.tpl.php @@ -167,45 +167,45 @@ echo $this->data['nav']->render(); ?>
- - - + + + - - - + + + - - - + + + - - - + + + - - - + + +