When I give a role only permission to create a node inside the group but not relate existing content to the group, I get an empty page when trying to add new content to the group via the "+ Create node" link.
The link routes to group/1/node/create
which is an empty page. If I go manually to e.g. group/1/node/create/content_page
it works just fine.
I think for some reason the GroupNodeAddAccessCheck
is not used when checking for access inside GroupNodeWizardController::addPage
but I didn't dig deeper into the problem. Can you help?
Using Drupal 8.2.3 and the latest dev of the Group module.
Comment | File | Size | Author |
---|---|---|---|
#40 | group-2842630-40-v3.patch | 1.67 KB | kristiaanvandeneynde |
#40 | group-2842630-40-v2.patch | 1.66 KB | kristiaanvandeneynde |
Issue fork group-2842630
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
kristiaanvandeneyndeThis should be resolved as part of #2819595: provide a generic and extensible UI for adding new content into a Group. Please confirm and close this issue if it is.
Comment #3
Agence Web CoherActio CreditAttribution: Agence Web CoherActio commentedHello,
I've installed Group 8.x-1.0-beta5 and unfortunately the issue is still there.
Any idea on how to fix this?
Thanks
Laurent
Comment #4
kristiaanvandeneyndeCan you provide steps to reproduce? Preferably on a clean environment such as a simplytest.me instance.
Comment #5
beeyayjay CreditAttribution: beeyayjay commentedI'm seeing the same problem, using version 8.x-1.0-rc1.
Steps to reproduce:
1. Create new group type with default settings.
2. Install 'Group node (Basic page)' with default settings.
3. Give members 'Access group node overview' and all 'Group node (Basic page) - Entity: ...' permissions.
4. Create an authenticated user and add as member.
5. Log in as the authenticated user and go to /group/1/nodes.
6. Click the "+ Create Node" button.
This takes you to /group/1/node/create, with title "Create Node" and no content.
Note that the "Create Basic Page" button in the Group Operations block on /group/1/nodes works fine, linking to group/1/content/create/group_node:page.
Thanks for a great module!
Comment #6
maaty388 CreditAttribution: maaty388 commentedI think I just found where is maybe a problem
If you enable permission for this group type
Group content (Basic page) - Relationship: Add entity relation
Then you get a form and create content, but If you disable it you just get a blank page.
Comment #7
Chris Gillis CreditAttribution: Chris Gillis commentedI can confirm #6.
Comment #8
blakemorgan CreditAttribution: blakemorgan at Brigham Young University commentedI can confirm this issue on my own site and on simplytest.me using rc2. As stated in #5, clicking the "Create Basic Page" button in the sidebar works fine. The issue is when clicking the "+ Add node" button on the group/#/node page.
Simplytest.me:
https://davu.ply.st
Username: user1
Password: user1
#6 also worked for me as a temporary fix.
Comment #9
MXTI can confirm this issue. Same as #6 and #7.
Please fix this!
Comment #10
mike.mcdonald CreditAttribution: mike.mcdonald commentedI can confirm that #6 has isolated the issue. The access check for this particular page is looking for permission to create group content, while there is a separate permission to create entities in the group. I think it is the intended functionality of the page to allow for easy creation of new entities related to the group, not the group content entities that relate content to a group,
My patch changes the query made for the access check to see if the user can create entities in the group instead of just the group content relationship entity.
Comment #11
cainaruI'm using Group 8.x-1.0-rc2 and can confirm both #6 and #7. Will plan to give the patch in #10 a shot.
Comment #12
baikhoMarking as Needs review
Comment #13
kristiaanvandeneyndeCool, thanks for finding this problem and a fix everyone! Could someone be so kind to write a basic browser test (extend the GroupBrowserTestBase class) to prove that this patch fixes the problem?
Comment #14
joshuamiWell shoot. When we applied @mike.mcdonald's patch, we did not initially notice that it causes an issue with group membership. (We can no longer add a member from the members page.)
I think it is the correct direction, but we can't use
createEntityAccess
as users and the members relationship doesn't act as a normal entity.Marking as "needs work" and will do a little refactoring of the patch.
Comment #15
mike.mcdonald CreditAttribution: mike.mcdonald commentedThe initial patch did cause issues with more group content types than are at issue here, specifically membership, as @joshuami pointed out in #14. So, a fix needs to be handled on more specific access checks on individual content types.
There are two patches here. One adds an override of createAccess on the gnode-specific GroupContentEnabler to check for entity creation permissions for the group rather than the default content relationship. The other patch does the same for those that are using the patch that adds group media content here: https://www.drupal.org/files/issues/2018-07-24/2984315-3.patch
I did some QA to test for the issue regarding group membership and I can attempt to write a test case, but I'm really unfamiliar with Drupal and PHP testing, so it'll probably take a while for me to do that, in case anyone else is more capable in that realm.
Comment #17
mbovan CreditAttribution: mbovan at MD Systems GmbH commentedThis seems to allow access to Create as well as Relate pages now:
/group/%/content/add/group_node:[node-type]
Comment #18
Kevin W CreditAttribution: Kevin W as a volunteer commentedAdd a patch file for people using the GroupMedia module.
Update: posted to the wrong issue queue.
Comment #19
Kevin W CreditAttribution: Kevin W as a volunteer commentedComment #20
mbovan CreditAttribution: mbovan at MD Systems GmbH commentedI am providing a patch that solves a problem of #17 as well as the one mentioned in the issue summary.
It works as following:
- In order to access
group/%/content/create
page, a user needscreate $plugin_id entity
permission- In order to access
group/%/content/add
page, a user needscreate $plugin_id content
permission@joshuami Could you please test this patch with your use-case mentioned in #14?
Comment #21
James Marks CreditAttribution: James Marks commentedI've implemented a temporary workaround to this bug by giving group members the permission to relate existing content but then using hook_block_view_alter to unset $build['content']['group_content.group_node_relate_page'] to hide the button from them. It's a hack but it temporarily solves the problem for me.
Any idea when the fix in #20 will be rolled into the stable version?
Comment #22
harcher CreditAttribution: harcher commentedI'm on 8.x-1.0-rc5
I can't believe that this issue still exists in the latest version. Is there a fix?
Thanks btw for a great module.
Comment #23
metakel CreditAttribution: metakel commentedGo to Groups > Group types > Click "Edit permissions" at "Operations".
Under EACH Group node type, check the box for Member for the item "Relationship: Add entity relation Allows you to add an existing content entity to the group."
Then no longer empty page at "Add new content"
Comment #24
KarlSheaBut I don't want them to be able to add existing content—that's what this patch is fixing.
Comment #25
markdcThanks for #20. It works as advertised.
Comment #26
pankaj.singh CreditAttribution: pankaj.singh as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedTested the patch given in #20 on 8.9.
It works and fixes the issue reported. Please find the SS attached for ref. RTBC+1
Comment #27
miroslav-leeIt works for me. Thanks.
Comment #28
idebr CreditAttribution: idebr at iO commentedThe maintainer commented in #13 this needs an automated test before it is committed.
Comment #29
Kojo Unsui CreditAttribution: Kojo Unsui commentedThis bug is still present in 1.3 version. I confirm patch #20 solves it. Thanks everybody !
Comment #30
kristiaanvandeneyndeAs already stated 3 years ago, could someone please write a browser test that visits both pages with a handful of scenarios?
With A and B being the permissions from the latest patch.
Comment #31
amaisano CreditAttribution: amaisano commentedBug is still present in 1.4 as well. Patch #20 resolves this as well.
Does it have to do with only having a single gnode plugin enabled? I assume if there are multiple content types enabled for the group type, the add new button would navigate you to a page with additional links for each content type.
Comment #34
MacSim CreditAttribution: MacSim at Spiriit commentedCreated a merge request with patch #20 + functional tests requested in #30
Comment #35
MacSim CreditAttribution: MacSim at Spiriit commentedAfter applying the patch #20:
Comment #36
MacSim CreditAttribution: MacSim at Spiriit commentedComment #37
arlingtonvoicellc CreditAttribution: arlingtonvoicellc commentedThis issue persists in version 3.0.0-beta2 and effects the site administrator.
Repeatable with a fresh install of drupal + group module. Add content type as prescribed above and you get nothing on the "Add Content" page, but this applies to administrator, not just other users.
I looked at the patch and I don't see groupcontentcontroller.php in the module files for 3.0.0. Please advise.
Comment #38
MacSim CreditAttribution: MacSim at Spiriit commentedThis issue was opened for 1.x-dev branch. Patch in #20 does the job for this branch.
I added some tests that need to be reviewed and tested by the community before a merge could be done.
I guess we would need to open another issue related to the current issue for the branch 3.0.0-beta2 cause the patch provided in #20 and the tests I wrote would need to be updated.
Comment #39
travelerttCan confirm the issue exists in 3.0.0-beta3 as well. Blank screen on "Add Content" page with User with administrator role.
Comment #40
kristiaanvandeneyndeThis is indeed still present in 2.0.x and 3.0.x, the following code always checks for GroupRelationship create access, even though the add page should call the plugin's access control handler.
Moving to 2.0.x/3.0.x as 1.5 was the final version for the 8.x-1.x branch (bar security releases)
Comment #42
MacSim CreditAttribution: MacSim at Spiriit commentedComment #43
MacSim CreditAttribution: MacSim at Spiriit commentedMoving forward to 3.0.x in order to open a new MR
Comment #45
MacSim CreditAttribution: MacSim at Spiriit commentedComment #46
FiNeX CreditAttribution: FiNeX as a volunteer commentedHi @kristiaanvandeneynde, I've tried patch group-2842630-40-v2.patch on current Group v2, but it looks it's not working: the page is still empty. I'm using the group admin user which has all the permissions enabled.EDIT: I was trying on beta version, the -dev version (with the patch) works fine. Thank you.
Comment #47
FiNeX CreditAttribution: FiNeX as a volunteer commentedEDIT: just found it has been fixed on 2.x-dev version with the same method :-)
Comment #48
Rahaf Albawab CreditAttribution: Rahaf Albawab commentedI applied this patch group-2842630-40-v3.patch but the issue still exists in drupal 9.4.5 and group v3
Comment #49
DudeWeb CreditAttribution: DudeWeb commentedI confirm this bug. So apparently it only concerns the administrator? Hope to find a fix auickly. Thanks for that guys!
Comment #50
DudeWeb CreditAttribution: DudeWeb commentedFor info, I installed a brand new Drupal locally, installed Groups module, activated the 2 modules, created a group type and a group. Configured the entities that can be related to this group type (Article) and I have a webpage on this URL: group/1/node/create.
I willl have a look to see if it is different when you are not admin of the website.
Good news: it is not related to my original installation on my other project ;-)
Enjoy your day!
Comment #51
DudeWeb CreditAttribution: DudeWeb commentedThe block group actions does not show as well. Surely it is related to the bug.
Comment #52
DudeWeb CreditAttribution: DudeWeb commentedI just tried to create a group with a second user: no possibility to create content either.
Comment #53
DudeWeb CreditAttribution: DudeWeb commentedI confirm changing line 191 (see #47):
// Check the base plugin ID if a plugin filter was specified.
if ($base_plugin_id && $relation->getBaseId() !== $base_plugin_id) {
unset($relationship_types[$relationship_type_id]);
does the job!
Many thx to https://www.drupal.org/u/finex
Comment #54
ultimikeAgreed.
Also - this issue is related: https://www.drupal.org/project/group/issues/3317459
-mike
Comment #55
DudeWeb CreditAttribution: DudeWeb commentedAnd now, when I wanna create a group, it does not... I really need this on 3 projects ;-(
Comment #56
interactivex CreditAttribution: interactivex at Ramsalt Lab commentedI have the same problem. I have installed three content types as group nodes for a group type. I gave the permissions, but if I go to the Create content page as group admin (/group/1/node/create) it shows nothing. I'm running Drupal 9.4.8 and Group module 3.0.0-beta3
Comment #57
kristiaanvandeneyndeOkay so I thought I had already committed the patch from #40 but it seems that's not the case. I'll commit it soon and then people should try the latest dev to see if things are working.
Comment #59
kristiaanvandeneyndeAll the comments were either already fixed in dev or fixed by this patch. Closing as fixed for now.
Comment #61
MacSim CreditAttribution: MacSim at Spiriit commentedHmm actually you didn't merged the functional tests I wrote to cover this use case. I'll have to rebase the branches but to me it's not fixed until the tests are merged.