Problem/Motivation

In a scenario where we have different user roles that can administer (create/edit/delete) the same content types but want to manage grant permissions separate for each content type.

For example:

  1. user_role1 administer content_type1 and content_type2
  2. user_role2 administer content_type1 and content_type2
  3. user_role1 just can has grant permissions to content_type1
  4. user_role2 just can has grant permissions to content_type2

Proposed resolution

Improve grant permissions for node types by user role and that needs create an specific grant permissions for each node type.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nachosalvador created an issue. See original summary.

nachosalvador’s picture

Assigned: nachosalvador » Unassigned
Status: Active » Needs review
Issue tags: +Needs subsystem maintainer review
FileSize
2.42 KB
nachosalvador’s picture

Issue summary: View changes
jungle’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
Status: Needs review » Needs work
Issue tags: -Needs subsystem maintainer review +Needs reroll
Parent issue: » #3317693: [Meta] 2.0.x branch
+++ b/src/NodePermissions.php
@@ -0,0 +1,36 @@
+    foreach (NodeType::loadMultiple() as $node_type) {

Use DI

jungle’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
3.62 KB
jungle’s picture

FileSize
3.74 KB
1.33 KB
+++ b/src/NodeGrantPermissions.php
@@ -0,0 +1,62 @@
+      $permissions["nodeaccess grant $node_type_id permissions"] = [

Explain why to add this prefix nodeaccess

* Prefix `nodeaccess` to avoid conflicting with `grant node permissions`,
* Without the prefix, if the content type is `node`, the same permission as
* `grant node permissions` will be returned here.

  • jungle committed 6cf7e46 on 2.0.x
    Issue #3164991 by jungle, nachosalvador: Grant permissions by node type
    
jungle’s picture

Status: Needs review » Fixed

Committed to the 2.0.x branch. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.