Skip to content

Commit

Permalink
B #3335: Add default zone endpoint
Browse files Browse the repository at this point in the history
This is a new user templatate attribute that is understood by Sunstone,
users with this setting will be logged in automatically in their
default zone (if no session is available)
  • Loading branch information
tinova committed May 21, 2019
1 parent 6e70d45 commit 2bf20ac
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/sunstone/sunstone-server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
GROUP_ADMIN_DEFAULT_VIEW_XPATH = 'TEMPLATE/SUNSTONE/GROUP_ADMIN_DEFAULT_VIEW'
TABLE_DEFAULT_PAGE_LENGTH_XPATH = 'TEMPLATE/SUNSTONE/TABLE_DEFAULT_PAGE_LENGTH'
LANG_XPATH = 'TEMPLATE/SUNSTONE/LANG'
DEFAULT_ZONE_ENDPOINT_XPATH = 'TEMPLATE/SUNSTONE/DEFAULT_ZONE_ENDPOINT'

ONED_CONF_OPTS = {
# If no costs are defined in oned.conf these values will be used
Expand Down Expand Up @@ -308,6 +309,13 @@ def build_session
session[:page_length] = DEFAULT_PAGE_LENGTH
end

# If active zone endpoint is not defined, pull it
# from user template if exists
unless user[DEFAULT_ZONE_ENDPOINT_XPATH].nil?
session[:active_zone_endpoint] ||=
user[DEFAULT_ZONE_ENDPOINT_XPATH]
end

wss = $conf[:vnc_proxy_support_wss]
#limit to yes,no options
session[:vnc_wss] = (wss == true || wss == "yes" || wss == "only" ?
Expand Down Expand Up @@ -730,7 +738,7 @@ def destroy_session
if params[:zone_id] && session[:federation_mode] != "STANDALONE"
zone = OpenNebula::Zone.new_with_id(params[:zone_id].to_i,
$cloud_auth.client(session[:user],
session[:active_zone_endpoint]))
session[:active_zone_endpoint]))

rc = zone.info
return [500, rc.message] if OpenNebula.is_error?(rc)
Expand Down

0 comments on commit 2bf20ac

Please sign in to comment.