-
Notifications
You must be signed in to change notification settings - Fork 381
/
interfaces.go
52 lines (45 loc) · 1.87 KB
/
interfaces.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package sync
import (
legacyconfigv1 "github.com/openshift/api/legacyconfig/v1"
userv1client "github.com/openshift/client-go/user/clientset/versioned/typed/user/v1"
"github.com/openshift/library-go/pkg/security/ldapquery"
"github.com/openshift/oc/pkg/helpers/groupsync/interfaces"
)
// SyncBuilder describes an object that can build all the schema-specific parts of an LDAPGroupSyncer
type SyncBuilder interface {
GetGroupLister() (interfaces.LDAPGroupLister, error)
GetGroupNameMapper() (interfaces.LDAPGroupNameMapper, error)
GetUserNameMapper() (interfaces.LDAPUserNameMapper, error)
GetGroupMemberExtractor() (interfaces.LDAPMemberExtractor, error)
}
// PruneBuilder describes an object that can build all the schema-specific parts of an LDAPGroupPruner
type PruneBuilder interface {
GetGroupLister() (interfaces.LDAPGroupLister, error)
GetGroupNameMapper() (interfaces.LDAPGroupNameMapper, error)
GetGroupDetector() (interfaces.LDAPGroupDetector, error)
}
// GroupNameRestrictions desribes an object that holds blacklists and whitelists
type GroupNameRestrictions interface {
GetWhitelist() []string
GetBlacklist() []string
}
// OpenShiftGroupNameRestrictions describes an object that holds blacklists and whitelists as well as
// a client that can retrieve OpenShift groups to satisfy those lists
type OpenShiftGroupNameRestrictions interface {
GroupNameRestrictions
GetClient() userv1client.GroupInterface
}
// MappedNameRestrictions describes an object that holds user name mappings for a group sync job
type MappedNameRestrictions interface {
GetGroupNameMappings() map[string]string
}
func ToLDAPQuery(in legacyconfigv1.LDAPQuery) ldapquery.SerializeableLDAPQuery {
return ldapquery.SerializeableLDAPQuery{
BaseDN: in.BaseDN,
Scope: in.Scope,
DerefAliases: in.DerefAliases,
TimeLimit: in.TimeLimit,
Filter: in.Filter,
PageSize: in.PageSize,
}
}