vinsol-spree-contrib / spree_admin_roles_and_access

Admin Roles And Access for Spree
BSD 3-Clause "New" or "Revised" License
43 stars 101 forks source link

stock tab not available on product edit page #30

Open nimish13 opened 7 years ago

nimish13 commented 7 years ago

Title

Stock Tab is not available on product edit page

Description

Even after adding Stock Management and Product Management permissions_set to a role, the stock tab is not visible on product's edit page at admin end.

Steps To Replicate

1) Create a new role lets say 'Product Manager' 2) Add Stock Management and Product Management permissions set to this role 3) Create a new user assign product manager role to him/her 4) Log in with the newly created user and visit any product's edit page, you won't be able to see the 'stock' tab on the right side of the page 5) I also tried to create a new permission with title can-admin-spree/stock and added it to Stock Management permission set but it didn't solve the issue.

Reason

In product_tabs there is a condition which validates whether the current user can admin Spree::Stock. Now Spree::Stock is a module for which the condition in find_action_and_subject method in permission.rb module returns false due to which current_user is not able to access this stock tab.

Your Environment

Spree 3-2-stable Rails 5.0.0