Beispiel #1
0
    def vouch(self, vouchee, system=True, commit=True):
        changed = system # have we changed anything?
        if system:
            self.is_vouched = True
            self.get_ldap_person()
            my_uid = self.get_ldap_person()[1]['uniqueIdentifier'][0]
            their_uid = 'ZUUL'
            larper.record_vouch(their_uid, my_uid)

        if vouchee and vouchee.is_vouched:
            changed = True
            self.is_vouched = True
            self.vouched_by = vouchee
            # TODO: remove this when we take vouch status out of LDAP.
            #       - need to do search filtering of vouch from mysql
            #       - checking of vouch status via profile instead of LDAP
            self.get_ldap_person()
            my_uid = self.get_ldap_person()[1]['uniqueIdentifier'][0]
            their_uid = vouchee.get_ldap_person()[1]['uniqueIdentifier'][0]
            larper.record_vouch(my_uid, their_uid)

        if commit and changed:
            self.save()

            # Email the user and tell them they were vouched.
            self._email_now_vouched()
Beispiel #2
0
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.')
Beispiel #3
0
    def vouch_person(self, new_unique_id):
        request = _mock_request('/en-US/', username='******')
        directory = self.d = UserSession.connect(request)

        ok_(larper.record_vouch('7f3a67u000001', new_unique_id))
        newbie = directory.get_by_unique_id(new_unique_id)
        eq_('7f3a67u000001', newbie.voucher_unique_id)