We need user permission control on promotion in our company's system. @skyred and @bojanz has reached an agreement to add author system on promotion several days ago.
Proposed resolution:
- Add 'uid' base field on promotion entity type
- Make promotion implement EntityOwnerInterface to realize user permission control on it.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | interdiff_12-13.txt | 864 bytes | jsacksick |
| #13 | 2965729-13.patch | 9.24 KB | jsacksick |
Comments
Comment #2
lawxen commentedComment #3
lawxen commentedAdd hook_update for uid field
Comment #4
murzConfirm this suggestion, very needed! Patch seems broken with current version of Commerce, I'll try to update it for current version. Or maybe @caseylau - you already have updated version of patch?
Comment #5
murzAs workaround without patching module core, I solve this problem via adding uid field using hook:
Comment #6
jsacksick commentedThis needs tests and we should now be using the EntiyOwnerTrait introduced by #3073942: Commerce entities implementing EntityOwnerInterface should always return a UserInterface object.
Comment #7
jsacksick commentedThis should do the trick.
Comment #8
jsacksick commentedWe were missing the following:
Comment #9
jsacksick commentedThe initial default value for the field is set to the first admin user.
Comment #11
amateescu commentedThese queries need an
accessCheck(FALSE).Comment #12
jsacksick commentedNot sure what to do about the existing "update commerce_promotion" which no longer exists... Should we grant the "update any commerce_promotion" to roles having the "update commerce_promotion" permission?
Comment #13
jsacksick commentedAdded code to grant the "update any commerce_promotion" permission to all roles having the "update commerce_promotion" permission.
Comment #14
jsacksick commented