admin determination

extends the logic for showing the admin or self service ui to admins by checking for membership in the group admins
added check for group admins
This commit is contained in:
Adam Young 2010-12-01 16:44:44 -05:00
parent 47d61e6cab
commit 85d5bfd1b1

View File

@ -93,9 +93,21 @@ IPA.tab_state = function(entity_name){
} }
} }
/* main (document onready event handler) */ /* main (document onready event handler) */
$(function() { $(function() {
function should_show_all_ui(){
var whoami = IPA.whoami;
if (whoami.hasOwnProperty('memberof_group') &&
whoami.memberof_group.indexOf('admins') !== -1) return true;
return whoami.hasOwnProperty('memberof_rolegroup') &&
whoami.memberof_rolegroup.length > 0;
}
function init_on_win(data, text_status, xhr) { function init_on_win(data, text_status, xhr) {
$(window).bind('hashchange', window_hashchange); $(window).bind('hashchange', window_hashchange);
@ -113,8 +125,7 @@ $(function() {
var navigation = $('#navigation'); var navigation = $('#navigation');
if (whoami.hasOwnProperty('memberof_rolegroup') && if (should_show_all_ui()){
whoami.memberof_rolegroup.length > 0){
IPA.tab_set = admin_tab_set; IPA.tab_set = admin_tab_set;
nav_create(admin_tab_set, navigation, 'tabs'); nav_create(admin_tab_set, navigation, 'tabs');
} else { } else {