Comments

benjy created an issue. See original summary.

benjy’s picture

Status: Active » Needs review
StatusFileSize
new1.07 KB
sophie.sk’s picture

Status: Needs review » Needs work

The patch works really nicely and applied cleanly. It's a bit untidy (think there could be a cleaner way of doing it) and still needs tests, though, so marking as needs work.

benjy’s picture

It's a bit untidy (think there could be a cleaner way of doing it)

Can you put forward the cleaner approach?

sophie.sk’s picture

Anything that doesn't include preg_match and sprintf :D

It makes sense and it works, it just looks a little messy, especially without any comments. (Plus line length, etc.)

If I get a chance at some point, I can take a look at a "cleaner version". We have a sprint day coming up in my org and I can look at it then if not before.

benjy’s picture

Another solution could be to use use a entity hook since the views bulk edit forms use the config entities not the plugins and filter them out at that point based on access control. We might not need the regex then if we have access to the base plugin Id, the reason we need the regex here is because the config entities are derived automatically by core, 1 per role so the ID isn't known upfront.

I don't see any issues with sprintf() it's an acceptable way to format strings and how this module generates the permissions to begin with.

sophie.sk’s picture

It's not that there are issues with sprintf/preg_match - like I say it works (and it's valid PHP etc) - it just looks a little messy to my eyes :) Personal preference as opposed to "you're wrong".

Entity hooks sound interesting. Like I say, if I get the time I'll explore the possibility. In the meantime, I'm happy with the patch you provided and it works, so IMO there's no urgency to rewrite something.

benjy’s picture

StatusFileSize
new1.11 KB

Added a empty check in case options is empty.

berdir’s picture

roleassign has a nicer fix for this: http://cgit.drupalcode.org/roleassign/tree/src/Plugin/views/field/RoleAs...

Although I think it would be better as a plugin alter hook, this isn't optional.

berdir’s picture

See also the views.inc file that uses that for the user bulk "field".

artem0793’s picture

Assigned: Unassigned » artem0793
artem0793’s picture

artem0793’s picture

Assigned: artem0793 » Unassigned
Status: Needs work » Needs review
sophie.sk’s picture

Status: Needs review » Needs work

Latest patch works well, but I noticed there are a couple of spelling mistakes eg $plugin_defenition so marking as needs work.

laughnan’s picture

@artem0793 - This patch worked like a dream!

@Sophie.SK - I've updated the patch to fix the spelling errors. Can you re-review and make this as RTBC if it's ok?

laughnan’s picture

Status: Needs work » Needs review
sophie.sk’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me :) And it works like a dream.

heddn’s picture

It looks like all feedback has been addressed, including #9. Are there any other blockers to this landing?

aaronbauman’s picture

Bump. Can we get this committed?

jeroent’s picture

Bump.

  • JeroenT committed 07ed69c on 8.x-1.x authored by laughnan
    Issue #2862360 by benjy, laughnan: Lock down assignable permissions in...
jeroent’s picture

Committed and pushed to 8.x-1.x. Thanks!

jeroent’s picture

Status: Reviewed & tested by the community » Fixed

  • JeroenT committed dae189a on 8.x-1.x
    Issue #3052497 by JeroenT: Add tests for #2862360
    
jeroent’s picture

Issue tags: -Needs tests

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.