コード例 #1
0
ファイル: models.py プロジェクト: nbailey/quark
    def is_member(self):
        """Return True if this person is a current member of the organization.

        Member status is indicated by having initiated, or by being an officer,
        or by being in the LDAP member database (if LDAP is enabled).
        """
        if self.initiation_term is not None:
            return True

        is_officer = self.is_officer()
        if USE_LDAP:
            is_ldap_member = ldap_utils.is_in_tbp_group(self.user.get_username(), "members")
            return is_officer or is_ldap_member
        return is_officer
コード例 #2
0
ファイル: models.py プロジェクト: ericdwang/quark
    def is_member(self):
        """Return True if this person is a current member of the organization.

        Member status is indicated by having initiated, or by being an officer,
        or by being in the LDAP member database (if LDAP is enabled).
        """
        if self.initiation_term is not None:
            return True

        is_officer = self.is_officer()
        if USE_LDAP:
            is_ldap_member = ldap_utils.is_in_tbp_group(
                self.user.get_username(), 'members')
            return is_officer or is_ldap_member
        return is_officer
コード例 #3
0
ファイル: models.py プロジェクト: nbailey/quark
    def is_officer(self, current=False, exclude_aux=False):
        """Return True if this person is an officer in the organization.

        If current=False, then the method returns True iff the person has ever
        been an officer. If current=True, then the method returns True iff
        the person is currently an officer.

        If exclude_aux is True, then auxiliary positions (positions with
        auxiliary=True) are not counted as officer positions.
        """
        if current:
            term = Term.objects.get_current_term()
        else:
            # If registered as an officer in LDAP (and we don't need to exclude
            # auxiliary positions), then return true
            if USE_LDAP and not exclude_aux and ldap_utils.is_in_tbp_group(self.user.get_username(), "officers"):
                return True
            term = None
        officer_positions = self.get_officer_positions(term)
        if exclude_aux:
            officer_positions = officer_positions.exclude(auxiliary=True)
        return officer_positions.exists()
コード例 #4
0
ファイル: models.py プロジェクト: ericdwang/quark
    def is_officer(self, current=False, exclude_aux=False):
        """Return True if this person is an officer in the organization.

        If current=False, then the method returns True iff the person has ever
        been an officer. If current=True, then the method returns True iff
        the person is currently an officer.

        If exclude_aux is True, then auxiliary positions (positions with
        auxiliary=True) are not counted as officer positions.
        """
        if current:
            term = Term.objects.get_current_term()
        else:
            # If registered as an officer in LDAP (and we don't need to exclude
            # auxiliary positions), then return true
            if (USE_LDAP and not exclude_aux and ldap_utils.is_in_tbp_group(
                    self.user.get_username(), 'officers')):
                return True
            term = None
        officer_positions = self.get_officer_positions(term)
        if exclude_aux:
            officer_positions = officer_positions.exclude(auxiliary=True)
        return officer_positions.exists()