fedora-accounts receive-cla.py, 1.21, 1.22 send-cla.cgi, 1.16, 1.17 website.py, 1.6, 1.7
Toshio Ernie Kuratomi (toshio)
fedora-extras-commits at redhat.com
Wed Apr 4 23:14:55 UTC 2007
Author: toshio
Update of /cvs/fedora/fedora-accounts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv22601
Modified Files:
receive-cla.py send-cla.cgi website.py
Log Message:
receive-cla.py: Add code to autoadd cla_done when cla_fedora is approved. This
is a hack as we realy should be calling website.py to add cla_done for us
instead of duplicating the code here. Unfortunately, website.py mixes UI bits
with data in this function so doing this is non-trivial.
send-cla.cgi, website.py: Change group names ofthe form fedora_cla to
cla_fedora to match cla_done.
Index: receive-cla.py
===================================================================
RCS file: /cvs/fedora/fedora-accounts/receive-cla.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- receive-cla.py 11 Jul 2006 09:13:08 -0000 1.21
+++ receive-cla.py 4 Apr 2007 23:14:52 -0000 1.22
@@ -105,6 +105,42 @@
qargs = (role_row['person_id'], role_row['project_group_id'])
dbc.execute(qry, qargs)
dbh.commit()
+ ### HACK: This is done in website.py:handle_group_mods() but that piece of
+ # code also has UI bits so we can't use it here. Cut and paste. Bleargh.
+ for group in website.auto_approve_groups['cla_fedora']:
+ # Check whether the user is already a member of the
+ # auto-approved group.
+ qry = "select role_status from role as r," \
+ " project_group as pg where" \
+ " person_id = %s and" \
+ " role_domain = %s and" \
+ " pg.name = %s and" \
+ " pg.id = project_group_id"
+ dbc.execute(qry, (role_row['person_id'], role_row['role_domain'], group))
+ checkrole = dbc.fetchone()
+ if checkrole and checkrole[0] != 'approved':
+ # User is a member but needs to be approved
+ qry = "update role set role_status = 'approved'" \
+ " where person_id = %s and" \
+ " role_domain = %s and" \
+ " project_group_id in (select pg.id from" \
+ " project_group as pg where pg.name = %s)"
+ dbc.execute(qry, (role_row['person_id'], role_row['role_domain'], group))
+ dbh.commit()
+ elif not checkrole:
+ # Add the user to the group
+ qry = "insert into role (person_id," \
+ " project_group_id, role_domain," \
+ " role_type, role_status)" \
+ " select %s, id, %s," \
+ " 'user', 'approved'" \
+ " from project_group where name = %s"
+ dbc.execute(qry, (role_row['person_id'], role_row['role_domain'], group))
+ dbh.commit()
+ else:
+ # User was already approved for this group.
+ # Nothing to be done.
+ pass
return msg, person_row, interesting_part
@@ -126,7 +162,8 @@
outmsg.add_header('Subject', 'The Fedora CLA has been successfully completed')
outmsg.set_payload("""
-Your signed Fedora Contributor License Agreement was processed successfully.
+Your signed Fedora Contributor License Agreement titled "%s"
+was processed successfully.
You can now contribute to the Fedora Project. If you intend to work with a
specific Fedora project, you may need to join additional groups in the
Index: send-cla.cgi
===================================================================
RCS file: /cvs/fedora/fedora-accounts/send-cla.cgi,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- send-cla.cgi 4 Apr 2007 20:12:00 -0000 1.16
+++ send-cla.cgi 4 Apr 2007 23:14:52 -0000 1.17
@@ -28,7 +28,7 @@
dbc.execute("SELECT * FROM person WHERE username = %s", (auth_username, ))
arow = dbc.fetchhash()
-dbc.execute("SELECT id FROM project_group WHERE name = 'fedora_cla'")
+dbc.execute("SELECT id FROM project_group WHERE name = 'cla_fedora'")
if not dbc.rowcount:
print "The accounts system is awaiting setup."
sys.exit(1)
Index: website.py
===================================================================
RCS file: /cvs/fedora/fedora-accounts/website.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- website.py 4 Apr 2007 21:38:28 -0000 1.6
+++ website.py 4 Apr 2007 23:14:52 -0000 1.7
@@ -23,9 +23,9 @@
# Mapping of group to groups that are automatically added to a user when the
# original group is approved.
auto_approve_groups = {'cvsextras' : ('fedorabugs',),
- 'dell_cla' : ('cla_done',),
- 'fedora_cla' : ('cla_done',),
- 'redhat_cla' : ('cla_done',)
+ 'cla_dell' : ('cla_done',),
+ 'cla_fedora' : ('cla_done',),
+ 'cla_redhat' : ('cla_done',)
}
fh = aline = pieces = None
More information about the fedora-extras-commits
mailing list