Browse Source

field permissions

bach 4 months ago
parent
commit
1e161928e2

+ 1 - 0
composer.json

@@ -26,6 +26,7 @@
         "drupal/core-composer-scaffold": "^10.1",
         "drupal/core-project-message": "^10.1",
         "drupal/core-recommended": "^10.1",
+        "drupal/field_permissions": "^1.3",
         "drupal/image_delta_formatter": "^1.2",
         "drupal/image_field_caption": "^2.0",
         "drupal/linked_field": "^1.5",

+ 65 - 1
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": "b28b2f01a57c974a270eff443e2a36f5",
+    "content-hash": "2d3c845404e0f68351dfe3c7c862a54e",
     "packages": [
         {
             "name": "asm89/stack-cors",
@@ -4392,6 +4392,70 @@
                 "issues": "https://www.drupal.org/project/issues/field_group"
             }
         },
+        {
+            "name": "drupal/field_permissions",
+            "version": "1.3.0",
+            "source": {
+                "type": "git",
+                "url": "https://git.drupalcode.org/project/field_permissions.git",
+                "reference": "8.x-1.3"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://ftp.drupal.org/files/projects/field_permissions-8.x-1.3.zip",
+                "reference": "8.x-1.3",
+                "shasum": "f3815d21b423c94e800388f3c29237fc1a00189d"
+            },
+            "require": {
+                "drupal/core": ">=8.9 <11"
+            },
+            "type": "drupal-module",
+            "extra": {
+                "drupal": {
+                    "version": "8.x-1.3",
+                    "datestamp": "1703264421",
+                    "security-coverage": {
+                        "status": "covered",
+                        "message": "Covered by Drupal's security advisory policy"
+                    }
+                },
+                "branch-alias": {
+                    "dev-8.x-1.x": "1.x-dev"
+                }
+            },
+            "notification-url": "https://packages.drupal.org/8/downloads",
+            "license": [
+                "GPL-2.0-or-later"
+            ],
+            "authors": [
+                {
+                    "name": "japerry",
+                    "homepage": "https://www.drupal.org/user/45640"
+                },
+                {
+                    "name": "jhedstrom",
+                    "homepage": "https://www.drupal.org/user/208732"
+                },
+                {
+                    "name": "mariacha1",
+                    "homepage": "https://www.drupal.org/user/2210776"
+                },
+                {
+                    "name": "markus_petrux",
+                    "homepage": "https://www.drupal.org/user/39593"
+                },
+                {
+                    "name": "RobLoach",
+                    "homepage": "https://www.drupal.org/user/61114"
+                }
+            ],
+            "description": "The Field Permissions module allows site administrators to set field-level permissions to edit, view and create fields on any entity.",
+            "homepage": "https://www.drupal.org/project/field_permissions",
+            "support": {
+                "source": "https://git.drupalcode.org/project/field_permissions",
+                "issues": "https://www.drupal.org/project/issues/field_permissions"
+            }
+        },
         {
             "name": "drupal/file_mdm",
             "version": "2.6.0",

+ 1 - 0
config/sync/core.extension.yml

@@ -55,6 +55,7 @@ module:
   entity_reference_revisions: 0
   field: 0
   field_group: 0
+  field_permissions: 0
   field_ui: 0
   file: 0
   filter: 0

+ 4 - 0
config/sync/field.storage.node.field_dossiers.yml

@@ -4,8 +4,12 @@ status: true
 dependencies:
   module:
     - entity_reference_revisions
+    - field_permissions
     - node
     - paragraphs
+third_party_settings:
+  field_permissions:
+    permission_type: custom
 id: node.field_dossiers
 field_name: field_dossiers
 entity_type: node

+ 16 - 0
config/sync/login_destination.destination.collaborateur_to_home.yml

@@ -0,0 +1,16 @@
+uuid: f64b6ffa-32cc-4cae-92eb-3095c00fa7e7
+langcode: fr
+status: true
+dependencies: {  }
+name: collaborateur_to_home
+label: 'Collaborateur to home'
+triggers:
+  login: login
+destination_path: 'internal:/'
+pages_type: 0
+pages: ''
+language: ''
+roles:
+  collaborateur: collaborateur
+weight: -9
+enabled: true

+ 1 - 1
config/sync/login_destination.destination.login_to_all_operations.yml

@@ -13,5 +13,5 @@ language: ''
 roles:
   admin: admin
   editor: editor
-weight: 0
+weight: -10
 enabled: true

+ 1 - 1
config/sync/login_destination.destination.login_to_operations.yml

@@ -12,5 +12,5 @@ pages: ''
 language: ''
 roles:
   authenticated: authenticated
-weight: 0
+weight: -8
 enabled: true

+ 1 - 1
config/sync/login_destination.destination.register_to_create_operation.yml

@@ -12,5 +12,5 @@ pages: ''
 language: ''
 roles:
   authenticated: authenticated
-weight: 0
+weight: -7
 enabled: false

+ 4 - 0
config/sync/user.role.admin.yml

@@ -14,6 +14,7 @@ dependencies:
     - config_pages
     - content_lock
     - content_translation
+    - field_permissions
     - file
     - filter
     - menu_admin_per_menu
@@ -40,6 +41,7 @@ permissions:
   - 'change own username'
   - 'create actualite content'
   - 'create content translations'
+  - 'create field_dossiers'
   - 'create ressource content'
   - 'create site content'
   - 'delete any actualite content'
@@ -55,6 +57,7 @@ permissions:
   - 'edit any site content'
   - 'edit any static content'
   - 'edit contact config page entity'
+  - 'edit field_dossiers'
   - 'edit mentions_legales config page entity'
   - 'edit own actualite content'
   - 'edit own ressource content'
@@ -84,6 +87,7 @@ permissions:
   - 'use text format wysiwyg'
   - 'view actualite revisions'
   - 'view config_pages entity'
+  - 'view field_dossiers'
   - 'view ressource revisions'
   - 'view site revisions'
   - 'view static revisions'

+ 11 - 2
config/sync/user.role.collaborateur.yml

@@ -1,9 +1,18 @@
 uuid: d23378d0-3c03-4009-96b2-96b1221adbca
 langcode: fr
 status: true
-dependencies: {  }
+dependencies:
+  config:
+    - node.type.site
+  module:
+    - field_permissions
+    - node
 id: collaborateur
 label: Collaborateur
 weight: -4
 is_admin: null
-permissions: {  }
+permissions:
+  - 'create field_dossiers'
+  - 'edit any site content'
+  - 'edit own field_dossiers'
+  - 'view own field_dossiers'

+ 4 - 0
config/sync/user.role.editor.yml

@@ -12,6 +12,7 @@ dependencies:
     - actions_permissions
     - config_pages
     - content_lock
+    - field_permissions
     - filter
     - node
     - notify
@@ -30,6 +31,7 @@ permissions:
   - 'administer nodes'
   - 'break content lock'
   - 'create actualite content'
+  - 'create field_dossiers'
   - 'create ressource content'
   - 'create site content'
   - 'delete site revisions'
@@ -38,6 +40,7 @@ permissions:
   - 'edit any site content'
   - 'edit any static content'
   - 'edit contact config page entity'
+  - 'edit field_dossiers'
   - 'edit mentions_legales config page entity'
   - 'edit own actualite content'
   - 'edit own ressource content'
@@ -53,6 +56,7 @@ permissions:
   - 'revert static revisions'
   - 'use text format wysiwyg'
   - 'view actualite revisions'
+  - 'view field_dossiers'
   - 'view ressource revisions'
   - 'view site revisions'
   - 'view static revisions'

+ 69 - 3
config/sync/views.view.current_user_block.yml

@@ -532,6 +532,48 @@ display:
           group: 1
           expose:
             operator: ''
+        roles_target_id:
+          id: roles_target_id
+          table: user__roles
+          field: roles_target_id
+          relationship: none
+          group_type: group
+          admin_label: ''
+          entity_type: user
+          entity_field: roles
+          plugin_id: user_roles
+          operator: empty
+          value: {  }
+          group: 1
+          exposed: false
+          expose:
+            operator_id: ''
+            label: ''
+            description: ''
+            use_operator: false
+            operator: ''
+            operator_limit_selection: false
+            operator_list: {  }
+            identifier: ''
+            required: false
+            remember: false
+            multiple: false
+            remember_roles:
+              authenticated: authenticated
+            reduce: false
+          is_grouped: false
+          group_info:
+            label: ''
+            description: ''
+            identifier: ''
+            optional: true
+            widget: select
+            multiple: false
+            remember: false
+            default_group: All
+            default_group_multiple: {  }
+            group_items: {  }
+          reduce_duplicates: false
       style:
         type: default
       row:
@@ -558,13 +600,26 @@ display:
           field: area
           relationship: none
           group_type: group
-          admin_label: ''
+          admin_label: 'operations links'
           plugin_id: text
           empty: false
           content:
-            value: "<ul>\r\n<li><a href=\"/user/logout\">Déconnexion</a></li>\r\n<li><a href=\"/mes_operations\">Mes opérations</a></li>\r\n<li><a href=\"/node/add/operation?destination=/mes_operations\">Ajouter une opération</a></li>\r\n</ul>"
+            value: "<ul>\r\n<li class=\"mesoperations\"><a href=\"/mes_operations\">Mes opérations</a></li>\r\n<li class=\"addoperation\"><a href=\"/node/add/operation?destination=/mes_operations\">Ajouter une opération</a></li>\r\n</ul>"
             format: wysiwyg
           tokenize: false
+        area_1:
+          id: area_1
+          table: views
+          field: area
+          relationship: none
+          group_type: group
+          admin_label: 'logout link'
+          plugin_id: text
+          empty: true
+          content:
+            value: "<ul>\r\n<li><a href=\"/user/logout\">Déconnexion</a></li>\r\n</ul>"
+            format: restricted_html
+          tokenize: false
       display_extenders: {  }
     cache_metadata:
       max-age: -1
@@ -586,7 +641,18 @@ display:
     display_plugin: block
     position: 1
     display_options:
-      display_extenders: {  }
+      display_extenders:
+        matomo:
+          enabled: false
+          keyword_gets: ''
+          keyword_behavior: first
+          keyword_concat_separator: ' '
+          category_behavior: none
+          category_gets: ''
+          category_concat_separator: ' '
+          category_fallback: ''
+          category_facets: {  }
+          category_facets_concat_separator: ', '
     cache_metadata:
       max-age: -1
       contexts:

+ 1 - 1
web/themes/custom/reha/dist/css/bundle.css

@@ -639,7 +639,7 @@ header #block-reha-views-block-current-user-block-block-1 .connected .connected-
 header #block-reha-views-block-current-user-block-block-1 .connected .connected-full footer ul li:hover {
   background-color: #fdc300;
 }
-header #block-reha-views-block-current-user-block-block-1 .connected .connected-full footer ul li:last-of-type {
+header #block-reha-views-block-current-user-block-block-1 .connected .connected-full footer ul li.addoperation {
   display: none;
 }
 

+ 5 - 2
web/themes/custom/reha/scss/partials/_header.scss

@@ -397,8 +397,11 @@ header{
                             }
 
                             ///// arrêt candidatures phase 1
-                            li:last-of-type{
-                               display: none;
+                            // li:last-of-type{
+                            //    display: none;
+                            // }
+                            li.addoperation{
+                                display: none;
                             }
                             /////////////
                         }