Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
user.module
Priority:
Major
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
28 Aug 2014 at 23:30 UTC
Updated:
2 Oct 2014 at 08:30 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
damiankloip commentedHere is an initial patch:
- Adds support for the permission_callbacks key. Merging these with the static permissions separately. We can then make sure static permissions run strings through t() and dynamic ones do not. I think this is what we want?
- Conversion for node module
- Quick test coverage
It all likely still needs work, but this is a start. Reviews welcome.
Comment #3
damiankloip commentedAdded another test method to test a permissions file with a static permission and a callback. Fixed
KernelTestBaseTestfailure.Comment #5
dawehnerIt is looking great so far!
You don't need quotes for the keys ... see #2328411: Convert all permissions to yml files and permission callbacks
yeah you also don't need keys here.
oh, this feels wrong to be honest. we do have traits for t() and url(), in general.
webchick and I talked about that and considered this to be an edge case. If it would be really needed we thought of allowing twig inline templates here
I really hate that these test fails
can't you just use $callback()? Afaik ['class', 'method']() works
Comment #6
damiankloip commentedThanks for the review.
1. Fixed
2. Fixed
3. Yeah :) That was a hack that I did last night and forgot to implement properly! Fixed.
4. That sounds like a nice idea, we can get a follow up for that one.
5. Yeah, that is not a cool fail. It's quite a strange test though tbh. Depending on a test module is better than node though IMO. So I think this is an improvement too.
6. That is cool, but let's not do that right now. Plus my IDE doesn't like it.
Comment #7
dawehnerIf you convert all other permissions, as done in my other issue, you will see that there are even more places where this happens to break. There are quite some implementation
details in the kernel test base.
Comment #8
dawehnerI am fine with the patch at it is. We have to work on additional issue anyway.
@damiankloip
Did you thought of a chance record?
Comment #9
damiankloip commentedI will update https://www.drupal.org/node/2311427 to reflect this. I think that is best?
Comment #10
claudiu.cristeaI don't like that
permission_callbacksshares the same level as static permission keys. I think we should avoid this possible confusion. Possible structure:Comment #11
dawehner@claudiu.cristea
We do have a similar structure on the routing.yml already, so there is no reason to change this here.
@damiankloip
Yes this is the best.
Comment #12
damiankloip commentedAgree, changing that here is not an option IMO. This makes the regular use case slightly more complex (yes, not much) and if we changed that, we would have to change routing.yml structure too. Which seems like a no go at this stage.
Comment #13
dawehnerLet's get this one in first.
Comment #14
damiankloip commentedCool. Just to clarify our plan - Let's update the change notice when this is just about to/has just been committed. Otherwise we will have a change notice published that has functionality not in HEAD yet.
Comment #15
tim.plunkett+1 for RTBC, this matches the dynamic code in RouteBuilder and looks great.
Comment #17
dawehnerQuick rebase
Comment #18
alexpottLet's move all of node_list_permissions() into NodePermissions::nodeTypePermissions() - this is the only usage.
Need to update doc block for new param.
Comment #19
damiankloip commentedGood points Alex. Here is an updated patch.
Comment #20
dawehnerOkay, cool
Comment #22
alexpottCommitted bd8cb79 and pushed to 8.0.x. Thanks!
Can someone update the CR https://www.drupal.org/node/2311427 and link this issue. Thanks.
Comment #23
geerlingguy commentedSetting to needs work until change record is updated... https://www.drupal.org/node/2311427
Comment #24
dawehnerUpdated.