[Kimchi-devel] [PATCH 3/4] Authorization: remove [+] icon from non-root users view
Aline Manera
alinefm at linux.vnet.ibm.com
Fri Jul 18 17:42:55 UTC 2014
On 07/18/2014 08:18 AM, wenwang at linux.vnet.ibm.com wrote:
> From: Wen Wang <wenwang at linux.vnet.ibm.com>
>
> This patch removes [+] icon from the toolbar for users without 'admin'
> role
>
> Signed-off-by: Wen Wang <wenwang at linux.vnet.ibm.com>
> ---
> ui/js/src/kimchi.guest_main.js | 4 ++++
> ui/js/src/kimchi.network.js | 4 ++++
> ui/js/src/kimchi.storage_main.js | 4 ++++
You need to do the same for the templates tab
> 3 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/ui/js/src/kimchi.guest_main.js b/ui/js/src/kimchi.guest_main.js
> index acbae15..3d3a4b8 100644
> --- a/ui/js/src/kimchi.guest_main.js
> +++ b/ui/js/src/kimchi.guest_main.js
> @@ -323,6 +323,10 @@ kimchi.guestSetRequestHeader = function(xhr) {
> };
>
> kimchi.guest_main = function() {
> + var guestsMode = kimchi.cookie.get('GuestsMode');
> + if(guestsMode != 'admin') {
> + $('.tools').remove();
> + }
> $("#vm-add").on("click", function(event) {
> kimchi.window.open('guest-add.html');
> });
> diff --git a/ui/js/src/kimchi.network.js b/ui/js/src/kimchi.network.js
> index cbd967f..a44e33c 100644
> --- a/ui/js/src/kimchi.network.js
> +++ b/ui/js/src/kimchi.network.js
> @@ -19,6 +19,10 @@
> kimchi.NETWORK_TYPE_BRIDGE = "bridged";
>
> kimchi.initNetwork = function() {
> + var networkMode = kimchi.cookie.get('NetworkMode');
> + if(networkMode != 'admin') {
> + $('.tools').remove();
> + }
> kimchi.initNetworkListView();
> kimchi.initNetworkDialog();
> kimchi.initNetworkCreation();
> diff --git a/ui/js/src/kimchi.storage_main.js b/ui/js/src/kimchi.storage_main.js
> index 3a18f82..593e7b1 100644
> --- a/ui/js/src/kimchi.storage_main.js
> +++ b/ui/js/src/kimchi.storage_main.js
> @@ -234,6 +234,10 @@ kimchi.initLogicalPoolExtend = function() {
> }
>
> kimchi.storage_main = function() {
> + var storageMode = kimchi.cookie.get('StorageMode');
> + if(storageMode != 'admin') {
> + $('.tools').remove();
> + }
> $('#storage-pool-add').on('click', function() {
> kimchi.window.open('storagepool-add.html');
> });
More information about the Kimchi-devel
mailing list