All of Commerce's content entities use Entity API's permissions handler to automatically provide permissions:

31: *     "permission_provider" = "Drupal\commerce\EntityPermissionProvider",

We should look at doing this for consistency and code reduction.

All of our permissions will need checking and some of them will change.

Comments

joachim created an issue. See original summary.

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new3.07 KB

The only problem with this patch: We rename permissions: "create licenses" to "create commerce_license" and "view any license" to "view own unpublished license" + "view commerce_license".

Alternative solution: use the uncachable permissions provider / access controller, which would add "view any commerce_license".

dawehner’s picture

StatusFileSize
new3.09 KB
new820 bytes

Bojanz pointed out that licenses are not frontend facing, so caching doesn't matter. This will bring back the "view own "... permission.

bojanz’s picture

Status: Needs review » Reviewed & tested by the community

Looks good.

  • joachim committed 90ce045 on 8.x-2.x authored by dawehner
    Issue #2914085 by dawehner, joachim: Changed permissions to use Entity...
joachim’s picture

Status: Reviewed & tested by the community » Fixed
StatusFileSize
new4.81 KB

You missed one of the perms that was commented as being one we can remove ;)

Also:

- added explicit dependency on entity module
- kept in the description and the restrict access on some of our perms

dawehner’s picture

Thank you!

- added explicit dependency on entity module

Oh that is a good point!

Status: Fixed » Closed (fixed)

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