Add pickups role

This commit is contained in:
Patrick Gansterer 2017-11-15 23:58:11 +01:00
parent 4c41a99fde
commit ac11ba1cc1
14 changed files with 42 additions and 15 deletions

View file

@ -159,17 +159,22 @@ class User < ActiveRecord::Base
def role_article_meta?
groups.detect {|group| group.role_article_meta?}
end
# Checks the suppliers role
def role_suppliers?
groups.detect {|group| group.role_suppliers?}
end
# Checks the invoices role
def role_pickups?
groups.detect {|group| group.role_pickups?}
end
# Checks the orders role
def role_orders?
groups.detect {|group| group.role_orders?}
end
def ordergroup_name
ordergroup ? ordergroup.name : I18n.t('model.user.no_ordergroup')
end
@ -178,7 +183,7 @@ class User < ActiveRecord::Base
def member_of?(group)
group.users.exists?(self.id)
end
#Returns an array with the users groups (but without the Ordergroups -> because tpye=>"")
def member_of_groups()
self.groups.where(type: '')