Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access the admin section of Spree in production?

I have followed the Spree instructions for setting up, and I got it working in development mode. I deployed with Capistrano to rackspace to a production server, but the same default login ("[email protected]"/"spree123") does not work. I created a user in the web interface, but of course it would not have admin priveleges.

There is nothing in the guide that takes this into account - how can I create an admin user in production when there are no users at all initially? Maybe I deployed incorrectly? I am using a very standard deploy.rb, must there be some spree-specific code for setting this up?

like image 202
bluebit Avatar asked Apr 28 '12 14:04

bluebit


4 Answers

You can run rake spree_auth:admin:create if your using spree_auth_devise

like image 164
geermc4 Avatar answered Nov 01 '22 15:11

geermc4


You can add any user to the Spree Admin Role from the console rails c, doing the following:

user = user.find({your id})
user.spree_roles << Spree::Role.find_by_name(:admin)

In production, you would run the console this way:

RAILS_ENV=production rails c
like image 41
yorch Avatar answered Nov 01 '22 15:11

yorch


If you are deploying with heroku make sure to do following:

heroku run rake db:migrate
heroku run rake db:seed

The seed will ask you to create a username and password for your admin account.

Hope this helped.

like image 2
Martijn Kerckhaert Avatar answered Nov 01 '22 16:11

Martijn Kerckhaert


If the user you created was the first user it would in fact have admin rights.

like image 1
ashga Avatar answered Nov 01 '22 14:11

ashga