* add new pluginapi methods

* SAML login hook

* set ReAddRemovedMembers to true for plugin groups

* change to DoLogin signature for SAML
Этот коммит содержится в:
Ben Cooke
2025-03-13 12:00:15 -04:00
коммит произвёл GitHub
родитель 0e0e54446d
Коммит ccd8a60168
44 изменённых файлов: 2119 добавлений и 213 удалений

Просмотреть файл

@@ -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"},