From: Aidan Saunders Date: Mon, 24 Jul 2023 17:09:48 +0000 (+0100) Subject: AdminUI: convert "Assign Users to Roles" ACL page to SearchKit/FormBuilder X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b11ffe4ac3ded7714eed2f11e44137b2a7ad6e43;p=civicrm-core.git AdminUI: convert "Assign Users to Roles" ACL page to SearchKit/FormBuilder --- diff --git a/CRM/ACL/Form/EntityRole.php b/CRM/ACL/Form/EntityRole.php index 4e1b41be51..139366b71e 100644 --- a/CRM/ACL/Form/EntityRole.php +++ b/CRM/ACL/Form/EntityRole.php @@ -31,7 +31,7 @@ class CRM_ACL_Form_EntityRole extends CRM_Admin_Form { } /** - * http://adminui.localhost/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Facl%2Fentityrole&reset=1&action=add Build the form object. + * Build the form object. */ public function buildQuickForm() { parent::buildQuickForm(); diff --git a/ext/civicrm_admin_ui/ang/afsearchAssignUsersToRoles.aff.html b/ext/civicrm_admin_ui/ang/afsearchAssignUsersToRoles.aff.html new file mode 100644 index 0000000000..7869ede9fa --- /dev/null +++ b/ext/civicrm_admin_ui/ang/afsearchAssignUsersToRoles.aff.html @@ -0,0 +1,7 @@ +
+
+
{{:: ts('ACLs allow you to control access to CiviCRM data. An ACL consists of an Operation (e.g. View or Edit), a set of data that the operation can be performed on (e.g. a group of contacts), and a Role that has permission to do this operation.') }} {{:: ts('Learn more ...') }}
+ +
+ +
diff --git a/ext/civicrm_admin_ui/ang/afsearchAssignUsersToRoles.aff.json b/ext/civicrm_admin_ui/ang/afsearchAssignUsersToRoles.aff.json new file mode 100644 index 0000000000..189261d896 --- /dev/null +++ b/ext/civicrm_admin_ui/ang/afsearchAssignUsersToRoles.aff.json @@ -0,0 +1,19 @@ +{ + "type": "search", + "requires": [], + "entity_type": null, + "join_entity": null, + "title": "Assign Users to Roles", + "description": "", + "is_dashlet": false, + "is_public": false, + "is_token": false, + "contact_summary": null, + "summary_contact_type": null, + "icon": "fa-list-alt", + "server_route": "civicrm/acl/entityrole", + "permission": "administer CiviCRM", + "redirect": null, + "create_submission": false, + "navigation": null +} diff --git a/ext/civicrm_admin_ui/managed/SavedSearch_ACL_Roles.mgd.php b/ext/civicrm_admin_ui/managed/SavedSearch_ACL_Roles.mgd.php new file mode 100644 index 0000000000..d139ac217e --- /dev/null +++ b/ext/civicrm_admin_ui/managed/SavedSearch_ACL_Roles.mgd.php @@ -0,0 +1,195 @@ + 'SavedSearch_ACL_Roles', + 'entity' => 'SavedSearch', + 'cleanup' => 'always', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'ACL_Roles', + 'label' => E::ts('ACL Roles'), + 'form_values' => NULL, + 'mapping_id' => NULL, + 'search_custom_id' => NULL, + 'api_entity' => 'ACLEntityRole', + 'api_params' => [ + 'version' => 4, + 'select' => [ + 'acl_role_id:label', + 'ACLEntityRole_Group_entity_id_01.title', + 'is_active', + ], + 'orderBy' => [], + 'where' => [], + 'groupBy' => [], + 'join' => [ + [ + 'Group AS ACLEntityRole_Group_entity_id_01', + 'LEFT', + [ + 'entity_id', + '=', + 'ACLEntityRole_Group_entity_id_01.id', + ], + [ + 'entity_table', + '=', + "'civicrm_group'", + ], + ], + ], + 'having' => [], + ], + 'expires_date' => NULL, + 'description' => NULL, + ], + 'match' => [ + 'name', + ], + ], + ], + [ + 'name' => 'SavedSearch_ACL_Roles_SearchDisplay_ACL_Roles_Table_1', + 'entity' => 'SearchDisplay', + 'cleanup' => 'always', + 'update' => 'unmodified', + 'params' => [ + 'version' => 4, + 'values' => [ + 'name' => 'ACL_Roles_Table_1', + 'label' => E::ts('AdminUI ACL Roles Table'), + 'saved_search_id.name' => 'ACL_Roles', + 'type' => 'table', + 'settings' => [ + 'description' => NULL, + 'sort' => [], + 'limit' => 50, + 'pager' => [ + 'show_count' => FALSE, + 'expose_limit' => FALSE, + 'hide_single' => TRUE, + ], + 'placeholder' => 5, + 'columns' => [ + [ + 'type' => 'field', + 'key' => 'acl_role_id:label', + 'dataType' => 'Integer', + 'label' => E::ts('ACL Role'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'ACLEntityRole_Group_entity_id_01.title', + 'dataType' => 'String', + 'label' => E::ts('Assigned to'), + 'sortable' => TRUE, + ], + [ + 'type' => 'field', + 'key' => 'is_active', + 'dataType' => 'Boolean', + 'label' => E::ts('Enabled'), + 'sortable' => TRUE, + 'editable' => TRUE, + ], + [ + 'text' => '', + 'style' => 'default', + 'size' => 'btn-xs', + 'icon' => 'fa-bars', + 'links' => [ + [ + 'entity' => 'ACLEntityRole', + 'action' => 'update', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-pencil', + 'text' => E::ts('Edit'), + 'style' => 'default', + 'path' => '', + 'task' => '', + 'condition' => [], + ], + [ + 'task' => 'enable', + 'entity' => 'ACLEntityRole', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-toggle-on', + 'text' => E::ts('Enable'), + 'style' => 'default', + 'path' => '', + 'action' => '', + 'condition' => [ + 'is_active', + '=', + FALSE, + ], + ], + [ + 'task' => 'disable', + 'entity' => 'ACLEntityRole', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-toggle-off', + 'text' => E::ts('Disable'), + 'style' => 'default', + 'path' => '', + 'action' => '', + 'condition' => [ + 'is_active', + '=', + TRUE, + ], + ], + [ + 'entity' => 'ACLEntityRole', + 'action' => 'delete', + 'join' => '', + 'target' => 'crm-popup', + 'icon' => 'fa-trash', + 'text' => E::ts('Delete'), + 'style' => 'danger', + 'path' => '', + 'task' => '', + 'condition' => [], + ], + ], + 'type' => 'buttons', + 'alignment' => 'text-right', + ], + ], + 'actions' => FALSE, + 'classes' => [ + 'table', + 'table-striped', + ], + 'cssRules' => [ + [ + 'disabled', + 'is_active', + '=', + FALSE, + ], + ], + 'addButton' => [ + 'path' => 'civicrm/acl/entityrole/edit?reset=1&action=add', + 'text' => E::ts('Add ACL Role Assignment'), + 'icon' => 'fa-plus', + ], + ], + 'acl_bypass' => FALSE, + ], + 'match' => [ + 'name', + 'saved_search_id', + ], + ], + ], +];