Merge b668120883 into 9ff8becaf6
This commit is contained in:
commit
a5ef222378
6 changed files with 13 additions and 8 deletions
|
|
@ -67,7 +67,7 @@ class Ability
|
|||
|
||||
signed_in(user) # Inherit abilities from signed user
|
||||
# User with role
|
||||
can :manage, User if user.is_admin # ??? || (user.has_role? :organizer, :any)
|
||||
can :manage, User if user.is_admin || (user.has_role? :organizer, :any)
|
||||
can [:new, :create], Conference if user.is_admin || (user.has_role? :organizer, :any)
|
||||
can [:index, :show, :gallery_photos], Conference
|
||||
can :manage, Conference, id: conf_ids_for_organizer
|
||||
|
|
|
|||
|
|
@ -59,8 +59,7 @@ class User < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def setup_role
|
||||
self.is_admin = true if User.count == 0
|
||||
roles << Role.where(name: 'Admin') if User.count == 1
|
||||
self.is_admin = true if User.count == 1
|
||||
end
|
||||
|
||||
# Gets the roles of the user, groups them by role.name and returns the resource(s) of each role
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue