Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8193817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:36:45+00:00 2026-06-07T04:36:45+00:00

I am trying to specify some custom roles in Spree for example role ‘client’

  • 0

I am trying to specify some custom roles in Spree for example role ‘client’ and extend the permissions to access the admin section for this role.

This user will be able to access only those Product created by that user. Concept is letting a user with role ‘client’ manage only products and other certain Models.

To start with I added CanCan plugin and defined a RoleAbility Class in role_ability.rb

Just following this post : Spree Custom Roles Permissions

class RoleAbility
  include CanCan::Ability

  def initialize(user)
    user ||= User.new
    if user.has_role? 'admin'
        can :manage, :all
    elsif user.has_role? 'client_admin'
      can :read, Product
      can :admin, Product
    end
  end
end

Added this to an initializer : config/initializers/spree.rb

Ability.register_ability(RetailerAbility)

Also extended admin_products_controller_decorator.rb :app/controllersadmin_products_controller_decorator.rb

Admin::ProductsController.class_eval do
    def authorize_admin
        authorize! :admin, Product
        authorize! params[:action].to_sym, Product
    end
end

But I am getting flash message ‘Authorisation Failure’

Trying to find some luck, I referred following links

A github gist for Customizing Spree Roles : https://gist.github.com/1277326

Here’s a similar issue what I am facing : http://groups.google.com/group/spree-user/browse_thread/thread/1e819e10410d03c5/23b269e09c7ed47e

All efforts in vain…

Any pointers highly appreciated ?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T04:36:47+00:00Added an answer on June 7, 2026 at 4:36 am

    Finally found it.

    After doing some careful research found that spree 1.1.1 had changed the classes by adding “Spree” module to every class, this resulted in url like “spree/admin/overview” which earlier was “admin/overview”.

    So that worked for me and I was able to control the Permissions for my roles.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write some XML schema code to specify that a particular
I am trying to specify a custom converter to Slim by specifying a suite
I've seen some answers to questions about how to specify a custom layout for
Just trying to specify some tables structures and models for Doctrine in a YAML
I am trying to find the best route to get in some Custom formats
I am trying to play some audio files with the CLI example on this
I am trying to specify some additional targets/tasks to an msbuild file by extending
I am trying to specify some jar dependencies using gradle and these instructions: http://gradle.org/docs/current/userguide/dependency_management.html#sub:file_dependencies
I am currently trying to put together an URL where I specify some GET
I am trying to specify some rules dynamically on a form. On this form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.