Class ::xowiki::includelet::kibana
::xowiki::includelet::kibana
create ... \
[ -__decoration (default "plain") ] \
[ -id (default "[xowiki::Includelet js_name [self]]") ] \
[ -parameter_declaration (default "
{-chart openacs-status-codes}
{-from now-24h}
{-to now}
{-hash ""}
{-width:integer 800}
{-height:integer 400}
") ]
Include a Kibana chart identified by the provided hash
- Documented Parameters:
- from
- start of time window (default now-24h)
- to
- end of time window (default now-)
- hash
- hash of the included visualization
- width
- width of included content
- height
- height of included content
Defined in /var/www/openacs.org/packages/xowiki/tcl/kibana-procs.tclClass Relations
- class: ::xowiki::IncludeletClass
![[i]](/resources/acs-subsite/ZoomIn16.gif)
- superclass: ::xowiki::Includelet
![[i]](/resources/acs-subsite/ZoomIn16.gif)
::xowiki::IncludeletClass create ::xowiki::includelet::kibana \
-superclass ::xowiki::Includelet
Methods (to be applied on the object)
check_permission (scripted)
set grantAlways {^/kibana/(built_assets|bundles|node_modules|translations|ui)/}
set grantNever {^/kibana/(elasticsearch)}
set restricted {
/kibana
/kibana/app/canvas
/kibana/app/maps
/kibana/app/ml
/kibana/app/infra
/kibana/app/apm
/kibana/app/uptime
/kibana/app/siem
/kibana/app/monitoring
}
set strippedUrl [string trimright $url /]
if {[regexp $grantAlways $url]} {
set when always
set granted 1
} elseif {$strippedUrl in $restricted || [regexp $grantNever $url]} {
set when never
set granted 0
} else {
::xo::ConnectionContext require
set when sometimes
set user_id [::xo::cc user_id]
set method [ns_conn method]
set granted [nsv_exists kibana_permissions $user_id]
try {
ad_get_signed_cookie ad_kibana
} trap {AD_EXCEPTION NO_COOKIE} {errorMsg} {
set cookie ""
append when -nocookie
} trap {AD_EXCEPTION INVALID_COOKIE} {errorMsg} {
set cookie ""
append when -invalidcookie
} on ok {cookie} {
}
if {$granted} {
nsv_unset kibana_permissions $user_id
append when -first
} elseif {$cookie ne ""} {
set granted [permission::permission_p -party_id $user_id -object_id $cookie -privilege read]
append when -$granted
if {$granted} {
if {$method eq "POST" && $url eq "/kibana/api/saved_objects/_bulk_get"} {
set payload [ns_conn content]
if {[regexp {"id":"([^\"]+)"} $payload . hash]} {
set granted [nsv_exists kibana_hashes $user_id-$hash]
ns_log notice "kibana CHECK PERMISSIONS $url hash $hash -> $granted"
append when -payload=$granted
}
} else {
ns_log notice "kibana CHECK PERMISSIONS for $user_id [ns_conn request] // [ns_set array [ns_conn headers]]"
if {$method eq "POST"} {
ns_log notice "kibana CHECK PERMISSIONS payload [ns_conn content]"
}
}
}
}
}
if {$when ne "always"} {
ns_log notice "kibana CHECK PERMISSIONS <$url> $when --> $granted"
}
return $grantedgrant_permission (scripted)
nsv_set kibana_permissions [::xo::cc user_id] $object_id
nsv_set kibana_hashes [::xo::cc user_id]-$hash 1
ns_log notice "kibana GRANT ACCESS for <$url> to [::xo::cc user_id]"
ad_set_signed_cookie -discard t -scriptable f ad_kibana $object_id
url (scripted)
set url $::xowiki::includelet::kibana_location$path
return $url
Methods (to be applied on instances)
__decoration (setter)
id (setter)
include_head_entries (scripted)
next
parameter_declaration (setter)
render (scripted)
:get_parameters
set refreshInterval {(pause:!t,value:0)}
set time [subst {from:$from,mode:quick,to:$to}]
set _g (refreshInterval:$refreshInterval,time:($time))
set url /kibana/app/kibana#/visualize/edit/$hash?embed=true&_g=[ns_urlencode $_g]
[self class] grant_permission [${:__including_page} item_id] $hash $url
set HTML [subst {<iframe src="$url" width="$width" height="$height" frameborder="0"></iframe>}]
return $HTML