Revision acfbc458
Added by Marek Hulán about 10 years ago
app/controllers/concerns/api/import_puppetclasses_common_controller.rb | ||
---|---|---|
|
||
def find_required_puppet_proxy
|
||
id = params.keys.include?('smart_proxy_id') ? params['smart_proxy_id'] : params['id']
|
||
@smart_proxy = SmartProxy.find_by_id(id.to_i) if id.to_i > 0
|
||
@smart_proxy ||= SmartProxy.find_by_name(id)
|
||
@smart_proxy = SmartProxy.authorized(:view_smart_proxies).find_by_id(id.to_i) if id.to_i > 0
|
||
@smart_proxy ||= SmartProxy.authorized(:view_smart_proxies).find_by_name(id)
|
||
unless @smart_proxy && SmartProxy.puppet_proxies.pluck("smart_proxies.id").include?(@smart_proxy.id)
|
||
not_found 'We did not find a foreman proxy that can provide the information, ensure that this proxy has the puppet feature turned on.'
|
||
end
|
||
... | ... | |
end
|
||
|
||
def find_optional_environment
|
||
@environment = Environment.find_by_id(@env_id.to_i) if @env_id.to_i > 0
|
||
@environment ||= Environment.find_by_name(@env_id)
|
||
@environment = Environment.authorized(:view_environments).find_by_id(@env_id.to_i) if @env_id.to_i > 0
|
||
@environment ||= Environment.authorized(:view_environments).find_by_name(@env_id)
|
||
@environment
|
||
end
|
||
|
Also available in: Unified diff
fixes #812 - new permissions model, user group role and nest support, role filters for better granularity
Contributions from: