From 7996a8249ff2ba8d692c1bb08f36dde16e9532c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Mon, 26 May 2014 17:38:20 +0200 Subject: [PATCH] Feature #2891: Add checkbox to share VMs in group wizard --- src/oca/ruby/opennebula/group.rb | 14 +++ src/sunstone/public/js/plugins/groups-tab.js | 89 +++++++++++--------- 2 files changed, 65 insertions(+), 38 deletions(-) diff --git a/src/oca/ruby/opennebula/group.rb b/src/oca/ruby/opennebula/group.rb index 364f2ccdb6..55b0397526 100644 --- a/src/oca/ruby/opennebula/group.rb +++ b/src/oca/ruby/opennebula/group.rb @@ -123,6 +123,20 @@ module OpenNebula return OpenNebula::Error.new(error_msg) end + # Set group ACLs to share resources + if group_hash[:shared_resources] + acls = Array.new + acls << "@#{self.id} #{group_hash[:shared_resources]}/@#{self.id} USE" + + rc, msg = create_group_acls(acls) + + if OpenNebula.is_error?(rc) + self.delete + error_msg = "Error creating group ACL's: #{rc.message}" + return OpenNebula::Error.new(error_msg) + end + end + # Create associated group admin if needed rc = create_admin_user(group_hash) diff --git a/src/sunstone/public/js/plugins/groups-tab.js b/src/sunstone/public/js/plugins/groups-tab.js index c91ffedbfc..1c4ce9924d 100644 --- a/src/sunstone/public/js/plugins/groups-tab.js +++ b/src/sunstone/public/js/plugins/groups-tab.js @@ -107,45 +107,54 @@ function create_group_tmpl(dialog_name){ \ \
\ -
\ -
\ -

' - +tr("Allow users in this group to create the following resources")+ - ' '+tr("This will create new ACL Rules to define which virtual resources this group's users will be able to create. You can set different resources for the administrator group, and decide if the administrators will be allowed to create new users.")+'\ -

\ -
\ +
\ +
\ + \
\ -
\ -
\ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ -
\ - '+tr("VMs")+''+tr("VNets")+''+tr("Images")+''+tr("Templates")+''+tr("Documents")+''+tr("Documents are a special tool used for general purposes, mainly by OneFlow. If you want to enable users of this group to use service composition via OneFlow, let it checked.")+'
'+tr("Users")+'\ -
'+tr("Admins")+'
\ +
\ +
\ +
\ +

' + +tr("Allow users in this group to create the following resources")+ + ' '+tr("This will create new ACL Rules to define which virtual resources this group's users will be able to create. You can set different resources for the administrator group, and decide if the administrators will be allowed to create new users.")+'\ +

\ +
\ +
\ +
\ +
\ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
\ + '+tr("VMs")+''+tr("VNets")+''+tr("Images")+''+tr("Templates")+''+tr("Documents")+''+tr("Documents are a special tool used for general purposes, mainly by OneFlow. If you want to enable users of this group to use service composition via OneFlow, let it checked.")+'
'+tr("Users")+'\ +
'+tr("Admins")+'
\
\
\
\ @@ -1129,6 +1138,10 @@ function setupCreateGroupDialog(){ group_json['group']['resources'] = resources; + if ( $('#share_vms', this).prop('checked') ){ + group_json['group']['shared_resources'] = "VM"; + } + if (user_json){ resources = ""; separator = "";