Project

General

Profile

« Previous | Next » 

Revision acfbc458

Added by Marek Hulán about 10 years ago

fixes #812 - new permissions model, user group role and nest support, role filters for better granularity

Contributions from:

View differences:

app/controllers/api/v1/hosts_controller.rb
param :per_page, String, :desc => "number of entries per request"
def index
@hosts = Host.my_hosts.search_for(*search_options).paginate(paginate_options)
@hosts = Host.
authorized(:view_hosts, Host).
search_for(*search_options).paginate(paginate_options)
end
api :GET, "/hosts/:id/", "Show a host."
......
render :json => { :status => @host.host_status }.to_json if @host
end
# we need to limit resources for a current user
def resource_scope
resource_class.my_hosts
end
private
def resource_scope(controller = controller_name)
Host.authorized("#{action_permission}_#{controller}", Host)
end
# this is required for template generation (such as pxelinux) which is not done via a web request
def forward_request_url
@host.request_url = request.host_with_port if @host.respond_to?(:request_url)

Also available in: Unified diff