mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
bug #1123: Filter Sunstone monitoring information by user
This commit is contained in:
parent
115091be5f
commit
00f8b78f9a
@ -267,7 +267,7 @@ class SunstoneServer
|
||||
#
|
||||
############################################################################
|
||||
|
||||
def get_monitoring(id, resource, monitor_resources, gid)
|
||||
def get_monitoring(id, resource, monitor_resources, opts={})
|
||||
watch_client = case resource
|
||||
when "vm","VM"
|
||||
OneWatchClient::VmWatchClient.new
|
||||
@ -278,13 +278,16 @@ class SunstoneServer
|
||||
return [200, error.to_json]
|
||||
end
|
||||
|
||||
filter = {}
|
||||
filter[:uid] = opts[:uid] if opts[:gid]!="0"
|
||||
|
||||
columns = monitor_resources.split(',')
|
||||
columns.map!{|e| e.to_sym}
|
||||
|
||||
if id
|
||||
rc = watch_client.resource_monitoring(id.to_i, columns)
|
||||
rc = watch_client.resource_monitoring(id.to_i, columns, filter)
|
||||
else
|
||||
rc = watch_client.total_monitoring(columns)
|
||||
rc = watch_client.total_monitoring(columns, filter)
|
||||
end
|
||||
|
||||
if rc.nil?
|
||||
|
@ -243,7 +243,8 @@ get '/:resource/monitor' do
|
||||
nil,
|
||||
params[:resource],
|
||||
params[:monitor_resources],
|
||||
session[:user_gid])
|
||||
:uid => session[:user_id],
|
||||
:gid => session[:user_gid])
|
||||
end
|
||||
|
||||
get '/:resource/:id/monitor' do
|
||||
@ -251,7 +252,8 @@ get '/:resource/:id/monitor' do
|
||||
params[:id],
|
||||
params[:resource],
|
||||
params[:monitor_resources],
|
||||
session[:user_gid])
|
||||
:uid => session[:user_id],
|
||||
:gid => session[:user_gid])
|
||||
end
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user