Closed (fixed)
Project:
Group
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
18 Mar 2019 at 15:32 UTC
Updated:
26 Jun 2019 at 10:14 UTC
Jump to comment: Most recent, Most recent file
Follow-up to #3026897: [META] Centralize all permission calculations/operations
We should only pass around pure value objects of group permissions once the permission building has taken place. In order to do this, we should introduce a new, refinable object that can be used to spawn an immutable object. In order to make sure we can allow these permissions to be properly altered, we should use a tagged service and move the existing implementation into services with said tag as a proof of concept.
Need to update this CR: https://www.drupal.org/node/3035038
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | interdiff-10-12.txt | 1.84 KB | kristiaanvandeneynde |
| #13 | group-3041087-12.patch | 98.98 KB | kristiaanvandeneynde |
Comments
Comment #2
kristiaanvandeneyndeThis introduces the tagged service, the refinable object, moves logic to services and allows permissions to be altered with said services. Needs a CR to indicate that permissions can now be altered.
Comment #3
kristiaanvandeneyndeWow, green on the first try! Now to edit the CR here: https://www.drupal.org/node/3041094
Comment #4
ronaldtebrake commentedNice work!
Functionally tested multiple scenarios all pass very nicely.
- Added new group types
- Changed permissions for roles
- Changed roles on group members
All had the desired effect on the access of the group and it's entities.
A couple of tiny nitpicks but other than that works like a charm.
We'd be better of not using array_merge in this loop. Using that in a loop could be very costly.
Similar as the above
$group_typeseems to be an unused variable.Will leave it at needs review for now, can imagine others are keen to test this out as well.
Comment #5
kristiaanvandeneyndeThanks for the review! Leaving this open until next week for reviews to come in. I'd also like to clean up the chain calculator because it reuses about 95% the same code 3 times.
Comment #6
kristiaanvandeneyndeA second pass through the gathered permission to allow for altering might be interesting as well. That would make it easier for people who already want global roles to persist after joining a group (which will be the default in 8.2.0).
Comment #7
kristiaanvandeneyndeLet's get rid of the half-baked cache context logic and polish up #2551419: Abstract RenderCache into a separate service that is capable of cache redirects in a non-render array-specific way and use it to wrap the cache backends we're using. Then we can simply read out the cache contexts from the calculated permissions, which we'll need to add in the calculators.
Comment #8
kristiaanvandeneyndeThis does not take into account the suggestions from #4 yet, but simply introduces the new caching system.
Comment #9
kristiaanvandeneyndeThis takes care of the notes from #4 and adds the most recent VariationCache work from core.
Comment #10
kristiaanvandeneyndeMinor fix, also concerned about the composer error.
Comment #12
jonathanshawD8.8 requires php7? Maybe need to fix the projects drupal-ci yml
Comment #13
kristiaanvandeneyndeComment #14
kristiaanvandeneynde@jonathanshaw Thanks. I fixed it by going into my project page's Automated Testing tab and removing some tests there.
Comment #16
kristiaanvandeneyndeFixed, we need this now and simply can't wait for core any longer. Committed with copies of classes that should eventually make it into core.