Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

Commit

Permalink
Fix issues with vouching omgs
Browse files Browse the repository at this point in the history
  • Loading branch information
tofumatt committed Dec 22, 2011
1 parent d6bb6ac commit 280bec5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions apps/users/cron.py
@@ -1,3 +1,5 @@
from ldap import TYPE_OR_VALUE_EXISTS

from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist

Expand Down Expand Up @@ -84,3 +86,22 @@ def vouchify():
user.save()
log.info('Data copied for %s' % user.user.username)
log.debug('%s is still unvouched... skipping' % user.user.username)


@cronjobs.register
def fix_bad_ldap_vouch():
"""Synchronizes MySQL vouch data into broken LDAP accounts.
Just vouches them as ZUUL because the MySQL vouch data is good and what
we'll use going forward.
"""
users = UserProfile.objects.filter(is_vouched=True)

for user in users:
person = user.get_ldap_person()

if person:
try:
larper.record_vouch('ZUUL', person[1]['uniqueIdentifier'][0])
except TYPE_OR_VALUE_EXISTS:
log.info('User is already vouched; no big.')
2 changes: 1 addition & 1 deletion apps/users/models.py
Expand Up @@ -51,7 +51,7 @@ def vouch(self, vouchee, system=True, commit=True):
self.is_vouched = True
self.get_ldap_person()
my_uid = self.get_ldap_person()[1]['uniqueIdentifier'][0]
their_uid = 'uniqueIdentifier=ZUUL,ou=people,dc=mozillians,dc=org'
their_uid = 'ZUUL'
larper.record_vouch(their_uid, my_uid)

if vouchee and vouchee.is_vouched:
Expand Down

0 comments on commit 280bec5

Please sign in to comment.