Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite kernel tests to functional tests for failing testGetPermissions() #427

Open
finnlewis opened this issue Oct 2, 2023 · 8 comments
Assignees

Comments

@finnlewis
Copy link
Member

See https://github.com/localgovdrupal/localgov_microsites_group/blob/2.x/tests/src/Kernel/GroupPermissionsHelperTest.php#L141

#396 (comment)

This is the test that is failing:
https://github.com/localgovdrupal/localgov_microsites_group/blob/2.x/tests/src/Kernel/GroupPermissionsHelperTest.php#L141

Can anyone re-write this test to test in a different way? @ekes was wondering if maybe a functional browser test to do the same thing might be appropriate?

@millnut might be able to look at this 😄

@finnlewis
Copy link
Member Author

@ekes and @millnut I've just been testing the group content permissions in the browser and I'm getting some funny results.

Fresh install
composer create-project localgovdrupal/localgov_microsites_project:3.x-dev MY_PROJECT --no-install;

  1. Create microsites controller user
  2. Create a microsite admin user
  3. Create a microsite
  4. Assign admin user to microsite 1
  5. On another browser, log into microsite 1 as admin1 https://localgov-micro-1.lndo.site/user/login
  6. Create content at https://localgov-micro-1.lndo.site/group/1/node/create
  7. See blog post:
  8. https://localgov-micro-1.lndo.site/group/1/content/create/group_node%3Alocalgov_blog_post

Now then...

  1. Go back to the control site logged in as user 1.
  2. Edit group type permissions: https://localgov-micro.lndo.site/admin/group/types/manage/microsite/permissions
  3. Remove all permissions for blog posts and channels from 'Member' and 'Admin' roles
  4. Save
  5. Clear cache

image

Expected behaviour: the admin1 user on site1 should not be able to create blog posts.

Observed behaviour: the admin1 user on site1 CAN create blog posts.

@finnlewis
Copy link
Member Author

Further to this... I've tried the group settings where we have the ability to enable and disable content types for each group, and this does not appear to have any effect either:

image

@finnlewis
Copy link
Member Author

@hc-konrad follow this issue for udates!

@xtianjohnson
Copy link

@xtianjohnson following for updates.

@ekes
Copy link
Member

ekes commented Oct 12, 2023

Manual testing core D10 + group + group_permissions.

Granting group_permissions to a role any group seems to effect all the groups (at least that the user is a member of).

So far so... there's certainly a thing going on between group + group_permissions at the moment that's not specific to localgov microsites.

@millnut
Copy link
Member

millnut commented Oct 14, 2023

Thanks for digging into this more @ekes it looks like we have ended up on the conclusion with it being group_permissions, do you think it's worth adding that as a note to https://www.drupal.org/project/group_permissions/issues/3388880

@ekes
Copy link
Member

ekes commented Oct 20, 2023

https://www.drupal.org/project/group_permissions/issues/3395306

The test certainly confirms the cache clear issue, but also if I'm correct shows removal of permissions failing again.

@ekes
Copy link
Member

ekes commented Oct 20, 2023

I'll be honest here. My temptation is now to remove group_permissions and use custom entity access to set if content can be created - it will then always be possible to be viewed if it has been created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants