Revision acfbc458
Added by Marek Hulán about 10 years ago
app/models/smart_proxy.rb | ||
---|---|---|
class SmartProxy < ActiveRecord::Base
|
||
include Authorization
|
||
include Authorizable
|
||
include Taxonomix
|
||
audited :allow_mass_assignment => true
|
||
|
||
... | ... | |
# There should be no problem with associating features before the proxy is saved as the whole operation is in a transaction
|
||
before_save :sanitize_url, :associate_features
|
||
|
||
scoped_search :on => :name, :complete_value => :true
|
||
|
||
# with proc support, default_scope can no longer be chained
|
||
# include all default scoping here
|
||
default_scope lambda {
|
||
... | ... | |
end
|
||
}
|
||
|
||
scope :my_proxies, lambda {
|
||
user = User.current
|
||
conditions = user.admin? || user.allowed_to?({ :controller => :smart_proxy, :action => :index }) ? {} : '1 = 0'
|
||
where(conditions)
|
||
}
|
||
|
||
Feature.name_map.each { |f, v| scope "#{f}_proxies".to_sym, where(:features => { :name => v }).joins(:features) }
|
||
|
||
def hostname
|
Also available in: Unified diff
fixes #812 - new permissions model, user group role and nest support, role filters for better granularity
Contributions from: