fedora-accounts website.py,1.5,1.6
Toshio Ernie Kuratomi (toshio)
fedora-extras-commits at redhat.com
Wed Apr 4 21:38:30 UTC 2007
Author: toshio
Update of /cvs/fedora/fedora-accounts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv9428
Modified Files:
website.py
Log Message:
Fixes to the auto approve SQL to make it properly check for preexistence of
the role and add the user to the dependent group.
Index: website.py
===================================================================
RCS file: /cvs/fedora/fedora-accounts/website.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- website.py 4 Apr 2007 20:40:29 -0000 1.5
+++ website.py 4 Apr 2007 21:38:28 -0000 1.6
@@ -585,20 +585,21 @@
for group in auto_approve_groups[role_group]:
# Check whether the user is already a member of the
# auto-approved group.
- qry = "select role_status from role natural join" \
- " project_group where person_id = %s and" \
+ qry = "select role_status from role as r," \
+ " project_group as pg where" \
+ " person_id = %s and" \
" role_domain = %s and" \
- " name = %s"
+ " pg.name = %s and" \
+ " pg.id = project_group_id"
dbc.execute(qry, (role_user_id, role_domain, group))
checkrole = dbc.fetchone()
-
if checkrole and checkrole[0] != 'approved':
# User is a member but needs to be approved
- qry = "update role natural join project_group" \
- " set role_status = 'approved'" \
+ qry = "update role set role_status = 'approved'" \
" where person_id = %s and" \
" role_domain = %s and" \
- " name = %s"
+ " project_group_id in (select pg.id from" \
+ " project_group as pg where pg.name = %s)"
dbc.execute(qry, (role_user_id, role_domain, group))
dbh.commit()
elif not checkrole:
@@ -606,8 +607,8 @@
qry = "insert into role (person_id," \
" project_group_id, role_domain," \
" role_type, role_status)" \
- " select %s, project_group_id, %s," \
- " 'user', 'approved')" \
+ " select %s, id, %s," \
+ " 'user', 'approved'" \
" from project_group where name = %s"
dbc.execute(qry, (role_user_id, role_domain, group))
dbh.commit()
@@ -615,7 +616,6 @@
# User was already approved for this group.
# Nothing to be done.
pass
-
if action_name != 'approve':
joinmsg = ''
send_email(accounts_email, uinfo['email'], "Your Fedora %s membership has been %s" % (role_group, new_status),
More information about the scm-commits
mailing list