예제 #1
0
func getOpenShiftGroupListerMapper(host string, info OpenShiftGroupNameRestrictions) (interfaces.LDAPGroupListerNameMapper, error) {
	if len(info.GetWhitelist()) != 0 {
		return syncgroups.NewOpenShiftGroupLister(info.GetWhitelist(), info.GetBlacklist(), host, info.GetClient()), nil
	} else {
		return syncgroups.NewAllOpenShiftGroupLister(info.GetBlacklist(), host, info.GetClient()), nil
	}
}
예제 #2
0
func (o *SyncGroupsOptions) GetOpenShiftGroupListerMapper(host string) (interfaces.LDAPGroupListerNameMapper, error) {
	if o.Source != GroupSyncSourceOpenShift {
		return nil, errors.New("openshift is not a valid group source for this config")
	}

	if len(o.Whitelist) != 0 {
		return syncgroups.NewOpenShiftGroupLister(o.Whitelist, o.Blacklist, host, o.GroupInterface), nil
	}

	return syncgroups.NewAllOpenShiftGroupLister(o.Blacklist, host, o.GroupInterface), nil
}
예제 #3
0
파일: syncgroups.go 프로젝트: dwdunn/origin
func (o *SyncGroupsOptions) GetGroupLister(syncBuilder SyncBuilder, clientConfig *ldaputil.LDAPClientConfig) (interfaces.LDAPGroupLister, error) {
	// if we have a whitelist, it trumps alls
	if len(o.WhitelistContents) != 0 {
		if o.Source == GroupSyncSourceOpenShift {
			return syncgroups.NewOpenShiftWhitelistGroupLister(o.WhitelistContents, o.GroupInterface), nil
		}
		return syncgroups.NewLDAPWhitelistGroupLister(o.WhitelistContents), nil
	}

	// openshift as a listing source works the same for all schemas
	if o.Source == GroupSyncSourceOpenShift {
		return syncgroups.NewAllOpenShiftGroupLister(clientConfig.Host, o.GroupInterface), nil
	}

	return syncBuilder.GetGroupLister()
}