Merge pull request #61 from gopesht/fix_first_admin_setup

Fix admin first setup, email and password in README
This commit is contained in:
Henne Vogelsang 2014-04-09 11:40:21 +02:00
commit 5ed51c7499
2 changed files with 8 additions and 8 deletions

View file

@ -77,13 +77,9 @@ bundle exec rake db:seed
7. Connect to osem.example.org and register your first user. Make also sure that Postfix is installed and configured on the system for the confirmation mail to pass through. 7. Connect to osem.example.org and register your first user. Make also sure that Postfix is installed and configured on the system for the confirmation mail to pass through.
8. To make the first registered user an admin: 8. Just sign up as a new user and you will be automatically assigned as admin role.
```
rails console
User.all
me = User.find('1')
me.role_ids=[3]
```
Caveats Caveats
======= =======

View file

@ -27,9 +27,13 @@ class User < ActiveRecord::Base
end end
def setup_role def setup_role
if self.id == 1
self.role_ids = [3]
end
if self.role_ids.empty? if self.role_ids.empty?
self.role_ids = [1] self.role_ids = [1]
end end
end end
def popup_details def popup_details