Problem/Motivation
I believe because of the way Groups handles access control, even if you generate an access token for a piece of Group content, Groups isn't aware of this it will deny access. In my testing I could not get access_unpublished to work for any content which belongs to a group.
Steps to reproduce
Install Group, Group Node, and Access Unpublished. Setup a Group Type, and add allow content type to it. Create group content of that type. Create a link with Access Unpublished - it will result in Access Denied.
Proposed resolution
I think Group's access control model needs to be extended per documentation at https://www.drupal.org/docs/contributed-modules/group/extending-groups-a.... In that overridden access control handler, it will need to check with access_unpublished_entity_access and use that as the access result. I have implemented this as a proof of concept - will submit a PR on drupalcode.
Remaining tasks
Code review - especially permissions handling. Test coverage.
User interface changes
The proof of concept adds group level permissions so access_unpublished can be allowed per group type and group role.
API changes
N/A
Data model changes
N/A
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | access_unpublished-3280964-support-group-content-MR-6--comment-9--20230113.patch | 8.65 KB | recrit |
Issue fork access_unpublished-3280964
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
craigperks commented@msielski,
I don't suppose you managed to resolve this issue did you? I've run into exactly the same issue as the one you described above.
Comment #3
msielski@craigperks, yes I did - I'll clean it up and post the code this evening.
Comment #5
msielskiComment #6
recrit commentedAdded a static patch of msielski's MR6 as of 2023-01-10 so that builds can use it without breaking on any future changes to the patch.
Comment #7
recrit commentedupdated static patch with latest updates to the MR
Comment #8
recrit commentedNote on the current implementation: After changing the group permissions to allow new content types, you must clear the Drupal cache to rebuild the plugin info for "group_content_info" since it checks for the permission in the "hook_group_content_info_alter".
Comment #9
recrit commentedupdated the static patch with latest MR updates
Comment #10
recrit commentedNote: Any patch in this issue depends on Group 1.x version since 2.x+ changes the hook to "hook_group_relation_type_alter"
Comment #11
dabbor commentedI've created a related ticket: "Support Group 2.x content" https://www.drupal.org/project/access_unpublished/issues/3405874 to adapt the solution to work with Group 2.x which was a significant modification.
I provided new MR in that new related issue + patch and interdiff in my comment: https://www.drupal.org/project/access_unpublished/issues/3405874#comment...
Comment #12
damienmckennaThere's a patch and merge request, so let's update the status.
Comment #13
bilele123123 commentedMay I ask if anyone is running into this error?
Comment #15
mably commentedPushed to the 1.x branch of the newly created contrib module:
https://www.drupal.org/project/access_unpublished_group