From a14d51de948b9dc2698a61cfaf93dbd5738d9b3a Mon Sep 17 00:00:00 2001 From: martinyde Date: Tue, 13 Jul 2021 20:55:35 +0200 Subject: [PATCH 1/2] LOOP-999: Added modules, entity_usage and Entity Reference Integrity --- composer.json | 2 + composer.lock | 119 +++++++++++++++++- config/sync/core.extension.yml | 3 + ...y_reference_integrity_enforce.settings.yml | 50 ++++++++ config/sync/entity_usage.settings.yml | 26 ++++ .../user.role.os2loop_user_administrator.yml | 4 + config/sync/views.view.media.yml | 68 ++++++++++ 7 files changed, 271 insertions(+), 1 deletion(-) create mode 100644 config/sync/entity_reference_integrity_enforce.settings.yml create mode 100644 config/sync/entity_usage.settings.yml diff --git a/composer.json b/composer.json index 2c631e8d1..70f2be202 100644 --- a/composer.json +++ b/composer.json @@ -52,6 +52,8 @@ "drupal/date_popup": "^1.1", "drupal/diff": "^1.0", "drupal/entity_print": "^2.2", + "drupal/entity_reference_integrity": "^1.0", + "drupal/entity_usage": "^2.0@beta", "drupal/facets": "^1.7", "drupal/field_group": "^3.1", "drupal/flag": "^4.0@beta", diff --git a/composer.lock b/composer.lock index dee9d880d..fcc5fe16f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a297d0da3ba59a611a73ecec1a645185", + "content-hash": "bed2df9a98d0c211f3d55167f18cbc74", "packages": [ { "name": "alchemy/zippy", @@ -3162,6 +3162,54 @@ "source": "https://git.drupalcode.org/project/entity_print" } }, + { + "name": "drupal/entity_reference_integrity", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/entity_reference_integrity.git", + "reference": "8.x-1.0" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/entity_reference_integrity-8.x-1.0.zip", + "reference": "8.x-1.0", + "shasum": "ca0b19f4f2007b84041b80d44bfbb77470000ffe" + }, + "require": { + "drupal/core": "^8 || ^9" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "8.x-1.0", + "datestamp": "1614645008", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "Sam152", + "homepage": "https://www.drupal.org/user/1485048" + }, + { + "name": "benjy", + "homepage": "https://www.drupal.org/user/1852732" + } + ], + "description": "Protect entities from being deleted if they are the target of an entity reference field.", + "homepage": "https://www.drupal.org/project/entity_reference_integrity", + "support": { + "source": "https://git.drupalcode.org/project/entity_reference_integrity" + } + }, { "name": "drupal/entity_reference_revisions", "version": "1.9.0", @@ -3221,6 +3269,74 @@ "source": "https://git.drupalcode.org/project/entity_reference_revisions" } }, + { + "name": "drupal/entity_usage", + "version": "2.0.0-beta3", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/entity_usage.git", + "reference": "8.x-2.0-beta3" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/entity_usage-8.x-2.0-beta3.zip", + "reference": "8.x-2.0-beta3", + "shasum": "cc115349eb533013ec672dadbe8cf0cd880bd8c4" + }, + "require": { + "drupal/core": "^8.8 || ^9" + }, + "require-dev": { + "drupal/block_field": "~1.0", + "drupal/dynamic_entity_reference": "~1.0", + "drupal/entity_browser": "~2.0", + "drupal/entity_browser_block": "~1.0", + "drupal/entity_embed": "~1.0", + "drupal/entity_reference_revisions": "~1.0", + "drupal/inline_entity_form": "^1.0@RC", + "drupal/paragraphs": "~1.0", + "drupal/webform": "~5.0" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "8.x-2.0-beta3", + "datestamp": "1585145909", + "security-coverage": { + "status": "not-covered", + "message": "Beta releases are not covered by Drupal security advisories." + } + }, + "drush": { + "services": { + "drush.services.yml": "^9" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "marcoscano", + "homepage": "https://www.drupal.org/user/1288796" + }, + { + "name": "seanB", + "homepage": "https://www.drupal.org/user/545912" + } + ], + "description": "Track usage of entities referenced by other entities", + "homepage": "https://www.drupal.org/project/entity_usage", + "keywords": [ + "Drupal" + ], + "support": { + "source": "http://cgit.drupalcode.org/entity_usage", + "issues": "http://drupal.org/project/issues/entity_usage" + } + }, { "name": "drupal/externalauth", "version": "1.4.0", @@ -15474,6 +15590,7 @@ "drupal/autocomplete_deluxe": 5, "drupal/better_formats": 20, "drupal/block_field": 5, + "drupal/entity_usage": 10, "drupal/flag": 10, "drupal/gin_login": 5, "drupal/gin_toolbar": 10, diff --git a/config/sync/core.extension.yml b/config/sync/core.extension.yml index 0db343afe..ae7241881 100644 --- a/config/sync/core.extension.yml +++ b/config/sync/core.extension.yml @@ -17,7 +17,10 @@ module: dynamic_page_cache: 0 editor: 0 entity_print: 0 + entity_reference_integrity: 0 + entity_reference_integrity_enforce: 0 entity_reference_revisions: 0 + entity_usage: 0 facets: 0 field: 0 field_group: 0 diff --git a/config/sync/entity_reference_integrity_enforce.settings.yml b/config/sync/entity_reference_integrity_enforce.settings.yml new file mode 100644 index 000000000..b15582370 --- /dev/null +++ b/config/sync/entity_reference_integrity_enforce.settings.yml @@ -0,0 +1,50 @@ +enabled_entity_type_ids: + media: media + action: '0' + search_api_autocomplete_search: '0' + base_field_override: '0' + block: '0' + comment: '0' + comment_type: '0' + node: '0' + language_content_settings: '0' + node_type: '0' + menu_link_content: '0' + date_format: '0' + os2loop_document_collection_item: '0' + entity_form_display: '0' + entity_view_display: '0' + facets_facet: '0' + facets_facet_source: '0' + field_config: '0' + field_storage_config: '0' + file: '0' + flag: '0' + flagging: '0' + entity_form_mode: '0' + image_style: '0' + configurable_language: '0' + media_type: '0' + menu: '0' + message: '0' + message_template: '0' + paragraph: '0' + paragraphs_type: '0' + pathauto_pattern: '0' + print_engine: '0' + rest_resource_config: '0' + user_role: '0' + search_api_index: '0' + search_api_server: '0' + search_api_task: '0' + taxonomy_term: '0' + taxonomy_vocabulary: '0' + editor: '0' + filter_format: '0' + theme_switcher_rule: '0' + path_alias: '0' + user: '0' + view: '0' + entity_view_mode: '0' +_core: + default_config_hash: 8gwG5hTvIhM_TZyyG2_Vdl7g63M1Rp8-t4jtTcE2vdk diff --git a/config/sync/entity_usage.settings.yml b/config/sync/entity_usage.settings.yml new file mode 100644 index 000000000..e1079b67c --- /dev/null +++ b/config/sync/entity_usage.settings.yml @@ -0,0 +1,26 @@ +track_enabled_base_fields: false +local_task_enabled_entity_types: + - media +usage_controller_items_per_page: 25 +_core: + default_config_hash: AXUBMTvVtpcNp0jKjDaWjSHqMy6HjuUf7j4yVbXgazI +track_enabled_source_entity_types: + - comment + - node + - user +track_enabled_target_entity_types: + - media + - user +edit_warning_message_entity_types: { } +delete_warning_message_entity_types: { } +track_enabled_plugins: + - dynamic_entity_reference + - media_embed + - link + - linkit + - layout_builder + - entity_reference + - entity_embed + - html_link + - block_field +site_domains: { } diff --git a/config/sync/user.role.os2loop_user_administrator.yml b/config/sync/user.role.os2loop_user_administrator.yml index 1580ca64e..3d2257103 100644 --- a/config/sync/user.role.os2loop_user_administrator.yml +++ b/config/sync/user.role.os2loop_user_administrator.yml @@ -20,6 +20,7 @@ permissions: - 'access content' - 'access content overview' - 'access contextual links' + - 'access entity usage statistics' - 'access media browser' - 'access media overview' - 'access own authorizations' @@ -82,6 +83,7 @@ permissions: - 'create os2loop_post content' - 'create os2loop_question content' - 'create os2loop_section_page content' + - 'create terms in os2loop_media_library' - 'create terms in os2loop_profession' - 'create terms in os2loop_subject' - 'create url aliases' @@ -116,6 +118,7 @@ permissions: - 'delete own os2loop_question content' - 'delete own os2loop_section_page content' - 'delete revisions' + - 'delete terms in os2loop_media_library' - 'delete terms in os2loop_profession' - 'delete terms in os2loop_subject' - 'delete terms in os2loop_tag' @@ -144,6 +147,7 @@ permissions: - 'edit own os2loop_post content' - 'edit own os2loop_question content' - 'edit own os2loop_section_page content' + - 'edit terms in os2loop_media_library' - 'edit terms in os2loop_profession' - 'edit terms in os2loop_subject' - 'edit terms in os2loop_tag' diff --git a/config/sync/views.view.media.yml b/config/sync/views.view.media.yml index b44e43380..cafcb931e 100644 --- a/config/sync/views.view.media.yml +++ b/config/sync/views.view.media.yml @@ -9,6 +9,7 @@ dependencies: - image.style.thumbnail - taxonomy.vocabulary.os2loop_media_library module: + - entity_usage - image - media - taxonomy @@ -634,6 +635,63 @@ display: entity_type: media entity_field: changed plugin_id: field + count: + id: count + table: entity_usage + field: count + relationship: media_to_usage_entity + group_type: group + admin_label: '' + label: 'Usage count' + exclude: false + alter: + alter_text: false + text: '' + make_link: false + path: '' + absolute: false + external: false + replace_spaces: false + path_case: none + trim_whitespace: false + alt: '' + rel: '' + link_class: '' + prefix: '' + suffix: '' + target: '' + nl2br: false + max_length: 0 + word_boundary: true + ellipsis: true + more_link: false + more_link_text: '' + more_link_path: '' + strip_tags: false + trim: false + preserve_tags: '' + html: false + element_type: '' + element_class: '' + element_label_type: '' + element_label_class: '' + element_label_colon: true + element_wrapper_type: '' + element_wrapper_class: '' + element_default_classes: true + empty: '' + hide_empty: false + empty_zero: false + hide_alter_empty: true + set_precision: false + precision: 0 + decimal: . + separator: '' + format_plural: false + format_plural_string: !!binary MQNAY291bnQ= + prefix: '' + suffix: '' + plugin_id: numeric operations: id: operations table: media @@ -1034,6 +1092,16 @@ display: entity_type: media entity_field: uid plugin_id: standard + media_to_usage_entity: + id: media_to_usage_entity + table: media + field: media_to_usage_entity + relationship: none + group_type: group + admin_label: 'Usage information (Media)' + required: false + entity_type: media + plugin_id: standard arguments: { } display_extenders: { } filter_groups: From 3c87e2a19416dfaa62d3b3e2e321eba3d0ac65eb Mon Sep 17 00:00:00 2001 From: martinyde Date: Wed, 14 Jul 2021 09:49:17 +0200 Subject: [PATCH 2/2] LOOP-999: Removed permissions --- config/sync/user.role.os2loop_user_administrator.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/config/sync/user.role.os2loop_user_administrator.yml b/config/sync/user.role.os2loop_user_administrator.yml index 3d2257103..a8038aa92 100644 --- a/config/sync/user.role.os2loop_user_administrator.yml +++ b/config/sync/user.role.os2loop_user_administrator.yml @@ -83,7 +83,6 @@ permissions: - 'create os2loop_post content' - 'create os2loop_question content' - 'create os2loop_section_page content' - - 'create terms in os2loop_media_library' - 'create terms in os2loop_profession' - 'create terms in os2loop_subject' - 'create url aliases' @@ -118,7 +117,6 @@ permissions: - 'delete own os2loop_question content' - 'delete own os2loop_section_page content' - 'delete revisions' - - 'delete terms in os2loop_media_library' - 'delete terms in os2loop_profession' - 'delete terms in os2loop_subject' - 'delete terms in os2loop_tag' @@ -147,7 +145,6 @@ permissions: - 'edit own os2loop_post content' - 'edit own os2loop_question content' - 'edit own os2loop_section_page content' - - 'edit terms in os2loop_media_library' - 'edit terms in os2loop_profession' - 'edit terms in os2loop_subject' - 'edit terms in os2loop_tag'