Пример #1
0
// HandleError suppresses member lookup errors caused by no such object or entry not found errors,
func (h *memberLookupMemberNotFoundSuppressor) HandleError(err error) (bool, error) {
	memberLookupError, isMemberLookupError := err.(*memberLookupError)
	if !isMemberLookupError {
		return false, nil
	}

	if ldaputil.IsEntryNotFoundError(memberLookupError.causedBy) || ldaputil.IsNoSuchObjectError(memberLookupError.causedBy) {
		fmt.Fprintf(h.err, "For group %q, ignoring member %q: %v\n", memberLookupError.ldapGroupUID, memberLookupError.ldapUserUID, memberLookupError.causedBy)
		return true, nil
	}

	return false, nil
}
Пример #2
0
func (l *MemberBasedDetector) Exists(ldapGrouUID string) (bool, error) {
	members, err := l.memberExtractor.ExtractMembers(ldapGrouUID)
	if ldaputil.IsQueryOutOfBoundsError(err) || ldaputil.IsEntryNotFoundError(err) || ldaputil.IsNoSuchObjectError(err) {
		return false, nil
	}
	if err != nil {
		return false, err
	}

	if len(members) == 0 {
		return false, nil
	}

	return true, nil
}
Пример #3
0
func (l *GroupBasedDetector) Exists(ldapGroupUID string) (bool, error) {
	group, err := l.groupGetter.GroupEntryFor(ldapGroupUID)
	if ldaputil.IsQueryOutOfBoundsError(err) || ldaputil.IsEntryNotFoundError(err) || ldaputil.IsNoSuchObjectError(err) {
		return false, nil
	}
	if err != nil {
		return false, err
	}

	if group == nil {
		return false, nil
	}

	return true, nil
}