On 09/23/2010 02:51 PM, Endi Sukma Dewata wrote:
- Adam Youngayo...@redhat.com wrote:
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.
NACK. The window_hashchange() is expecting 2 levels of tabs:
var admin_tabs_lists = [
['identity', 'IDENTITY', [
['user', 'Users', ipa_entity_setup],
]]
];
but the self-service tab is only 1 level:
var self_serv_tabs_lists =
[['user', 'Users', ipa_entity_setup]];
Currently window_hashchange()will ignore if there's no 2nd level
tabs defined:
for (var i = 0; i nav_tabs_lists.length; ++i) {
var t = nav_tabs_lists[i]; // 1st level tab
// if no 2nd level tabs - skip
if (typeof t[2] != 'function' t[2].length) {
for (var j = 0; j t[2].length; ++j) {
var tt = t[2][j]; // 2nd level tab
OK, put back the identity tab
There's also a typo on line 44, the variable name should
have been nav_tabs_lists instead of nav_tabs_list. But the
code will still work anyway.
Yeah, that variable was ignored, and it made an implicit Global. Fixed.
--
Endi S. Dewata
From d8b81397936736a0acd4fc4e4d5fc2855a4201f6 Mon Sep 17 00:00:00 2001
From: Adam Young ayo...@redhat.com
Date: Tue, 21 Sep 2010 16:22:45 -0400
Subject: [PATCH] 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
---
install/static/webui.js | 48 ++
1 files changed, 31 insertions(+), 17 deletions(-)
diff --git a/install/static/webui.js b/install/static/webui.js
index ee80140..153a609 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);
--
1.7.1
___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel