Closed (outdated)
Project:
Commerce Core
Version:
8.x-2.x-dev
Component:
Commerce
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
25 Dec 2011 at 18:44 UTC
Updated:
22 Sep 2016 at 11:21 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
rszrama commentedThere is no way. I'm not entirely sure why we don't have the permissions other than that products owned by varying users isn't supported very well in Commerce 1.x. It's something that will need to be improved going forward, especially to support marketplace scenarios.
Comment #3
arnoldbird commentedDoes the 2x branch separate the edit and delete perms? As of 1.8, there is no way (in the UI) to give someone permission to edit a product without also giving permission to delete products. I don't need as much granularity as the original poster was seeking. I would just like to be able to assign edit perms without also allowing users to delete products. One single "delete products" perm (applicable to all product types) would do it for me.
Thank you
Comment #4
rszrama commentedIt does not right now, but I can't think of any reason not to support separate edit vs. delete permission. Core does this for content, so let's make this a feature request for 2.x.
Comment #5
sportel commentedI agree. I would very much like my client (shop owner) to be able to edit an order, but not to delete it. I thinks it's to dangerous. If a customer has made an order, that order can never be "un-made". It can be cancelled, but not deleted. Invoice numbers get lost and all that kind of things. Big feature request!
Comment #6
Channel Islander commentedI also very much need to differentiate between edit order and delete order permissions.
Comment #7
bgilhome commentedHere's a patch that adds separate 'delete own' and 'delete any' permissions for each commerce entity type & bundle.
NB these permissions will now override the 'administer $entity_type entities' permission - this permission will now only be used in access checking when the operation is none of 'view', 'create', 'edit' or 'delete' (eg. accessing commerce admin views etc).
Seems that VBO doesn't respect the permission in it's bulk operations select list but if an operation is performed without permission it doesn't process any entities.
Comment #8
adamps commentedThe patch in #7 is a start, but looks like it would also need per-bundle create and edit permissions, plus code in commerce_entity_access to check the new permissions if 'op' is delete.
However as I understand it, such a patch cannot ever be committed to commerce v1 because it would break all existing sites. Hence @rszrama postponed it. There is now a version setting for v2, so I hope I'm not out of order in bringing this back to life with the appropriate settings.
If you want a D7 solution in the meantime, you could patch commerce every time there is a new release. An alternative approach is to use hooks.
Comment #9
mglamanThis should be simple enough to do. Just need to copy
\Drupal\node\NodePermissions::nodeTypePermissionsessentially.Comment #10
mglamanPR: https://github.com/commerceguys/commerce/pull/273
Patch attached.
Comment #11
mglamanThis needs work. Need to implement access control handler, like NodeAccessControlHandler.
Comment #12
mglamanI'll wrap this up over the weekend.
Comment #13
mglamanPostponing for #2633906: Integrate with Entity API
Comment #14
powysm commentedDo i understand this correctly - following entity api permissions there should be an 'access' annotation in Product (and potentially orders etc. also) pointing to an EntityAccessControlHandler? In which case does postponed mean this is just a time issue or are there dependencies that need to be resolved first?
Comment #15
geek-merlinThe 7.x issue is now addressed in contrib: https://www.drupal.org/project/commerce_deletepermissions
Comment #16
mglamanFor 2.x we have #2715273: Implement full permissions for every entity type. Marking this outdated, now.