Plugin groups (#30320)
* add new pluginapi methods * SAML login hook * set ReAddRemovedMembers to true for plugin groups * change to DoLogin signature for SAML
Этот коммит содержится в:
@@ -1300,6 +1300,87 @@ type API interface {
|
||||
// Minimum server version: 9.5
|
||||
UninviteRemoteFromChannel(channelID string, remoteID string) error
|
||||
|
||||
// UpsertGroupMember adds a user to a group or updates their existing membership.
|
||||
//
|
||||
// @tag Group
|
||||
// @tag User
|
||||
// Minimum server version: 10.7
|
||||
UpsertGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError)
|
||||
|
||||
// UpsertGroupMembers adds multiple users to a group or updates their existing memberships.
|
||||
//
|
||||
// @tag Group
|
||||
// @tag User
|
||||
// Minimum server version: 10.7
|
||||
UpsertGroupMembers(groupID string, userIDs []string) ([]*model.GroupMember, *model.AppError)
|
||||
|
||||
// GetGroupByRemoteID gets a group by its remote ID.
|
||||
//
|
||||
// @tag Group
|
||||
// Minimum server version: 10.7
|
||||
GetGroupByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, *model.AppError)
|
||||
|
||||
// CreateGroup creates a new group.
|
||||
//
|
||||
// @tag Group
|
||||
// Minimum server version: 10.7
|
||||
CreateGroup(group *model.Group) (*model.Group, *model.AppError)
|
||||
|
||||
// UpdateGroup updates a group.
|
||||
//
|
||||
// @tag Group
|
||||
// Minimum server version: 10.7
|
||||
UpdateGroup(group *model.Group) (*model.Group, *model.AppError)
|
||||
|
||||
// DeleteGroup soft deletes a group.
|
||||
//
|
||||
// @tag Group
|
||||
// Minimum server version: 10.7
|
||||
DeleteGroup(groupID string) (*model.Group, *model.AppError)
|
||||
|
||||
// RestoreGroup restores a soft deleted group.
|
||||
//
|
||||
// @tag Group
|
||||
// Minimum server version: 10.7
|
||||
RestoreGroup(groupID string) (*model.Group, *model.AppError)
|
||||
|
||||
// DeleteGroupMember removes a user from a group.
|
||||
//
|
||||
// @tag Group
|
||||
// @tag User
|
||||
// Minimum server version: 10.7
|
||||
DeleteGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError)
|
||||
|
||||
// GetGroupSyncable gets a group syncable.
|
||||
//
|
||||
// @tag Group
|
||||
// Minimum server version: 10.7
|
||||
GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError)
|
||||
|
||||
// GetGroupSyncables gets all group syncables for the given group.
|
||||
//
|
||||
// @tag Group
|
||||
// Minimum server version: 10.7
|
||||
GetGroupSyncables(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, *model.AppError)
|
||||
|
||||
// UpsertGroupSyncable creates or updates a group syncable.
|
||||
//
|
||||
// @tag Group
|
||||
// Minimum server version: 10.7
|
||||
UpsertGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError)
|
||||
|
||||
// UpdateGroupSyncable updates a group syncable.
|
||||
//
|
||||
// @tag Group
|
||||
// Minimum server version: 10.7
|
||||
UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError)
|
||||
|
||||
// DeleteGroupSyncable deletes a group syncable.
|
||||
//
|
||||
// @tag Group
|
||||
// Minimum server version: 10.7
|
||||
DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError)
|
||||
|
||||
// UpdateUserRoles updates the role for a user.
|
||||
//
|
||||
// @tag Team
|
||||
@@ -1312,6 +1393,12 @@ type API interface {
|
||||
// @tag Plugin
|
||||
// Minimum server version: 10.1
|
||||
GetPluginID() string
|
||||
|
||||
// GetGroups returns a list of all groups with the given options and restrictions.
|
||||
//
|
||||
// @tag Group
|
||||
// Minimum server version: 10.7
|
||||
GetGroups(page, perPage int, opts model.GroupSearchOpts, viewRestrictions *model.ViewUsersRestrictions) ([]*model.Group, *model.AppError)
|
||||
}
|
||||
|
||||
var handshake = plugin.HandshakeConfig{
|
||||
|
||||
@@ -1372,6 +1372,97 @@ func (api *apiTimerLayer) UninviteRemoteFromChannel(channelID string, remoteID s
|
||||
return _returnsA
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) UpsertGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := api.apiImpl.UpsertGroupMember(groupID, userID)
|
||||
api.recordTime(startTime, "UpsertGroupMember", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) UpsertGroupMembers(groupID string, userIDs []string) ([]*model.GroupMember, *model.AppError) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := api.apiImpl.UpsertGroupMembers(groupID, userIDs)
|
||||
api.recordTime(startTime, "UpsertGroupMembers", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) GetGroupByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, *model.AppError) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := api.apiImpl.GetGroupByRemoteID(remoteID, groupSource)
|
||||
api.recordTime(startTime, "GetGroupByRemoteID", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) CreateGroup(group *model.Group) (*model.Group, *model.AppError) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := api.apiImpl.CreateGroup(group)
|
||||
api.recordTime(startTime, "CreateGroup", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) UpdateGroup(group *model.Group) (*model.Group, *model.AppError) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := api.apiImpl.UpdateGroup(group)
|
||||
api.recordTime(startTime, "UpdateGroup", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) DeleteGroup(groupID string) (*model.Group, *model.AppError) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := api.apiImpl.DeleteGroup(groupID)
|
||||
api.recordTime(startTime, "DeleteGroup", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) RestoreGroup(groupID string) (*model.Group, *model.AppError) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := api.apiImpl.RestoreGroup(groupID)
|
||||
api.recordTime(startTime, "RestoreGroup", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) DeleteGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := api.apiImpl.DeleteGroupMember(groupID, userID)
|
||||
api.recordTime(startTime, "DeleteGroupMember", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := api.apiImpl.GetGroupSyncable(groupID, syncableID, syncableType)
|
||||
api.recordTime(startTime, "GetGroupSyncable", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) GetGroupSyncables(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, *model.AppError) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := api.apiImpl.GetGroupSyncables(groupID, syncableType)
|
||||
api.recordTime(startTime, "GetGroupSyncables", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) UpsertGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := api.apiImpl.UpsertGroupSyncable(groupSyncable)
|
||||
api.recordTime(startTime, "UpsertGroupSyncable", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := api.apiImpl.UpdateGroupSyncable(groupSyncable)
|
||||
api.recordTime(startTime, "UpdateGroupSyncable", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := api.apiImpl.DeleteGroupSyncable(groupID, syncableID, syncableType)
|
||||
api.recordTime(startTime, "DeleteGroupSyncable", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) UpdateUserRoles(userID, newRoles string) (*model.User, *model.AppError) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := api.apiImpl.UpdateUserRoles(userID, newRoles)
|
||||
@@ -1385,3 +1476,10 @@ func (api *apiTimerLayer) GetPluginID() string {
|
||||
api.recordTime(startTime, "GetPluginID", true)
|
||||
return _returnsA
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) GetGroups(page, perPage int, opts model.GroupSearchOpts, viewRestrictions *model.ViewUsersRestrictions) ([]*model.Group, *model.AppError) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := api.apiImpl.GetGroups(page, perPage, opts, viewRestrictions)
|
||||
api.recordTime(startTime, "GetGroups", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
saml2 "github.com/mattermost/gosaml2"
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||
)
|
||||
@@ -1161,6 +1162,43 @@ func (s *hooksRPCServer) GenerateSupportData(args *Z_GenerateSupportDataArgs, re
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
hookNameToId["OnSAMLLogin"] = OnSAMLLoginID
|
||||
}
|
||||
|
||||
type Z_OnSAMLLoginArgs struct {
|
||||
A *Context
|
||||
B *model.User
|
||||
C *saml2.AssertionInfo
|
||||
}
|
||||
|
||||
type Z_OnSAMLLoginReturns struct {
|
||||
A error
|
||||
}
|
||||
|
||||
func (g *hooksRPCClient) OnSAMLLogin(c *Context, user *model.User, assertion *saml2.AssertionInfo) error {
|
||||
_args := &Z_OnSAMLLoginArgs{c, user, assertion}
|
||||
_returns := &Z_OnSAMLLoginReturns{}
|
||||
if g.implemented[OnSAMLLoginID] {
|
||||
if err := g.client.Call("Plugin.OnSAMLLogin", _args, _returns); err != nil {
|
||||
g.log.Error("RPC call OnSAMLLogin to plugin failed.", mlog.Err(err))
|
||||
}
|
||||
}
|
||||
return _returns.A
|
||||
}
|
||||
|
||||
func (s *hooksRPCServer) OnSAMLLogin(args *Z_OnSAMLLoginArgs, returns *Z_OnSAMLLoginReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
OnSAMLLogin(c *Context, user *model.User, assertion *saml2.AssertionInfo) error
|
||||
}); ok {
|
||||
returns.A = hook.OnSAMLLogin(args.A, args.B, args.C)
|
||||
returns.A = encodableError(returns.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("Hook OnSAMLLogin called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_RegisterCommandArgs struct {
|
||||
A *model.Command
|
||||
}
|
||||
@@ -6601,6 +6639,392 @@ func (s *apiRPCServer) UninviteRemoteFromChannel(args *Z_UninviteRemoteFromChann
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_UpsertGroupMemberArgs struct {
|
||||
A string
|
||||
B string
|
||||
}
|
||||
|
||||
type Z_UpsertGroupMemberReturns struct {
|
||||
A *model.GroupMember
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) UpsertGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError) {
|
||||
_args := &Z_UpsertGroupMemberArgs{groupID, userID}
|
||||
_returns := &Z_UpsertGroupMemberReturns{}
|
||||
if err := g.client.Call("Plugin.UpsertGroupMember", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to UpsertGroupMember API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) UpsertGroupMember(args *Z_UpsertGroupMemberArgs, returns *Z_UpsertGroupMemberReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
UpsertGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.UpsertGroupMember(args.A, args.B)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API UpsertGroupMember called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_UpsertGroupMembersArgs struct {
|
||||
A string
|
||||
B []string
|
||||
}
|
||||
|
||||
type Z_UpsertGroupMembersReturns struct {
|
||||
A []*model.GroupMember
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) UpsertGroupMembers(groupID string, userIDs []string) ([]*model.GroupMember, *model.AppError) {
|
||||
_args := &Z_UpsertGroupMembersArgs{groupID, userIDs}
|
||||
_returns := &Z_UpsertGroupMembersReturns{}
|
||||
if err := g.client.Call("Plugin.UpsertGroupMembers", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to UpsertGroupMembers API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) UpsertGroupMembers(args *Z_UpsertGroupMembersArgs, returns *Z_UpsertGroupMembersReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
UpsertGroupMembers(groupID string, userIDs []string) ([]*model.GroupMember, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.UpsertGroupMembers(args.A, args.B)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API UpsertGroupMembers called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_GetGroupByRemoteIDArgs struct {
|
||||
A string
|
||||
B model.GroupSource
|
||||
}
|
||||
|
||||
type Z_GetGroupByRemoteIDReturns struct {
|
||||
A *model.Group
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) GetGroupByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, *model.AppError) {
|
||||
_args := &Z_GetGroupByRemoteIDArgs{remoteID, groupSource}
|
||||
_returns := &Z_GetGroupByRemoteIDReturns{}
|
||||
if err := g.client.Call("Plugin.GetGroupByRemoteID", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to GetGroupByRemoteID API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) GetGroupByRemoteID(args *Z_GetGroupByRemoteIDArgs, returns *Z_GetGroupByRemoteIDReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
GetGroupByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.GetGroupByRemoteID(args.A, args.B)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API GetGroupByRemoteID called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_CreateGroupArgs struct {
|
||||
A *model.Group
|
||||
}
|
||||
|
||||
type Z_CreateGroupReturns struct {
|
||||
A *model.Group
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) CreateGroup(group *model.Group) (*model.Group, *model.AppError) {
|
||||
_args := &Z_CreateGroupArgs{group}
|
||||
_returns := &Z_CreateGroupReturns{}
|
||||
if err := g.client.Call("Plugin.CreateGroup", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to CreateGroup API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) CreateGroup(args *Z_CreateGroupArgs, returns *Z_CreateGroupReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
CreateGroup(group *model.Group) (*model.Group, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.CreateGroup(args.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API CreateGroup called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_UpdateGroupArgs struct {
|
||||
A *model.Group
|
||||
}
|
||||
|
||||
type Z_UpdateGroupReturns struct {
|
||||
A *model.Group
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) UpdateGroup(group *model.Group) (*model.Group, *model.AppError) {
|
||||
_args := &Z_UpdateGroupArgs{group}
|
||||
_returns := &Z_UpdateGroupReturns{}
|
||||
if err := g.client.Call("Plugin.UpdateGroup", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to UpdateGroup API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) UpdateGroup(args *Z_UpdateGroupArgs, returns *Z_UpdateGroupReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
UpdateGroup(group *model.Group) (*model.Group, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.UpdateGroup(args.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API UpdateGroup called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_DeleteGroupArgs struct {
|
||||
A string
|
||||
}
|
||||
|
||||
type Z_DeleteGroupReturns struct {
|
||||
A *model.Group
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) DeleteGroup(groupID string) (*model.Group, *model.AppError) {
|
||||
_args := &Z_DeleteGroupArgs{groupID}
|
||||
_returns := &Z_DeleteGroupReturns{}
|
||||
if err := g.client.Call("Plugin.DeleteGroup", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to DeleteGroup API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) DeleteGroup(args *Z_DeleteGroupArgs, returns *Z_DeleteGroupReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
DeleteGroup(groupID string) (*model.Group, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.DeleteGroup(args.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API DeleteGroup called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_RestoreGroupArgs struct {
|
||||
A string
|
||||
}
|
||||
|
||||
type Z_RestoreGroupReturns struct {
|
||||
A *model.Group
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) RestoreGroup(groupID string) (*model.Group, *model.AppError) {
|
||||
_args := &Z_RestoreGroupArgs{groupID}
|
||||
_returns := &Z_RestoreGroupReturns{}
|
||||
if err := g.client.Call("Plugin.RestoreGroup", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to RestoreGroup API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) RestoreGroup(args *Z_RestoreGroupArgs, returns *Z_RestoreGroupReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
RestoreGroup(groupID string) (*model.Group, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.RestoreGroup(args.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API RestoreGroup called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_DeleteGroupMemberArgs struct {
|
||||
A string
|
||||
B string
|
||||
}
|
||||
|
||||
type Z_DeleteGroupMemberReturns struct {
|
||||
A *model.GroupMember
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) DeleteGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError) {
|
||||
_args := &Z_DeleteGroupMemberArgs{groupID, userID}
|
||||
_returns := &Z_DeleteGroupMemberReturns{}
|
||||
if err := g.client.Call("Plugin.DeleteGroupMember", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to DeleteGroupMember API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) DeleteGroupMember(args *Z_DeleteGroupMemberArgs, returns *Z_DeleteGroupMemberReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
DeleteGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.DeleteGroupMember(args.A, args.B)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API DeleteGroupMember called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_GetGroupSyncableArgs struct {
|
||||
A string
|
||||
B string
|
||||
C model.GroupSyncableType
|
||||
}
|
||||
|
||||
type Z_GetGroupSyncableReturns struct {
|
||||
A *model.GroupSyncable
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError) {
|
||||
_args := &Z_GetGroupSyncableArgs{groupID, syncableID, syncableType}
|
||||
_returns := &Z_GetGroupSyncableReturns{}
|
||||
if err := g.client.Call("Plugin.GetGroupSyncable", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to GetGroupSyncable API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) GetGroupSyncable(args *Z_GetGroupSyncableArgs, returns *Z_GetGroupSyncableReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.GetGroupSyncable(args.A, args.B, args.C)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API GetGroupSyncable called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_GetGroupSyncablesArgs struct {
|
||||
A string
|
||||
B model.GroupSyncableType
|
||||
}
|
||||
|
||||
type Z_GetGroupSyncablesReturns struct {
|
||||
A []*model.GroupSyncable
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) GetGroupSyncables(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, *model.AppError) {
|
||||
_args := &Z_GetGroupSyncablesArgs{groupID, syncableType}
|
||||
_returns := &Z_GetGroupSyncablesReturns{}
|
||||
if err := g.client.Call("Plugin.GetGroupSyncables", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to GetGroupSyncables API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) GetGroupSyncables(args *Z_GetGroupSyncablesArgs, returns *Z_GetGroupSyncablesReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
GetGroupSyncables(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.GetGroupSyncables(args.A, args.B)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API GetGroupSyncables called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_UpsertGroupSyncableArgs struct {
|
||||
A *model.GroupSyncable
|
||||
}
|
||||
|
||||
type Z_UpsertGroupSyncableReturns struct {
|
||||
A *model.GroupSyncable
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) UpsertGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError) {
|
||||
_args := &Z_UpsertGroupSyncableArgs{groupSyncable}
|
||||
_returns := &Z_UpsertGroupSyncableReturns{}
|
||||
if err := g.client.Call("Plugin.UpsertGroupSyncable", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to UpsertGroupSyncable API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) UpsertGroupSyncable(args *Z_UpsertGroupSyncableArgs, returns *Z_UpsertGroupSyncableReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
UpsertGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.UpsertGroupSyncable(args.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API UpsertGroupSyncable called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_UpdateGroupSyncableArgs struct {
|
||||
A *model.GroupSyncable
|
||||
}
|
||||
|
||||
type Z_UpdateGroupSyncableReturns struct {
|
||||
A *model.GroupSyncable
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError) {
|
||||
_args := &Z_UpdateGroupSyncableArgs{groupSyncable}
|
||||
_returns := &Z_UpdateGroupSyncableReturns{}
|
||||
if err := g.client.Call("Plugin.UpdateGroupSyncable", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to UpdateGroupSyncable API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) UpdateGroupSyncable(args *Z_UpdateGroupSyncableArgs, returns *Z_UpdateGroupSyncableReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.UpdateGroupSyncable(args.A)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API UpdateGroupSyncable called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_DeleteGroupSyncableArgs struct {
|
||||
A string
|
||||
B string
|
||||
C model.GroupSyncableType
|
||||
}
|
||||
|
||||
type Z_DeleteGroupSyncableReturns struct {
|
||||
A *model.GroupSyncable
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError) {
|
||||
_args := &Z_DeleteGroupSyncableArgs{groupID, syncableID, syncableType}
|
||||
_returns := &Z_DeleteGroupSyncableReturns{}
|
||||
if err := g.client.Call("Plugin.DeleteGroupSyncable", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to DeleteGroupSyncable API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) DeleteGroupSyncable(args *Z_DeleteGroupSyncableArgs, returns *Z_DeleteGroupSyncableReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.DeleteGroupSyncable(args.A, args.B, args.C)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API DeleteGroupSyncable called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_UpdateUserRolesArgs struct {
|
||||
A string
|
||||
B string
|
||||
@@ -6657,3 +7081,35 @@ func (s *apiRPCServer) GetPluginID(args *Z_GetPluginIDArgs, returns *Z_GetPlugin
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_GetGroupsArgs struct {
|
||||
A int
|
||||
B int
|
||||
C model.GroupSearchOpts
|
||||
D *model.ViewUsersRestrictions
|
||||
}
|
||||
|
||||
type Z_GetGroupsReturns struct {
|
||||
A []*model.Group
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) GetGroups(page, perPage int, opts model.GroupSearchOpts, viewRestrictions *model.ViewUsersRestrictions) ([]*model.Group, *model.AppError) {
|
||||
_args := &Z_GetGroupsArgs{page, perPage, opts, viewRestrictions}
|
||||
_returns := &Z_GetGroupsReturns{}
|
||||
if err := g.client.Call("Plugin.GetGroups", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to GetGroups API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) GetGroups(args *Z_GetGroupsArgs, returns *Z_GetGroupsReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
GetGroups(page, perPage int, opts model.GroupSearchOpts, viewRestrictions *model.ViewUsersRestrictions) ([]*model.Group, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.GetGroups(args.A, args.B, args.C, args.D)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API GetGroups called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
saml2 "github.com/mattermost/gosaml2"
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
)
|
||||
|
||||
@@ -61,6 +62,7 @@ const (
|
||||
OnSharedChannelsAttachmentSyncMsgID = 43
|
||||
OnSharedChannelsProfileImageSyncMsgID = 44
|
||||
GenerateSupportDataID = 45
|
||||
OnSAMLLoginID = 46
|
||||
TotalHooksID = iota
|
||||
)
|
||||
|
||||
@@ -395,4 +397,9 @@ type Hooks interface {
|
||||
//
|
||||
// Minimum server version: 9.8
|
||||
GenerateSupportData(c *Context) ([]*model.FileData, error)
|
||||
|
||||
// OnSAMLLogin is invoked after a successful SAML login.
|
||||
//
|
||||
// Minimum server version: 10.7
|
||||
OnSAMLLogin(c *Context, user *model.User, assertion *saml2.AssertionInfo) error
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
"net/http"
|
||||
timePkg "time"
|
||||
|
||||
saml2 "github.com/mattermost/gosaml2"
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
)
|
||||
|
||||
@@ -291,3 +292,10 @@ func (hooks *hooksTimerLayer) GenerateSupportData(c *Context) ([]*model.FileData
|
||||
hooks.recordTime(startTime, "GenerateSupportData", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
func (hooks *hooksTimerLayer) OnSAMLLogin(c *Context, user *model.User, assertion *saml2.AssertionInfo) error {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA := hooks.hooksImpl.OnSAMLLogin(c, user, assertion)
|
||||
hooks.recordTime(startTime, "OnSAMLLogin", _returnsA == nil)
|
||||
return _returnsA
|
||||
}
|
||||
|
||||
@@ -307,6 +307,15 @@ var hooksTemplate = `// Copyright (c) 2015-present Mattermost, Inc. All Rights R
|
||||
|
||||
package plugin
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
saml2 "github.com/mattermost/gosaml2"
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||
)
|
||||
|
||||
{{range .HooksMethods}}
|
||||
|
||||
func init() {
|
||||
@@ -432,6 +441,7 @@ import (
|
||||
"net/http"
|
||||
timePkg "time"
|
||||
|
||||
saml2 "github.com/mattermost/gosaml2"
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
)
|
||||
|
||||
|
||||
@@ -272,6 +272,38 @@ func (_m *API) CreateCommand(cmd *model.Command) (*model.Command, error) {
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// CreateGroup provides a mock function with given fields: group
|
||||
func (_m *API) CreateGroup(group *model.Group) (*model.Group, *model.AppError) {
|
||||
ret := _m.Called(group)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for CreateGroup")
|
||||
}
|
||||
|
||||
var r0 *model.Group
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(*model.Group) (*model.Group, *model.AppError)); ok {
|
||||
return rf(group)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(*model.Group) *model.Group); ok {
|
||||
r0 = rf(group)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.Group)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(*model.Group) *model.AppError); ok {
|
||||
r1 = rf(group)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// CreateOAuthApp provides a mock function with given fields: app
|
||||
func (_m *API) CreateOAuthApp(app *model.OAuthApp) (*model.OAuthApp, *model.AppError) {
|
||||
ret := _m.Called(app)
|
||||
@@ -653,6 +685,102 @@ func (_m *API) DeleteEphemeralPost(userID string, postId string) {
|
||||
_m.Called(userID, postId)
|
||||
}
|
||||
|
||||
// DeleteGroup provides a mock function with given fields: groupID
|
||||
func (_m *API) DeleteGroup(groupID string) (*model.Group, *model.AppError) {
|
||||
ret := _m.Called(groupID)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for DeleteGroup")
|
||||
}
|
||||
|
||||
var r0 *model.Group
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string) (*model.Group, *model.AppError)); ok {
|
||||
return rf(groupID)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string) *model.Group); ok {
|
||||
r0 = rf(groupID)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.Group)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
|
||||
r1 = rf(groupID)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// DeleteGroupMember provides a mock function with given fields: groupID, userID
|
||||
func (_m *API) DeleteGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError) {
|
||||
ret := _m.Called(groupID, userID)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for DeleteGroupMember")
|
||||
}
|
||||
|
||||
var r0 *model.GroupMember
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string, string) (*model.GroupMember, *model.AppError)); ok {
|
||||
return rf(groupID, userID)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string, string) *model.GroupMember); ok {
|
||||
r0 = rf(groupID, userID)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.GroupMember)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string, string) *model.AppError); ok {
|
||||
r1 = rf(groupID, userID)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// DeleteGroupSyncable provides a mock function with given fields: groupID, syncableID, syncableType
|
||||
func (_m *API) DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError) {
|
||||
ret := _m.Called(groupID, syncableID, syncableType)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for DeleteGroupSyncable")
|
||||
}
|
||||
|
||||
var r0 *model.GroupSyncable
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string, string, model.GroupSyncableType) (*model.GroupSyncable, *model.AppError)); ok {
|
||||
return rf(groupID, syncableID, syncableType)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string, string, model.GroupSyncableType) *model.GroupSyncable); ok {
|
||||
r0 = rf(groupID, syncableID, syncableType)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.GroupSyncable)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string, string, model.GroupSyncableType) *model.AppError); ok {
|
||||
r1 = rf(groupID, syncableID, syncableType)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// DeleteOAuthApp provides a mock function with given fields: appID
|
||||
func (_m *API) DeleteOAuthApp(appID string) *model.AppError {
|
||||
ret := _m.Called(appID)
|
||||
@@ -1758,6 +1886,38 @@ func (_m *API) GetGroupByName(name string) (*model.Group, *model.AppError) {
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetGroupByRemoteID provides a mock function with given fields: remoteID, groupSource
|
||||
func (_m *API) GetGroupByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, *model.AppError) {
|
||||
ret := _m.Called(remoteID, groupSource)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetGroupByRemoteID")
|
||||
}
|
||||
|
||||
var r0 *model.Group
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string, model.GroupSource) (*model.Group, *model.AppError)); ok {
|
||||
return rf(remoteID, groupSource)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string, model.GroupSource) *model.Group); ok {
|
||||
r0 = rf(remoteID, groupSource)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.Group)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string, model.GroupSource) *model.AppError); ok {
|
||||
r1 = rf(remoteID, groupSource)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetGroupChannel provides a mock function with given fields: userIds
|
||||
func (_m *API) GetGroupChannel(userIds []string) (*model.Channel, *model.AppError) {
|
||||
ret := _m.Called(userIds)
|
||||
@@ -1822,6 +1982,102 @@ func (_m *API) GetGroupMemberUsers(groupID string, page int, perPage int) ([]*mo
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetGroupSyncable provides a mock function with given fields: groupID, syncableID, syncableType
|
||||
func (_m *API) GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, *model.AppError) {
|
||||
ret := _m.Called(groupID, syncableID, syncableType)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetGroupSyncable")
|
||||
}
|
||||
|
||||
var r0 *model.GroupSyncable
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string, string, model.GroupSyncableType) (*model.GroupSyncable, *model.AppError)); ok {
|
||||
return rf(groupID, syncableID, syncableType)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string, string, model.GroupSyncableType) *model.GroupSyncable); ok {
|
||||
r0 = rf(groupID, syncableID, syncableType)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.GroupSyncable)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string, string, model.GroupSyncableType) *model.AppError); ok {
|
||||
r1 = rf(groupID, syncableID, syncableType)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetGroupSyncables provides a mock function with given fields: groupID, syncableType
|
||||
func (_m *API) GetGroupSyncables(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, *model.AppError) {
|
||||
ret := _m.Called(groupID, syncableType)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetGroupSyncables")
|
||||
}
|
||||
|
||||
var r0 []*model.GroupSyncable
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string, model.GroupSyncableType) ([]*model.GroupSyncable, *model.AppError)); ok {
|
||||
return rf(groupID, syncableType)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string, model.GroupSyncableType) []*model.GroupSyncable); ok {
|
||||
r0 = rf(groupID, syncableType)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*model.GroupSyncable)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string, model.GroupSyncableType) *model.AppError); ok {
|
||||
r1 = rf(groupID, syncableType)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetGroups provides a mock function with given fields: page, perPage, opts, viewRestrictions
|
||||
func (_m *API) GetGroups(page int, perPage int, opts model.GroupSearchOpts, viewRestrictions *model.ViewUsersRestrictions) ([]*model.Group, *model.AppError) {
|
||||
ret := _m.Called(page, perPage, opts, viewRestrictions)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for GetGroups")
|
||||
}
|
||||
|
||||
var r0 []*model.Group
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(int, int, model.GroupSearchOpts, *model.ViewUsersRestrictions) ([]*model.Group, *model.AppError)); ok {
|
||||
return rf(page, perPage, opts, viewRestrictions)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(int, int, model.GroupSearchOpts, *model.ViewUsersRestrictions) []*model.Group); ok {
|
||||
r0 = rf(page, perPage, opts, viewRestrictions)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*model.Group)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(int, int, model.GroupSearchOpts, *model.ViewUsersRestrictions) *model.AppError); ok {
|
||||
r1 = rf(page, perPage, opts, viewRestrictions)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// GetGroupsBySource provides a mock function with given fields: groupSource
|
||||
func (_m *API) GetGroupsBySource(groupSource model.GroupSource) ([]*model.Group, *model.AppError) {
|
||||
ret := _m.Called(groupSource)
|
||||
@@ -4087,6 +4343,38 @@ func (_m *API) RequestTrialLicense(requesterID string, users int, termsAccepted
|
||||
return r0
|
||||
}
|
||||
|
||||
// RestoreGroup provides a mock function with given fields: groupID
|
||||
func (_m *API) RestoreGroup(groupID string) (*model.Group, *model.AppError) {
|
||||
ret := _m.Called(groupID)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for RestoreGroup")
|
||||
}
|
||||
|
||||
var r0 *model.Group
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string) (*model.Group, *model.AppError)); ok {
|
||||
return rf(groupID)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string) *model.Group); ok {
|
||||
r0 = rf(groupID)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.Group)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
|
||||
r1 = rf(groupID)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// RevokeSession provides a mock function with given fields: sessionID
|
||||
func (_m *API) RevokeSession(sessionID string) *model.AppError {
|
||||
ret := _m.Called(sessionID)
|
||||
@@ -4837,6 +5125,70 @@ func (_m *API) UpdateEphemeralPost(userID string, post *model.Post) *model.Post
|
||||
return r0
|
||||
}
|
||||
|
||||
// UpdateGroup provides a mock function with given fields: group
|
||||
func (_m *API) UpdateGroup(group *model.Group) (*model.Group, *model.AppError) {
|
||||
ret := _m.Called(group)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for UpdateGroup")
|
||||
}
|
||||
|
||||
var r0 *model.Group
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(*model.Group) (*model.Group, *model.AppError)); ok {
|
||||
return rf(group)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(*model.Group) *model.Group); ok {
|
||||
r0 = rf(group)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.Group)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(*model.Group) *model.AppError); ok {
|
||||
r1 = rf(group)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// UpdateGroupSyncable provides a mock function with given fields: groupSyncable
|
||||
func (_m *API) UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError) {
|
||||
ret := _m.Called(groupSyncable)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for UpdateGroupSyncable")
|
||||
}
|
||||
|
||||
var r0 *model.GroupSyncable
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(*model.GroupSyncable) (*model.GroupSyncable, *model.AppError)); ok {
|
||||
return rf(groupSyncable)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(*model.GroupSyncable) *model.GroupSyncable); ok {
|
||||
r0 = rf(groupSyncable)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.GroupSyncable)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(*model.GroupSyncable) *model.AppError); ok {
|
||||
r1 = rf(groupSyncable)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// UpdateOAuthApp provides a mock function with given fields: app
|
||||
func (_m *API) UpdateOAuthApp(app *model.OAuthApp) (*model.OAuthApp, *model.AppError) {
|
||||
ret := _m.Called(app)
|
||||
@@ -5263,6 +5615,102 @@ func (_m *API) UploadFile(data []byte, channelId string, filename string) (*mode
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// UpsertGroupMember provides a mock function with given fields: groupID, userID
|
||||
func (_m *API) UpsertGroupMember(groupID string, userID string) (*model.GroupMember, *model.AppError) {
|
||||
ret := _m.Called(groupID, userID)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for UpsertGroupMember")
|
||||
}
|
||||
|
||||
var r0 *model.GroupMember
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string, string) (*model.GroupMember, *model.AppError)); ok {
|
||||
return rf(groupID, userID)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string, string) *model.GroupMember); ok {
|
||||
r0 = rf(groupID, userID)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.GroupMember)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string, string) *model.AppError); ok {
|
||||
r1 = rf(groupID, userID)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// UpsertGroupMembers provides a mock function with given fields: groupID, userIDs
|
||||
func (_m *API) UpsertGroupMembers(groupID string, userIDs []string) ([]*model.GroupMember, *model.AppError) {
|
||||
ret := _m.Called(groupID, userIDs)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for UpsertGroupMembers")
|
||||
}
|
||||
|
||||
var r0 []*model.GroupMember
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string, []string) ([]*model.GroupMember, *model.AppError)); ok {
|
||||
return rf(groupID, userIDs)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string, []string) []*model.GroupMember); ok {
|
||||
r0 = rf(groupID, userIDs)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).([]*model.GroupMember)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string, []string) *model.AppError); ok {
|
||||
r1 = rf(groupID, userIDs)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// UpsertGroupSyncable provides a mock function with given fields: groupSyncable
|
||||
func (_m *API) UpsertGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, *model.AppError) {
|
||||
ret := _m.Called(groupSyncable)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for UpsertGroupSyncable")
|
||||
}
|
||||
|
||||
var r0 *model.GroupSyncable
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(*model.GroupSyncable) (*model.GroupSyncable, *model.AppError)); ok {
|
||||
return rf(groupSyncable)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(*model.GroupSyncable) *model.GroupSyncable); ok {
|
||||
r0 = rf(groupSyncable)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.GroupSyncable)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(*model.GroupSyncable) *model.AppError); ok {
|
||||
r1 = rf(groupSyncable)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// NewAPI creates a new instance of API. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
||||
// The first argument is typically a *testing.T value.
|
||||
func NewAPI(t interface {
|
||||
|
||||
@@ -13,6 +13,8 @@ import (
|
||||
model "github.com/mattermost/mattermost/server/public/model"
|
||||
|
||||
plugin "github.com/mattermost/mattermost/server/public/plugin"
|
||||
|
||||
saml2 "github.com/mattermost/gosaml2"
|
||||
)
|
||||
|
||||
// Hooks is an autogenerated mock type for the Hooks type
|
||||
@@ -384,6 +386,24 @@ func (_m *Hooks) OnPluginClusterEvent(c *plugin.Context, ev model.PluginClusterE
|
||||
_m.Called(c, ev)
|
||||
}
|
||||
|
||||
// OnSAMLLogin provides a mock function with given fields: c, user, assertion
|
||||
func (_m *Hooks) OnSAMLLogin(c *plugin.Context, user *model.User, assertion *saml2.AssertionInfo) error {
|
||||
ret := _m.Called(c, user, assertion)
|
||||
|
||||
if len(ret) == 0 {
|
||||
panic("no return value specified for OnSAMLLogin")
|
||||
}
|
||||
|
||||
var r0 error
|
||||
if rf, ok := ret.Get(0).(func(*plugin.Context, *model.User, *saml2.AssertionInfo) error); ok {
|
||||
r0 = rf(c, user, assertion)
|
||||
} else {
|
||||
r0 = ret.Error(0)
|
||||
}
|
||||
|
||||
return r0
|
||||
}
|
||||
|
||||
// OnSendDailyTelemetry provides a mock function with given fields:
|
||||
func (_m *Hooks) OnSendDailyTelemetry() {
|
||||
_m.Called()
|
||||
|
||||
Ссылка в новой задаче
Block a user