Revision d9a2ebac
Added by Ohad Levy almost 12 years ago
- ID d9a2ebac6e9ec0082e60265b794f54a29a1f7e65
app/models/user.rb | ||
---|---|---|
|
||
belongs_to :auth_source
|
||
has_many :auditable_changes, :class_name => '::Audit', :as => :user
|
||
has_many :usergroup_member, :as => :member
|
||
has_many :usergroups, :through => :usergroup_member
|
||
has_many :direct_hosts, :as => :owner, :class_name => "Host"
|
||
has_and_belongs_to_many :notices, :join_table => 'user_notices'
|
||
... | ... | |
def allowed_to?(action, options={})
|
||
return true if admin?
|
||
return true if editing_self
|
||
return false if roles.empty?
|
||
roles.detect {|role| role.allowed_to?(action)}.present?
|
||
end
|
||
|
Also available in: Unified diff
[SQL optimizations] - many small optimizations
This is one of a few patches aim to improve Foreman performance