From cea1796f0698956e4fab57a0015b292854bbbcf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Mon, 20 Aug 2018 18:22:08 +0200 Subject: Adding Permissions check and reactions function to plugins API (#9273) * Adding reactions functions * Adding permissions checking in the plugins api --- plugin/plugintest/api.go | 108 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) (limited to 'plugin/plugintest') diff --git a/plugin/plugintest/api.go b/plugin/plugintest/api.go index 3c2716778..e84ceffd8 100644 --- a/plugin/plugintest/api.go +++ b/plugin/plugintest/api.go @@ -37,6 +37,31 @@ func (_m *API) AddChannelMember(channelId string, userId string) (*model.Channel return r0, r1 } +// AddReaction provides a mock function with given fields: reaction +func (_m *API) AddReaction(reaction *model.Reaction) (*model.Reaction, *model.AppError) { + ret := _m.Called(reaction) + + var r0 *model.Reaction + if rf, ok := ret.Get(0).(func(*model.Reaction) *model.Reaction); ok { + r0 = rf(reaction) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*model.Reaction) + } + } + + var r1 *model.AppError + if rf, ok := ret.Get(1).(func(*model.Reaction) *model.AppError); ok { + r1 = rf(reaction) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(*model.AppError) + } + } + + return r0, r1 +} + // CopyFileInfos provides a mock function with given fields: userId, fileIds func (_m *API) CopyFileInfos(userId string, fileIds []string) ([]string, *model.AppError) { ret := _m.Called(userId, fileIds) @@ -549,6 +574,31 @@ func (_m *API) GetPublicChannelsForTeam(teamId string, offset int, limit int) (* return r0, r1 } +// GetReactions provides a mock function with given fields: postId +func (_m *API) GetReactions(postId string) ([]*model.Reaction, *model.AppError) { + ret := _m.Called(postId) + + var r0 []*model.Reaction + if rf, ok := ret.Get(0).(func(string) []*model.Reaction); ok { + r0 = rf(postId) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*model.Reaction) + } + } + + var r1 *model.AppError + if rf, ok := ret.Get(1).(func(string) *model.AppError); ok { + r1 = rf(postId) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(*model.AppError) + } + } + + return r0, r1 +} + // GetSession provides a mock function with given fields: sessionId func (_m *API) GetSession(sessionId string) (*model.Session, *model.AppError) { ret := _m.Called(sessionId) @@ -824,6 +874,48 @@ func (_m *API) GetUserStatusesByIds(userIds []string) ([]*model.Status, *model.A return r0, r1 } +// HasPermissionTo provides a mock function with given fields: userId, permission +func (_m *API) HasPermissionTo(userId string, permission *model.Permission) bool { + ret := _m.Called(userId, permission) + + var r0 bool + if rf, ok := ret.Get(0).(func(string, *model.Permission) bool); ok { + r0 = rf(userId, permission) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// HasPermissionToChannel provides a mock function with given fields: userId, channelId, permission +func (_m *API) HasPermissionToChannel(userId string, channelId string, permission *model.Permission) bool { + ret := _m.Called(userId, channelId, permission) + + var r0 bool + if rf, ok := ret.Get(0).(func(string, string, *model.Permission) bool); ok { + r0 = rf(userId, channelId, permission) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// HasPermissionToTeam provides a mock function with given fields: userId, teamId, permission +func (_m *API) HasPermissionToTeam(userId string, teamId string, permission *model.Permission) bool { + ret := _m.Called(userId, teamId, permission) + + var r0 bool + if rf, ok := ret.Get(0).(func(string, string, *model.Permission) bool); ok { + r0 = rf(userId, teamId, permission) + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + // KVDelete provides a mock function with given fields: key func (_m *API) KVDelete(key string) *model.AppError { ret := _m.Called(key) @@ -971,6 +1063,22 @@ func (_m *API) RegisterCommand(command *model.Command) error { return r0 } +// RemoveReaction provides a mock function with given fields: reaction +func (_m *API) RemoveReaction(reaction *model.Reaction) *model.AppError { + ret := _m.Called(reaction) + + var r0 *model.AppError + if rf, ok := ret.Get(0).(func(*model.Reaction) *model.AppError); ok { + r0 = rf(reaction) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*model.AppError) + } + } + + return r0 +} + // SaveConfig provides a mock function with given fields: config func (_m *API) SaveConfig(config *model.Config) *model.AppError { ret := _m.Called(config) -- cgit v1.2.3-1-g7c22