Eric Gross
06/05/2023, 6:58 PM_Spree_::_Ability_.register_ability
with new abilities. In my case though I don't want to create more abilities, but I want to indicate that any user with .has_role?(:admin)
should be considered an admin by the Soldius back end. I haven't figured out how to make that work, has anyone got it working? I'm using pundit
in my app rather than cancancan
.Eric Gross
06/05/2023, 7:19 PMadmin
Spree::Role
returned by spree_roles
, but that didn't seem to grant me access to can?(:admin, _Spree_::_Order_)
for some reason 🤷Chris Todorov
06/05/2023, 8:30 PMSpree::Role
record, give it the name
"admin"
, then in your initializer give it the order management permission set like this
config.roles.assign_permissions :admin, %w[Spree::PermissionSets::OrderManagement]
Chris Todorov
06/05/2023, 8:30 PMChris Todorov
06/05/2023, 8:31 PMChris Todorov
06/05/2023, 8:32 PMadmin
should already exist from Solidus as a super admin roleChris Todorov
06/05/2023, 8:33 PMChris Todorov
06/05/2023, 8:34 PMEric Gross
06/05/2023, 10:57 PMclass SolidusAbilities
include CanCan::Ability
def initialize user
if user.has_role?(:admin)
can :admin, :all
can :show, :all
can :index, :all
end
end
end
and
Spree::Ability.register_ability(SolidusAbilities)
in spree.rb
Eric Gross
06/05/2023, 11:00 PMChris Todorov
06/05/2023, 11:14 PMpundit
though have no experience using it, let alone in the context of Solidus.Chris Todorov
06/05/2023, 11:15 PMChris Todorov
06/05/2023, 11:16 PM:manage
should give you all the permissions, though maybe that’s different for pundit