diff --git a/fas/client/fasClient b/fas/client/fasClient index 3e3097c..defa10b 100755 --- a/fas/client/fasClient +++ b/fas/client/fasClient @@ -436,7 +436,7 @@ class MakeShellAccounts(BaseClient): def create_ssh_keys(self): ''' Create ssh keys ''' - home_base = config.get('users', 'home').strip('"') + home_base = prefix + config.get('users', 'home').strip('"') for person in self.people: username = person['username'] if self.valid_user(username): diff --git a/fas/convert.py b/fas/convert.py index 96b46b6..cd90d2a 100644 --- a/fas/convert.py +++ b/fas/convert.py @@ -62,6 +62,7 @@ for person in c.fetchall(): p.internal_comments = internal_comments p.ircnick = ircnick p.status = 'active' + p.email = email try: session.flush() except IntegrityError, e: @@ -69,25 +70,6 @@ for person in c.fetchall(): session.close() continue - person_email = PersonEmails() - try: - person_email.email = email - except AttributeError: - print "\tERROR - Could not create email for %s (%s)" % (username, email) - session.close() - continue - person_email.person = p - person_email.description = 'Fedora Email' - person_email.verified = True # The first email is verified for free, since this is where their password is sent. - session.flush() - - - email_purpose = EmailPurposes() - email_purpose.person = p - email_purpose.person_email = person_email - email_purpose.purpose = 'primary' - session.flush() - c.execute('select id, name, owner_id, group_type, needs_sponsor, user_can_remove, prerequisite_id, joinmsg from project_group;') bool_dict = {0 : False, 1 : True} print "Creating Groups..." diff --git a/fas/fas/cla.py b/fas/fas/cla.py index 8782df6..69001cf 100644 --- a/fas/fas/cla.py +++ b/fas/fas/cla.py @@ -135,7 +135,7 @@ class CLA(controllers.Controller): emails = []; for uid in key.uids: emails.extend([uid.email]) - if person.emails['primary'] in emails: + if person.email in emails: verified = True else: turbogears.flash(_('Your key did not match your email.')) @@ -181,7 +181,7 @@ class CLA(controllers.Controller): message.plain = ''' Fedora user %(username)s has signed a completed ICLA using their published GPG key, ID %(gpg_keyid)s, that is associated with e-mail address %(email)s. The full signed ICLA is attached. -''' % {'username': person.username, 'gpg_keyid': person.gpg_keyid, 'email': person.emails['primary']} +''' % {'username': person.username, 'gpg_keyid': person.gpg_keyid, 'email': person.email} signature.file.seek(0) # For another read() message.attach(signature.file, signature.filename) turbomail.enqueue(message) diff --git a/fas/fas/group.py b/fas/fas/group.py index ba88f8b..3fc4b1b 100644 --- a/fas/fas/group.py +++ b/fas/fas/group.py @@ -308,7 +308,7 @@ Fedora user %(user)s, aka %(name)s <%(email)s> has requested membership for %(applicant)s (%(applicant_name)s) in the %(group)s group and needs a sponsor. Please go to %(url)s to take action. -''') % {'user': person.username, 'name': person.human_name, 'applicant': target.username, 'applicant_name': target.human_name, 'email': person.emails['primary'], 'url': url, 'group': group.name} +''') % {'user': person.username, 'name': person.human_name, 'applicant': target.username, 'applicant_name': target.human_name, 'email': person.email, 'url': url, 'group': group.name} turbomail.enqueue(message) turbogears.flash(_('%(user)s has applied to %(group)s!') % \ {'user': target.username, 'group': group.name}) @@ -339,14 +339,14 @@ Please go to %(url)s to take action. turbogears.redirect('/group/view/%s' % group.name) else: import turbomail - message = turbomail.Message(config.get('accounts_email'), target.emails['primary'], "Your Fedora '%s' membership has been sponsored" % group.name) + message = turbomail.Message(config.get('accounts_email'), target.email, "Your Fedora '%s' membership has been sponsored" % group.name) message.plain = _(''' %(name)s <%(email)s> has sponsored you for membership in the %(group)s group of the Fedora account system. If applicable, this change should propagate into the e-mail aliases and CVS repository within an hour. %(joinmsg)s -''') % {'group': group.name, 'name': person.human_name, 'email': person.emails['primary'], 'joinmsg': group.joinmsg} +''') % {'group': group.name, 'name': person.human_name, 'email': person.email, 'joinmsg': group.joinmsg} turbomail.enqueue(message) turbogears.flash(_("'%s' has been sponsored!") % target.human_name) turbogears.redirect('/group/view/%s' % group.name) @@ -376,13 +376,13 @@ propagate into the e-mail aliases and CVS repository within an hour. {'user': target.username, 'group': group.name, 'error': e}) turbogears.redirect('/group/view/%s' % group.name) else: - message = turbomail.Message(config.get('accounts_email'), target.emails['primary'], "Your Fedora '%s' membership has been removed" % group.name) + message = turbomail.Message(config.get('accounts_email'), target.email, "Your Fedora '%s' membership has been removed" % group.name) message.plain = _(''' %(name)s <%(email)s> has removed you from the '%(group)s' group of the Fedora Accounts System This change is effective immediately for new operations, and should propagate into the e-mail aliases within an hour. -''') % {'group': group.name, 'name': person.human_name, 'email': person.emails['primary']} +''') % {'group': group.name, 'name': person.human_name, 'email': person.email} turbomail.enqueue(message) turbogears.flash(_('%(name)s has been removed from %(group)s') % \ {'name': target.username, 'group': group.name}) @@ -413,7 +413,7 @@ aliases within an hour. turbogears.redirect('/group/view/%s' % group.name) else: import turbomail - message = turbomail.Message(config.get('accounts_email'), target.emails['primary'], "Your Fedora '%s' membership has been upgraded" % group.name) + message = turbomail.Message(config.get('accounts_email'), target.email, "Your Fedora '%s' membership has been upgraded" % group.name) # Should we make person.upgrade return this? role = PersonRoles.query.filter_by(group=group, member=target).one() status = role.role_type @@ -422,7 +422,7 @@ aliases within an hour. '%(group)s' group of the Fedora Accounts System This change is effective immediately for new operations, and should propagate into the e-mail aliases within an hour. -''') % {'group': group.name, 'name': person.human_name, 'email': person.emails['primary'], 'status': status} +''') % {'group': group.name, 'name': person.human_name, 'email': person.email, 'status': status} turbomail.enqueue(message) turbogears.flash(_('%s has been upgraded!') % target.username) turbogears.redirect('/group/view/%s' % group.name) @@ -452,7 +452,7 @@ into the e-mail aliases within an hour. turbogears.redirect('/group/view/%s' % group.name) else: import turbomail - message = turbomail.Message(config.get('accounts_email'), target.emails['primary'], "Your Fedora '%s' membership has been downgraded" % group.name) + message = turbomail.Message(config.get('accounts_email'), target.email, "Your Fedora '%s' membership has been downgraded" % group.name) role = PersonRoles.query.filter_by(group=group, member=target).one() status = role.role_type message.plain = _(''' @@ -460,7 +460,7 @@ into the e-mail aliases within an hour. '%(group)s' group of the Fedora Accounts System This change is effective immediately for new operations, and should propagate into the e-mail aliases within an hour. -''') % {'group': group.name, 'name': person.human_name, 'email': person.emails['primary'], 'status': status} +''') % {'group': group.name, 'name': person.human_name, 'email': person.email, 'status': status} turbomail.enqueue(message) turbogears.flash(_('%s has been downgraded!') % target.username) turbogears.redirect('/group/view/%s' % group.name) @@ -504,7 +504,7 @@ into the e-mail aliases within an hour. group = Groups.by_name(groupname) if isApproved(person, group): - message = turbomail.Message(person.emails['primary'], target, _('Come join The Fedora Project!')) + message = turbomail.Message(person.email, target, _('Come join The Fedora Project!')) message.plain = _(''' %(name)s <%(email)s> has invited you to join the Fedora Project! We are a community of users and developers who produce a @@ -520,7 +520,7 @@ place for you whether you're an artist, a web site builder, a writer, or a people person. You'll grow and learn as you work on a team with other very smart and talented people. -Fedora and FOSS are changing the world -- come be a part of it!''') % {'name': person.human_name, 'email': person.emails['primary']} +Fedora and FOSS are changing the world -- come be a part of it!''') % {'name': person.human_name, 'email': person.email} turbomail.enqueue(message) turbogears.flash(_('Message sent to: %s') % target) turbogears.redirect('/group/view/%s' % group.name) diff --git a/fas/fas/help.py b/fas/fas/help.py index 3f3d229..80afefd 100644 --- a/fas/fas/help.py +++ b/fas/fas/help.py @@ -4,10 +4,11 @@ from turbogears.database import session from fas.auth import * +# TODO: gettext like crazy. class Help(controllers.Controller): help = { 'none' : ['Error', '
We could not find that help item
'], 'user_ircnick' : ['IRC Nick (Optional)', 'IRC Nick is used to identify yourself on irc.freenode.net. Please register your nick on irc.freenode.net first, then fill this in so people can find you online when they need to
'], - 'user_primary_email' : ['Primary Email (Required)', 'This email address should be your prefered email contact and will be used to send various official emails to. This is also where your @fedoraproject.org email will get forwarded
'], + 'user_email' : ['Email (Required)', 'This email address should be your prefered email contact and will be used to send various official emails to. This is also where your @fedoraproject.org email will get forwarded
'], 'user_human_name' : ['Full Name (Required)', 'Your Human Name or "real life" name
'], 'user_gpg_keyid' : ['GPG Key', 'Only required for users signing the CLA. It is generally used to prove that a message or email came from you or to encrypt information so that only the recipients can read it. See the CLAHowTo for more information
'], 'user_telephone' : ['Telephone', 'Only required for users signing the CLA. Sometimes during a time of emergency someone from the Fedora Project may need to contact you. For more information see our Privacy Policy
'], diff --git a/fas/fas/model.py b/fas/fas/model.py index 4f39024..c345665 100644 --- a/fas/fas/model.py +++ b/fas/fas/model.py @@ -56,14 +56,10 @@ get_engine() # PeopleTable = Table('people', metadata, autoload=True) -PersonEmailsTable = Table('person_emails', metadata, autoload=True) -EmailPurposesTable = Table('email_purposes', metadata, autoload=True) PersonRolesTable = Table('person_roles', metadata, autoload=True) ConfigsTable = Table('configs', metadata, autoload=True) GroupsTable = Table('groups', metadata, autoload=True) -GroupEmailsTable = Table('group_emails', metadata, autoload=True) -GroupEmailPurposesTable = Table('group_email_purposes', metadata, autoload=True) GroupRolesTable = Table('group_roles', metadata, autoload=True) BugzillaQueueTable = Table('bugzilla_queue', metadata, autoload=True) LogTable = Table('log', metadata, autoload=True) @@ -116,7 +112,7 @@ class People(SABase): A class method that can be used to search users based on their email addresses since it is unique. ''' - return cls.query.join(['email_purposes', 'person_email']).filter_by(email=email).one() + return cls.query.filter_by(email=email).one() @classmethod def by_username(cls, username): @@ -250,8 +246,12 @@ class People(SABase): if not identity.in_group('admin'): # Only admins can see internal_comments del props['internal_comments'] + del props['emailtoken'] if identity.current.anonymous: # Anonymous users can't see any of these + del props['email'] + del props['emailtoken'] + del props['unverified_email'] del props['ssh_key'] del props['gpg_keyid'] del props['affiliation'] @@ -262,8 +262,10 @@ class People(SABase): del props['postal_address'] del props['telephone'] del props['facsimile'] + # TODO: Are we still doing the fas-system thing? I think I saw a systems users somewhere... elif not identity.current.user.username == self.username and 'fas-system' not in identity.current.groups: # Only an admin or the user themselves can see these fields + del props['unverified_email'] del props['password'] del props['passwordtoken'] del props['postal_address'] @@ -277,19 +279,6 @@ class People(SABase): approved_memberships = association_proxy('approved_roles', 'group') unapproved_memberships = association_proxy('unapproved_roles', 'group') - emails = association_proxy('email_purposes', 'email') - -class PersonEmails(SABase): - '''Map a person to an email address.''' - def __repr__(cls): - return "PersonEmails(%s,%s,%s,%s)" % (cls.person.username, cls.email, cls.description, cls.verified) - -class EmailPurposes(SABase): - '''Map a person to an email (with a purpose).''' - def __repr__(cls): - return "EmailPurposes(%s,%s,%s)" % (cls.person.username, cls.email, cls.purpose) - email = association_proxy('person_email', 'email') - class PersonRoles(SABase): '''Record people that are members of groups.''' def __repr__(cls): @@ -317,7 +306,7 @@ class Groups(SABase): A class method that can be used to search groups based on their email addresses since it is unique. ''' - return cls.query.join(['email_purposes', 'group_email']).filter_by(email=email).one() + return cls.query.filter_by(email=email).one() @classmethod @@ -338,21 +327,6 @@ class Groups(SABase): # Groups that this group belongs to memberships = association_proxy('group_roles', 'group') - emails = association_proxy('email_purposes', 'email') - -class GroupEmails(SABase): - '''Map a group to an email address.''' - def __repr__(cls): - return "GroupEmails(%s,%s,%s,%s)" % (cls.group.name, cls.email, cls.description, cls.verified) - -class GroupEmailPurposes(SABase): - '''Map a group to an email (with a purpose).''' - def __repr__(cls): - return "GroupEmailPurposes(%s,%s,%s)" % (cls.group.name, cls.email, cls.purpose) - - email = association_proxy('group_email', 'email') - - class GroupRoles(SABase): '''Record groups that are members of other groups.''' pass @@ -420,12 +394,6 @@ mapper(UnApprovedRoles, UnApprovedRolesSelect, properties = { }) mapper(People, PeopleTable, properties = { - 'email_purposes': relation(EmailPurposes, backref = 'person', - collection_class = column_mapped_collection( - EmailPurposesTable.c.purpose)), - 'person_emails': relation(PersonEmails, backref = 'person', - collection_class = column_mapped_collection( - PersonEmailsTable.c.email)), # This name is kind of confusing. It's to allow person.group_roles['groupname'] in order to make auth.py (hopefully) slightly faster. 'group_roles': relation(PersonRoles, collection_class = attribute_mapped_collection('groupname'), @@ -435,11 +403,6 @@ mapper(People, PeopleTable, properties = { 'unapproved_roles': relation(UnApprovedRoles, backref='member', primaryjoin = PeopleTable.c.id==UnApprovedRoles.c.person_id) }) -mapper(PersonEmails, PersonEmailsTable) -mapper(EmailPurposes, EmailPurposesTable, properties = { - 'person_email': relation(PersonEmails, uselist = False, - primaryjoin = PersonEmailsTable.c.id==EmailPurposesTable.c.email_id) - }) mapper(PersonRoles, PersonRolesTable, properties = { 'member': relation(People, backref = 'roles', lazy = False, primaryjoin=PersonRolesTable.c.person_id==PeopleTable.c.id), @@ -454,20 +417,9 @@ mapper(Configs, ConfigsTable, properties = { mapper(Groups, GroupsTable, properties = { 'owner': relation(People, uselist=False, primaryjoin = GroupsTable.c.owner_id==PeopleTable.c.id), - 'email_purposes': relation(GroupEmailPurposes, backref = 'group', - collection_class = column_mapped_collection( - GroupEmailPurposesTable.c.purpose)), - 'group_emails': relation(GroupEmails, backref = 'group', - collection_class = column_mapped_collection( - GroupEmailsTable.c.email)), 'prerequisite': relation(Groups, uselist=False, primaryjoin = GroupsTable.c.prerequisite_id==GroupsTable.c.id) }) -mapper(GroupEmails, GroupEmailsTable) -mapper(GroupEmailPurposes, GroupEmailPurposesTable, properties = { - 'group_email': relation(GroupEmails, uselist = False, - primaryjoin = GroupEmailsTable.c.id==GroupEmailPurposesTable.c.email_id) - }) # GroupRoles are complex because the group is a member of a group and thus # is referencing the same table. mapper(GroupRoles, GroupRolesTable, properties = { diff --git a/fas/fas/release.py b/fas/fas/release.py index a1d54fd..5ebac71 100644 --- a/fas/fas/release.py +++ b/fas/fas/release.py @@ -2,7 +2,7 @@ Release information about the Fedora Accounts System ''' -VERSION = '0.1' +VERSION = '0.5' NAME = 'fas' DESCRIPTION = 'The Fedora Account System' LONG_DESCRIPTION = ''' diff --git a/fas/fas/templates/cla/cla.html b/fas/fas/templates/cla/cla.html index 5a5b0e8..34643a3 100644 --- a/fas/fas/templates/cla/cla.html +++ b/fas/fas/templates/cla/cla.html @@ -20,7 +20,7 @@
Full name: ${person.human_name}
- E-Mail: ${person.emails['primary']}
+ E-Mail: ${person.email}
Address: ${person.postal_address}
Telephone: ${person.telephone}
diff --git a/fas/fas/templates/cla/cla.txt b/fas/fas/templates/cla/cla.txt
index 68e0a18..38451aa 100644
--- a/fas/fas/templates/cla/cla.txt
+++ b/fas/fas/templates/cla/cla.txt
@@ -27,7 +27,7 @@
fedora-legal@redhat.com. Please read this document carefully before
signing and keep a copy for your records.
- Full name: ${'%28s' % person.human_name} E-Mail: ${'%17s' % person.emails['primary']}
+ Full name: ${'%28s' % person.human_name} E-Mail: ${'%17s' % person.email}
Address:
${person.postal_address}
@@ -150,5 +150,5 @@ ${person.postal_address}
If you agree to these terms and conditions, type "I agree" here:
Enter your full name here:
- E-mail: ${person.emails['primary']}
+ E-mail: ${person.email}
Date: ${date}
diff --git a/fas/fas/templates/cla/view.html b/fas/fas/templates/cla/view.html
index b084fe6..6c2c1a5 100644
--- a/fas/fas/templates/cla/view.html
+++ b/fas/fas/templates/cla/view.html
@@ -19,7 +19,7 @@