Plugin groups (#30320)
* add new pluginapi methods * SAML login hook * set ReAddRemovedMembers to true for plugin groups * change to DoLogin signature for SAML
Этот коммит содержится в:
@@ -1620,6 +1620,18 @@ func (s *SqlGroupStore) GetGroups(page, perPage int, opts model.GroupSearchOpts,
|
||||
|
||||
if opts.Source != "" {
|
||||
groupsQuery = groupsQuery.Where("g.Source = ?", opts.Source)
|
||||
} else if opts.OnlySyncableSources {
|
||||
sources := model.GetSyncableGroupSources()
|
||||
sourcePrefixes := model.GetSyncableGroupSourcePrefixes()
|
||||
|
||||
orClauses := sq.Or{}
|
||||
if len(sources) > 0 {
|
||||
orClauses = append(orClauses, sq.Eq{"g.Source": sources})
|
||||
}
|
||||
for _, prefix := range sourcePrefixes {
|
||||
orClauses = append(orClauses, sq.Like{"g.Source": string(prefix) + "%"})
|
||||
}
|
||||
groupsQuery = groupsQuery.Where(orClauses)
|
||||
}
|
||||
|
||||
queryString, args, err := groupsQuery.ToSql()
|
||||
|
||||
@@ -3963,6 +3963,36 @@ func testGetGroups(t *testing.T, rctx request.CTX, ss store.Store) {
|
||||
},
|
||||
Restrictions: nil,
|
||||
},
|
||||
{
|
||||
Name: "Include syncable sources only",
|
||||
Opts: model.GroupSearchOpts{OnlySyncableSources: true},
|
||||
Page: 0,
|
||||
PerPage: 100,
|
||||
Resultf: func(groups []*model.Group) bool {
|
||||
for _, g := range groups {
|
||||
if g.Source != model.GroupSourceLdap && !strings.HasPrefix(string(g.Source), "plugin_") {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
},
|
||||
Restrictions: nil,
|
||||
},
|
||||
{
|
||||
Name: "Include syncable sources with specific source",
|
||||
Opts: model.GroupSearchOpts{OnlySyncableSources: true, Source: model.GroupSourceLdap},
|
||||
Page: 0,
|
||||
PerPage: 100,
|
||||
Resultf: func(groups []*model.Group) bool {
|
||||
for _, g := range groups {
|
||||
if g.Source != model.GroupSourceLdap {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
},
|
||||
Restrictions: nil,
|
||||
},
|
||||
{
|
||||
Name: "Include archived groups",
|
||||
Opts: model.GroupSearchOpts{IncludeArchived: true, Q: "group-deleted"},
|
||||
|
||||
Ссылка в новой задаче
Block a user