* Add group store GetByUser

* Add group store GetByName

* Add group plugin APIs

* Minor naming fixes

* Add minimum version comments
Этот коммит содержится в:
Joram Wilander
2019-10-22 14:38:08 -04:00
коммит произвёл GitHub
родитель fbf4d6d139
Коммит 9307f75fe9
10 изменённых файлов: 419 добавлений и 0 удалений

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

@@ -378,6 +378,21 @@ type API interface {
// Minimum server version: 5.2
UpdateChannelMemberNotifications(channelId, userId string, notifications map[string]string) (*model.ChannelMember, *model.AppError)
// GetGroup gets a group by ID.
//
// Minimum server version: 5.18
GetGroup(groupId string) (*model.Group, *model.AppError)
// GetGroupByName gets a group by name.
//
// Minimum server version: 5.18
GetGroupByName(name string) (*model.Group, *model.AppError)
// GetGroupsForUser gets the groups a user is in.
//
// Minimum server version: 5.18
GetGroupsForUser(userId string) ([]*model.Group, *model.AppError)
// DeleteChannelMember deletes a channel membership for a user.
//
// Minimum server version: 5.2

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

@@ -2498,6 +2498,93 @@ func (s *apiRPCServer) UpdateChannelMemberNotifications(args *Z_UpdateChannelMem
return nil
}
type Z_GetGroupArgs struct {
A string
}
type Z_GetGroupReturns struct {
A *model.Group
B *model.AppError
}
func (g *apiRPCClient) GetGroup(groupId string) (*model.Group, *model.AppError) {
_args := &Z_GetGroupArgs{groupId}
_returns := &Z_GetGroupReturns{}
if err := g.client.Call("Plugin.GetGroup", _args, _returns); err != nil {
log.Printf("RPC call to GetGroup API failed: %s", err.Error())
}
return _returns.A, _returns.B
}
func (s *apiRPCServer) GetGroup(args *Z_GetGroupArgs, returns *Z_GetGroupReturns) error {
if hook, ok := s.impl.(interface {
GetGroup(groupId string) (*model.Group, *model.AppError)
}); ok {
returns.A, returns.B = hook.GetGroup(args.A)
} else {
return encodableError(fmt.Errorf("API GetGroup called but not implemented."))
}
return nil
}
type Z_GetGroupByNameArgs struct {
A string
}
type Z_GetGroupByNameReturns struct {
A *model.Group
B *model.AppError
}
func (g *apiRPCClient) GetGroupByName(name string) (*model.Group, *model.AppError) {
_args := &Z_GetGroupByNameArgs{name}
_returns := &Z_GetGroupByNameReturns{}
if err := g.client.Call("Plugin.GetGroupByName", _args, _returns); err != nil {
log.Printf("RPC call to GetGroupByName API failed: %s", err.Error())
}
return _returns.A, _returns.B
}
func (s *apiRPCServer) GetGroupByName(args *Z_GetGroupByNameArgs, returns *Z_GetGroupByNameReturns) error {
if hook, ok := s.impl.(interface {
GetGroupByName(name string) (*model.Group, *model.AppError)
}); ok {
returns.A, returns.B = hook.GetGroupByName(args.A)
} else {
return encodableError(fmt.Errorf("API GetGroupByName called but not implemented."))
}
return nil
}
type Z_GetGroupsForUserArgs struct {
A string
}
type Z_GetGroupsForUserReturns struct {
A []*model.Group
B *model.AppError
}
func (g *apiRPCClient) GetGroupsForUser(userId string) ([]*model.Group, *model.AppError) {
_args := &Z_GetGroupsForUserArgs{userId}
_returns := &Z_GetGroupsForUserReturns{}
if err := g.client.Call("Plugin.GetGroupsForUser", _args, _returns); err != nil {
log.Printf("RPC call to GetGroupsForUser API failed: %s", err.Error())
}
return _returns.A, _returns.B
}
func (s *apiRPCServer) GetGroupsForUser(args *Z_GetGroupsForUserArgs, returns *Z_GetGroupsForUserReturns) error {
if hook, ok := s.impl.(interface {
GetGroupsForUser(userId string) ([]*model.Group, *model.AppError)
}); ok {
returns.A, returns.B = hook.GetGroupsForUser(args.A)
} else {
return encodableError(fmt.Errorf("API GetGroupsForUser called but not implemented."))
}
return nil
}
type Z_DeleteChannelMemberArgs struct {
A string
B string

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

@@ -996,6 +996,56 @@ func (_m *API) GetFileLink(fileId string) (string, *model.AppError) {
return r0, r1
}
// GetGroup provides a mock function with given fields: groupId
func (_m *API) GetGroup(groupId string) (*model.Group, *model.AppError) {
ret := _m.Called(groupId)
var r0 *model.Group
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)
}
}
var r1 *model.AppError
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
}
// GetGroupByName provides a mock function with given fields: name
func (_m *API) GetGroupByName(name string) (*model.Group, *model.AppError) {
ret := _m.Called(name)
var r0 *model.Group
if rf, ok := ret.Get(0).(func(string) *model.Group); ok {
r0 = rf(name)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*model.Group)
}
}
var r1 *model.AppError
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
r1 = rf(name)
} 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)
@@ -1021,6 +1071,31 @@ func (_m *API) GetGroupChannel(userIds []string) (*model.Channel, *model.AppErro
return r0, r1
}
// GetGroupsForUser provides a mock function with given fields: userId
func (_m *API) GetGroupsForUser(userId string) ([]*model.Group, *model.AppError) {
ret := _m.Called(userId)
var r0 []*model.Group
if rf, ok := ret.Get(0).(func(string) []*model.Group); ok {
r0 = rf(userId)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*model.Group)
}
}
var r1 *model.AppError
if rf, ok := ret.Get(1).(func(string) *model.AppError); ok {
r1 = rf(userId)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).(*model.AppError)
}
}
return r0, r1
}
// GetLDAPUserAttributes provides a mock function with given fields: userId, attributes
func (_m *API) GetLDAPUserAttributes(userId string, attributes []string) (map[string]string, *model.AppError) {
ret := _m.Called(userId, attributes)