1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-11 05:17:41 +03:00

Feature #2696: Retrieve views from primary group template

This commit is contained in:
Tino Vazquez 2014-02-26 19:20:01 +01:00
parent 7b0136523f
commit 4cf97994a0

View File

@ -49,9 +49,19 @@ class SunstoneViews
end end
def available_views(user_name, group_name) def available_views(user_name, group_name)
available_views = @views_config['users'][user_name] if @views_config['users'] user = OpenNebula::User.new_with_id(
available_views ||= @views_config['groups'][group_name] if @views_config['groups'] OpenNebula::User::SELF,
available_views ||= @views_config['default'] $cloud_auth.client(user_name))
user.info
group = OpenNebula::Group.new_with_id(user.gid, $cloud_auth.client(user_name))
group.info
if group["TEMPLATE/SUNSTONE_VIEWS"]
available_views = group["TEMPLATE/SUNSTONE_VIEWS"].split(",")
else
available_views = ['cloud']
end
return available_views return available_views
end end