[Kimchi-devel] [PATCH 3/4] Authorization: remove [+] icon from non-root users view

Aline Manera alinefm at linux.vnet.ibm.com
Mon Jul 21 19:40:31 UTC 2014


On 07/21/2014 09:02 AM, Wen Wang wrote:
> I have tried. By using stored roles in cookie. we need to query for 
> mode in the xml file everytime we load a tab. It is time consuming and 
> the "+" button as well as the action buttons will blink if we try to 
> make it invisible since the query for tabs.xml is time consuming. Can 
> I store the "mode" parameter in cookie with a json file or maybe 
> "tabMode" that transfer from the "role" so that will make the init 
> more efficiently.
>

I think it can work pretty well.
You can store the tab mode in a cookie while loading it to use it later 
when needed.

> thanks
>
> On 07/19/2014 01:47 AM, Aline Manera wrote:
>>
>> Never mind.
>>
>> Just remembered the templates tab will not be displayed for a "user" 
>> role
>>
>> Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>
>>
>> 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 ++++
>>>   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