Tom Wilson
08/10/2022, 9:49 PM/admin/search/products to issue a search for these products, and that is returning an auth failure for this user. Because I'm a super user, it allows me to proceed. But after much digging, I still can't quite wrap my head around what permissions I need to actually grant this user to enable this use case.
It looks like the permission check is coming from the authorize_admin method of the BaseController. That method looks like the following:
def authorize_admin
if respond_to?(:model_class, true) && model_class
record = model_class
else
record = controller_name.to_sym
end
authorize! :admin, record
authorize! action, record
end
In my case after tracing this, record is product and action is search - and the authorize! :admin line is failing. The user has the ProductMangement permission set, though, which grants :manage SpreeProduct. So what additional permission do I need to grant this user to perform a product search?Edwin Cruz
08/10/2022, 9:54 PMTom Wilson
08/11/2022, 2:05 PMTom Wilson
08/11/2022, 2:16 PMspree_api_key set.Tom Wilson
08/29/2022, 1:40 PMcan :manage, :search to a permission set in order to enable this for users. That appears to fix the problem.