Closed (fixed)
Project:
Entityqueue
Version:
7.x-1.5
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
22 Feb 2012 at 15:08 UTC
Updated:
8 Apr 2019 at 21:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tim.plunkettSo #3 as described above is no longer how Field Permissions does it, it now is similar to #2.
Another thing to consider is access control per entityqueue TYPE and per entityqueue. "Create" would only be valid for entityqueue types, not the queues themselves.
I'm considering strapping on a new column or value inside 'data' for per-entityqueue permissions, but I'd rather have some consensus.
Comment #2
amateescu commentedDefinitely the 'data' field, that's why it's there. It also used to keep the equivalent of 'nodeueue_types' in it :)
Comment #3
tim.plunkettI needed per-queue permissions first, so I wrote those.
I just did edit and view.
entityqueue_access didn't match what entity_access passes at all, I think it makes more sense to use that.
Comment #4
amateescu commentedThat's a good start. I made some additions in the attached patch, but I'm not sure what to do with the 'view' permission :)
Comment #5
jody lynnOne serious problem that the patch does not fix is that currently if you go to admin/structure/entityqueue there is no access control at all (even anonymous users can go there and add new queues).
Perhaps entityqueue_access should not be used as the access callback from hook_entity_info, or maybe it just needs to be adjusted.
Comment #6
tim.plunkettAdds some logic to prevent access to the overview form if the user doesn't have access to the entityqueues. Also, right now 'administer all queues' is doubling as 'create new queue'.
Comment #7
jody lynnCloser. Remaining issue is that if you don't have administer perms, but you do have perm for a specific queue, you can't get to admin/strucutre/entityqueue because entityqueue_access gets called with no params and returns false.
Comment #8
tim.plunkettThe new ctools branch is too drastically different/unfinished for me to grok right now.
And I found why #7 was happening, I was checking
"$op $entity->name entityqueue"and not"$op $entity->name queue".Comment #9
jody lynnExcellent and tested. Since this fixes a security problem, can we get this into the current branch while the new branch is being worked on?
Comment #10
amateescu commentedSure, the patch looks good, and if you guys need it, why not :) Committed, pushed and marked as 'to be ported' to the 7.x-1.x-ctools branch.
http://drupalcode.org/sandbox/amateescu/1429904.git/commit/bcffac6
Comment #11
roam2345 commentedHere is the first attempt at porting this to D7.
Comment #12
roam2345 commentedMake the list of operations user "admin/structure/entityqueue" respond to the access permissions and fix issue in the entity bundles parameter in previous patch.
Comment #13
mrfelton commentedWorks for editing the individual queues, but none of the queues show up at /admin/structure/entityqueue, even those that you have permission to edit.
Comment #14
mrfelton commentedAlso, permission names should use queue machine_names, and not the human readable names which are subject to change.
Comment #15
roam2345 commentedUpdated patch to fix issues highlighted.
Comment #16
roam2345 commentedstatus change.
Comment #17
roam2345 commentedIssue on queue specific check fixed.
Comment #18
roam2345 commentedSlight confusion with wording configure and edit... fixed issue on edit sub queue page
Comment #19
roam2345 commentedwrong patch, sorry.
Comment #20
mrfelton commentedPrevious patch had an issue with the permission names (had an extra space at the end of the edit perm) and an inconsistency in the naming of the permissions and the user_access call in the access check. Updated patch attached.
Comment #21
roam2345 commentedPrevious patch has a issue in the logic when determining the access to edit the entityqueues at admin/structure/entityqueue
Comment #22
jojonaloha commentedMainly a cleanup of the previous patch:
Comment #23
amateescu commentedThis patch doesn't apply anymore since I merged 7.x-1.x-ctools back into 7.x-1.x. I guess a reroll and a quick sanity check over the codebase is in order :)
Comment #24
jojonaloha commentedAttached is an updated patch for the 7.x-1.x branch. Due to the merge it looks like the previously committed patch for this issue is broken, because entityqueues used to be entities and now the subqueues are entities but the queues themselves are not, so calling entity_label() on the queues results in an empty string. Also going to the /admin/people/permissions page results in a fatal error:
I also was testing this more in depth by granting a user the most limited permissions, and I think there is some confusion around the 'configure %queue queue' permission. To me it sounds like that should grant access to the "Configure" link for that queue. Even with that permission, the user gets access denied on that page, and it looks like that page is a "given" from the ctools export ui. I haven't dug into the ctools internals yet to figure out how to control/grant access to that page. For the other operations I tried modifying the logic to correctly hide any operations the user doesn't have access to.
Comment #25
jojonaloha commentedI just noticed that the "Manage fields" page went missing when configuring an Entityqueue. This patch is the same as the last one except the bundle admin path has been updated in hook_entity_info() to fix this.
Comment #26
amateescu commentedI made a few improvements to the code and removed the 'configure entityqueue' permission as it only duplicated 'administer entityqueue'. Can you please check if everything works as expected?
Comment #27
paulihuhtiniemi commentedTesting patch in #26, I'm getting the following error when trying to configure entityqueue (in /admin/structure/entityqueue/list/[queue_name]/edit):
EDIT:
Looks like entityqueue_access() is missing $entity_type parameter?
Should be:
?
Comment #28
amateescu commentedOops, my bad. This one should be better. Thanks for testing!
Comment #29
jojonaloha commentedSo if we have a role that we want to be able to edit items only within a certain queue we would have to give them "Administer entityqueue" to see /admin/structure/entityqueue and "Edit $queue queue items" to add items. If I only give them "Edit $queue queue items" then I can go directly to /admin/structure/entityqueue/list/$queue/subqueues/$subqueue/edit but when saving the form they are returned to /admin/structure/entityqueue where they get "Access denied".
My only concern is that "Administer entityqueue" to me sounds like an admin-only permission, which I picture as allowing access to module level settings. It seems that "Administer all queues" is the more admin-only permission though. Perhaps if "Administer entityqueue" was labeled "Access entityqueue list"?
Comment #30
paulihuhtiniemi commentedI'm getting 403 access denied when trying to add items to queue using the autocomplete field. Log message says that following path gives access denied: entityreference/autocomplete/single/eq_node/entityqueue_subqueue/testqueue/11/testing
This happens for admin user that has all entityqueue related permissions.
Comment #31
amateescu commented@jojonaloha, Ok, how about we switch to nodequeue-like permissions:
Administer entityqueue (not used anywhere at the moment, I think)
Manipulate queues (gives access to /admin/structure/entityqueue)
Manipulate all queues (gives access to do anything on any queue)
Manipulate [queue_name] queue (gives access per single queue)
@paulihuhtiniemi, I'm not sure how that's possible, we're just using a regular entity reference field.. but I also don't have too much time to investigate right now :(
Comment #32
jojonaloha commented@paulihuhtiniemi, I just tested locally and got a 403 as well. I'll work on this a little later today.
@amateescu, I must admit I like the simplicity of those permissions. Unless anybody objects I'll probably use those in my next patch.
Comment #33
jojonaloha commented@paulihuhtiniemi, I figured out the issue was due to my confusion over entityqueue_access() in #22.
Before that patch it was an implementation of the entity_access() access callback. I've modified it to make the more clear. Also, since the EntityQueue's themselves used to be entities, this function used to take the EntityQueue or a string machine name, but now that they aren't entities, this should take EntitySubqueue entities. I've made a menu callback for all the places where a EntityQueue is an argument, entityqueue_queue_access(), which just creates a stub entity and calls entity_access(), since in our case our menu access permissions on a bundle (aka EntityQueue) level.
The actual permissions in this patch are:
I decided to make the create/delete EntityQueue permission "Administer entityqueue", as that matches with the Nodequeue style permissions. The "Delete %queue subqueues"permissions doesn't really do much yet since there is no subqueue delete form. I'll be creating an issue for that at some point.
Comment #34
jojonaloha commentedAttached is a re-roll of the previous patch, also fixes an issue brought up by coder review.
Comment #35
amateescu commentedOk, looked over this again and I think it's good enough for now. We can always start with an alpha release to gather more feedback :)
Committed to 7.x-1.x.
Comment #37
Coop920 commentedI'm getting a 403 access forbidden error when trying to add a file to my entity queue. This is on version 7.x-1.5. Any thoughts?
Thanks