2010-09-16 09:28:07 -05:00
|
|
|
/* Authors:
|
|
|
|
* Pavel Zuna <pzuna@redhat.com>
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Red Hat
|
|
|
|
* see file 'COPYING' for use and warranty information
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; version 2 only
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* REQUIRES: everything, this file puts it all togheter */
|
|
|
|
|
|
|
|
/* tabs definition for IPA webUI */
|
2010-09-28 18:20:02 -05:00
|
|
|
|
|
|
|
|
|
|
|
var admin_tab_set = [
|
2010-10-06 16:24:58 -05:00
|
|
|
{name:'identity', children:[
|
2010-09-28 18:20:02 -05:00
|
|
|
{name:'user', label:'Users', setup: ipa_entity_setup},
|
|
|
|
{name:'group', label:'Groups', setup: ipa_entity_setup},
|
|
|
|
{name:'host', label:'Hosts', setup: ipa_entity_setup},
|
|
|
|
{name:'hostgroup', label:'Hostgroups', setup: ipa_entity_setup},
|
|
|
|
{name:'netgroup', label:'Netgroups', setup: ipa_entity_setup},
|
2010-09-30 15:37:33 -05:00
|
|
|
{name:'service', label:'Services', setup: ipa_entity_setup}
|
2010-09-28 18:20:02 -05:00
|
|
|
]},
|
2010-10-06 16:24:58 -05:00
|
|
|
{name:'policy', children:[
|
|
|
|
{name:'hbac', setup: ipa_entity_setup},
|
|
|
|
{name:'dns', setup: ipa_entity_setup},
|
|
|
|
{name:'automountlocation', setup: ipa_entity_setup},
|
|
|
|
{name:'pwpolicy', setup: ipa_entity_setup},
|
|
|
|
{name:'krbtpolicy', setup:ipa_details_only_setup}
|
|
|
|
]},
|
|
|
|
{name:'ipaserver', children: [
|
|
|
|
// {name:'aci', setup: ipa_entity_setup},
|
|
|
|
{name:'taskgroup', setup: ipa_entity_setup},
|
|
|
|
{name:'rolegroup', label:'Rolegroups', setup: ipa_entity_setup},
|
|
|
|
{name:'config', setup: ipa_details_only_setup}
|
2010-09-28 18:20:02 -05:00
|
|
|
]}
|
2010-09-16 09:28:07 -05:00
|
|
|
];
|
|
|
|
|
2010-09-30 15:37:33 -05:00
|
|
|
var self_serv_tab_set =
|
2010-09-21 15:22:45 -05:00
|
|
|
[
|
2010-09-28 18:20:02 -05:00
|
|
|
{ name:'identity', label:'IDENTITY', children: [
|
|
|
|
{name:'user', label:'Users', setup:ipa_entity_setup}]}];
|
2010-09-21 15:22:45 -05:00
|
|
|
|
2010-10-15 13:06:23 -05:00
|
|
|
|
|
|
|
var ipa_whoami_pkey;
|
|
|
|
|
|
|
|
|
2010-09-16 09:28:07 -05:00
|
|
|
/* main (document onready event handler) */
|
|
|
|
$(function() {
|
|
|
|
|
2010-09-24 09:47:40 -05:00
|
|
|
|
2010-09-16 09:28:07 -05:00
|
|
|
function whoami_on_win(data, text_status, xhr) {
|
2010-09-21 15:22:45 -05:00
|
|
|
$(window).bind('hashchange', window_hashchange);
|
|
|
|
if (!data.error){
|
|
|
|
var whoami = data.result.result[0];
|
2010-10-15 13:06:23 -05:00
|
|
|
ipa_whoami_pkey=whoami.uid[0];
|
2010-09-21 15:22:45 -05:00
|
|
|
$('#loggedinas').find('strong').text(whoami.krbprincipalname[0]);
|
2010-09-24 09:47:40 -05:00
|
|
|
$('#loggedinas a').fragment(
|
2010-10-15 13:06:23 -05:00
|
|
|
{'user-facet':'details', 'user-pkey':ipa_whoami_pkey},2);
|
2010-09-30 15:37:33 -05:00
|
|
|
|
|
|
|
var navigation = $('#navigation');
|
|
|
|
|
2010-09-21 15:22:45 -05:00
|
|
|
if (whoami.hasOwnProperty('memberof_rolegroup') &&
|
|
|
|
whoami.memberof_rolegroup.length > 0){
|
2010-09-30 15:37:33 -05:00
|
|
|
nav_create(admin_tab_set, navigation, 'tabs');
|
|
|
|
|
2010-09-21 15:22:45 -05:00
|
|
|
}else{
|
2010-09-30 15:37:33 -05:00
|
|
|
nav_create(self_serv_tab_set, navigation, 'tabs');
|
2010-09-16 09:28:07 -05:00
|
|
|
|
2010-10-15 13:06:23 -05:00
|
|
|
var state = {'user-pkey':ipa_whoami_pkey ,
|
2010-09-21 15:22:45 -05:00
|
|
|
'user-facet': jQuery.bbq.getState('user-facet') ||
|
|
|
|
'details'};
|
|
|
|
$.bbq.pushState(state);
|
|
|
|
}
|
2010-09-27 23:35:09 -05:00
|
|
|
|
|
|
|
|
2010-09-24 19:48:23 -05:00
|
|
|
$('#login_header').html(ipa_messages.login.header);
|
2010-09-21 15:22:45 -05:00
|
|
|
}else{
|
|
|
|
alert("Unable to find prinicpal for logged in user");
|
|
|
|
}
|
|
|
|
};
|
2010-09-16 09:28:07 -05:00
|
|
|
|
2010-09-21 15:22:45 -05:00
|
|
|
function init_on_win(data, text_status, xhr) {
|
2010-09-29 00:52:56 -05:00
|
|
|
ipa_cmd('user_find', [], {"whoami":"true","all":"true"}, whoami_on_win, init_on_error, null);
|
2010-09-16 09:28:07 -05:00
|
|
|
};
|
|
|
|
|
2010-09-29 00:52:56 -05:00
|
|
|
function init_on_error(xhr, text_status, error_thrown) {
|
|
|
|
var navigation = $('#navigation').empty();
|
|
|
|
navigation.append('<p>Error: '+error_thrown.name+'</p>');
|
2010-10-06 15:09:14 -05:00
|
|
|
navigation.append('<p>URL: '+this.url+'</p>');
|
2010-09-29 00:52:56 -05:00
|
|
|
navigation.append('<p>'+error_thrown.message+'</p>');
|
|
|
|
}
|
2010-09-16 09:28:07 -05:00
|
|
|
|
2010-09-29 00:52:56 -05:00
|
|
|
ipa_init(null, null, init_on_win, init_on_error);
|
|
|
|
});
|
2010-09-16 09:28:07 -05:00
|
|
|
|
|
|
|
/* main loop (hashchange event handler) */
|
|
|
|
function window_hashchange(evt)
|
|
|
|
{
|
2010-09-30 15:37:33 -05:00
|
|
|
nav_update_tabs();
|
2010-09-16 09:28:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/* builder function for unimplemented tab content */
|
|
|
|
function unimplemented_tab(jobj)
|
|
|
|
{
|
|
|
|
jobj.text('Not implemented yet!');
|
|
|
|
}
|
|
|
|
|