All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci homebase/form-macros homebase/valid ...
Date: 30 Jun 2006 23:07:33 -0000	[thread overview]
Message-ID: <20060630230733.16613.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-06-30 23:07:32

Modified files:
	luci/homebase  : form-macros validate_perm.js 
	luci/site/luci/Extensions: homebase_adapters.py 

Log message:
	fix case where you want to remove all permissions for a user, select the current user after performing an action on the permissions page

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/form-macros.diff?cvsroot=cluster&r1=1.26&r2=1.27
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/validate_perm.js.diff?cvsroot=cluster&r1=1.1&r2=1.2
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/homebase_adapters.py.diff?cvsroot=cluster&r1=1.10&r2=1.11

--- conga/luci/homebase/form-macros	2006/06/30 21:39:51	1.26
+++ conga/luci/homebase/form-macros	2006/06/30 23:07:32	1.27
@@ -1,7 +1,7 @@
 <html>
 
 <tal:comment replace="nothing">
-	$Id: form-macros,v 1.26 2006/06/30 21:39:51 rmccabe Exp $
+	$Id: form-macros,v 1.27 2006/06/30 23:07:32 rmccabe Exp $
 </tal:comment>
 
 <head>
@@ -173,7 +173,7 @@
 					global num_clusters python:-1;
 					global num_systems python:-1;
 					global blankForm python:1;
-					global curUser request/form/user | request/user | python:here.getDefaultUser()" />
+					global curUser python:here.getDefaultUser(request)" />
 
 	<form name="adminform" method="post" action=""
 		tal:condition="python: curUser and perms and systems and ((systems[0] and len(systems[0]) > 0) or (systems[1] and len(systems[1]) > 0))">
--- conga/luci/homebase/validate_perm.js	2006/06/30 18:06:10	1.1
+++ conga/luci/homebase/validate_perm.js	2006/06/30 23:07:32	1.2
@@ -11,6 +11,7 @@
 	if (error_dialog(errors))
 		return (-1);
 
+	var username = form.userList.options[userIdx].value;
 	var selected_clusters = new Array();
 	var selected_storage = new Array();
 
@@ -33,13 +34,15 @@
 		selected_storage.push(element.value);
 	}
 
-	if (selected_clusters.length + selected_storage.length < 1)
-		return (0);
-
 	if (error_dialog(errors))
 		return (-1);
 
-	if (confirm('Modify permissions for ' + form.userList.options[userIdx].value + '?'))
+	if (selected_clusters.length + selected_storage.length < 1)
+		confirm_str = 'Remove all permissions for ' + username + '?';
+	else
+		confirm_str = 'Modify permissions for ' + username + '?';
+
+	if (confirm(confirm_str))
 		form.submit();
 	return (0);
 }
--- conga/luci/site/luci/Extensions/homebase_adapters.py	2006/06/30 21:39:51	1.10
+++ conga/luci/site/luci/Extensions/homebase_adapters.py	2006/06/30 23:07:32	1.11
@@ -381,10 +381,11 @@
 		return homebasePortal(self, request, '.', '0')
 
 	ret = validatorFn(self, request)
-	request.SESSION.set('checkRet', ret[1])
 	params = None
 	if 'params' in ret[1]:
 		params = ret[1]['params']
+
+	request.SESSION.set('checkRet', ret[1])
 	return homebasePortal(self, request, url, pagetype, params)
 
 def homebaseControl(self, request):
@@ -525,9 +526,11 @@
 		ret['curIndex'] = 0
 
 	if cur and 'absolute_url' in cur and params:
-		cur['baseurl'] = cur['absolute_url']
+		cur['base_url'] = cur['absolute_url']
 		for i in params:
 			cur['absolute_url'] += '&' + cgi.escape(i) + '=' + cgi.escape(params[i])
+	else:
+		cur['base_url'] = cur['absolute_url']
 
 	ret['children'] = temp
 	return ret
@@ -821,11 +824,19 @@
 
 	return errors
 
-def getDefaultUser(self):
+def getDefaultUser(self, request):
 	try:
-		return self.portal_membership.listMembers()[0].getUserName()
+		user = request.form['userList']
 	except:
-		return None
+		try:
+			user = request['user']
+		except:
+			try:
+				user = self.portal_membership.listMembers()[0].getUserName()
+			except:
+				user = None
+
+	return user
 
 def getUserPerms(self):
 	perms = {}



             reply	other threads:[~2006-06-30 23:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-30 23:07 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-10-16 20:46 [Cluster-devel] conga/luci homebase/form-macros homebase/valid rmccabe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060630230733.16613.qmail@sourceware.org \
    --to=rmccabe@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.