odiseoteam / SyliusRbacPlugin

This plugin provides basic roles and permissions management functionality for Sylius.
MIT License
3 stars 0 forks source link

The permissions types don't have the right cases #5

Open adrian3d opened 1 year ago

adrian3d commented 1 year ago

I've installed the plugin as the getting started guide tells us.

I've been surprised that the administrator doesn't have all the permissions, even after executing the following command bim/console sylius-rbac:grant-access-to-given-administrator admin@test.fr administrator catalogManagement configuration customerManagement marketingManagement salesManagement.

I took a look into the database. I've been surprised to stumble upon these permissions data:

{"catalogManagement":"{\"type\":\"catalogManagement\",\"operation_types\":[\"read\",\"write\"]}","configuration":"{\"type\":\"configuration\",\"operation_types\":[\"read\",\"write\"]}","customerManagement":"{\"type\":\"customerManagement\",\"operation_types\":[\"read\",\"write\"]}","marketingManagement":"{\"type\":\"marketingManagement\",\"operation_types\":[\"read\",\"write\"]}","salesManagement":"{\"type\":\"salesManagement\",\"operation_types\":[\"read\",\"write\"]}"}

As you can see, the types are all camel-cased. The types in the \Odiseo\SyliusRbacPlugin\Model\Permission class are all snake-cased. If I change the case to be

{"catalog_management":"{\"type\":\"catalog_management\",\"operation_types\":[\"read\",\"write\"]}","configuration":"{\"type\":\"configuration\",\"operation_types\":[\"read\",\"write\"]}","customer_management":"{\"type\":\"customer_management\",\"operation_types\":[\"read\",\"write\"]}","marketing_management":"{\"type\":\"marketing_management\",\"operation_types\":[\"read\",\"write\"]}","sales_management":"{\"type\":\"sales_management\",\"operation_types\":[\"read\",\"write\"]}"}

all works, folks.

Should we update the documentation or something ?