Revision acfbc458
Added by Marek Hulán about 10 years ago
app/controllers/puppetca_controller.rb | ||
---|---|---|
class PuppetcaController < ApplicationController
|
||
before_filter :find_proxy
|
||
|
||
def index
|
||
@proxy = find_proxy
|
||
# expire cache if forced
|
||
Rails.cache.delete("ca_#{@proxy.id}") if params[:expire_cache] == "true"
|
||
|
||
begin
|
||
certs = if params[:state].blank?
|
||
SmartProxies::PuppetCA.find_by_state(@proxy, "valid") + SmartProxies::PuppetCA.find_by_state(@proxy, "pending")
|
||
... | ... | |
end
|
||
|
||
def update
|
||
@proxy = find_proxy(:edit_smart_proxies_puppetca)
|
||
cert = SmartProxies::PuppetCA.find(@proxy, params[:id])
|
||
if cert.sign
|
||
process_success({ :success_redirect => smart_proxy_puppetca_index_path(@proxy, :state => params[:state]), :object_name => cert.to_s })
|
||
... | ... | |
end
|
||
|
||
def destroy
|
||
@proxy = find_proxy(:destroy_smart_proxies_puppetca)
|
||
cert = SmartProxies::PuppetCA.find(@proxy, params[:id])
|
||
if cert.destroy
|
||
process_success({ :success_redirect => smart_proxy_puppetca_index_path(@proxy, :state => params[:state]), :object_name => cert.to_s })
|
||
... | ... | |
|
||
private
|
||
|
||
def find_proxy
|
||
@proxy = SmartProxy.find(params[:smart_proxy_id])
|
||
def find_proxy(permission = :view_smart_proxies_puppetca)
|
||
SmartProxy.authorized(permission).find(params[:smart_proxy_id])
|
||
end
|
||
|
||
end
|
Also available in: Unified diff
fixes #812 - new permissions model, user group role and nest support, role filters for better granularity
Contributions from: