summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2010-09-21 16:22:45 -0400
committerAdam Young <ayoung@redhat.com>2010-09-23 16:38:00 -0400
commitf1f9c37a55b877caeaeeb2223de8c57b192fab26 (patch)
tree380f74a32d29586aa45bc877376b5bf3f6aec5a4 /install
parent3d3197b11a6e7c6222f78648977b2ab30d848f1a (diff)
downloadfreeipa-f1f9c37a55b877caeaeeb2223de8c57b192fab26.tar.gz
freeipa-f1f9c37a55b877caeaeeb2223de8c57b192fab26.tar.xz
freeipa-f1f9c37a55b877caeaeeb2223de8c57b192fab26.zip
self-service
Selects the site map based on the presence or absense of rolegroups for the current user. If the user has no rolegroups, UI defaults to the Details page for that user. Corrected to leave two levels of tabs
Diffstat (limited to 'install')
-rw-r--r--install/static/webui.js48
1 files changed, 31 insertions, 17 deletions
diff --git a/install/static/webui.js b/install/static/webui.js
index ee801408e..153a60965 100644
--- a/install/static/webui.js
+++ b/install/static/webui.js
@@ -21,7 +21,7 @@
/* REQUIRES: everything, this file puts it all togheter */
/* tabs definition for IPA webUI */
-var nav_tabs_lists = [
+var admin_tabs_lists = [
['identity', 'IDENTITY', [
['user', 'Users', ipa_entity_setup],
['group', 'Groups', ipa_entity_setup],
@@ -36,29 +36,43 @@ var nav_tabs_lists = [
]]
];
+
+var self_serv_tabs_lists =
+ [
+ ['identity', 'IDENTITY', [
+ ['user', 'Users', ipa_entity_setup]]]];
+
+var nav_tabs_lists;
+
/* main (document onready event handler) */
$(function() {
- function set_logged_in_as(principal) {
- $.cookie('whoami', principal);
- $('#loggedinas').find('strong').text(principal);
- };
function whoami_on_win(data, text_status, xhr) {
- if (!data.error)
- set_logged_in_as(data.result.summary);
+ $(window).bind('hashchange', window_hashchange);
+ if (!data.error){
+ var whoami = data.result.result[0];
+ $('#loggedinas').find('strong').text(whoami.krbprincipalname[0]);
+ if (whoami.hasOwnProperty('memberof_rolegroup') &&
+ whoami.memberof_rolegroup.length > 0){
+ nav_tabs_lists = admin_tabs_lists;
+ window_hashchange(null);
+ }else{
+ nav_tabs_lists = self_serv_tabs_lists;
+
+ var state = {'user-pkey': whoami.uid[0],
+ 'user-facet': jQuery.bbq.getState('user-facet') ||
+ 'details'};
+ $.bbq.pushState(state);
+ }
+ nav_create(nav_tabs_lists, $('#navigation'), 'tabs');
+
+ }else{
+ alert("Unable to find prinicpal for logged in user");
+ }
};
function init_on_win(data, text_status, xhr) {
- nav_create(nav_tabs_lists, $('#navigation'), 'tabs');
-
- $(window).bind('hashchange', window_hashchange);
- window_hashchange(null);
-
- var whoami = $.cookie('whoami');
- if (whoami)
- set_logged_in_as(whoami);
- else
- ipa_cmd('whoami', [], {}, whoami_on_win, null, null, 'sampledata/whoami.json');
+ ipa_cmd('user_find', [], {"whoami":"true","all":"true"}, whoami_on_win, null, null);
};
ipa_init(null, init_on_win);