add UpdateUserRoles to plugin api (#26615)
* ProfileImageBytes for EnsureBotOptions * leverage plugintest.NewAPI * fix linting * add UpdateUserRoles to plugin api
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f34fac7731
Коммит
acbaf4c283
@@ -1293,6 +1293,13 @@ type API interface {
|
||||
// @tag SharedChannels
|
||||
// Minimum server version: 9.5
|
||||
UninviteRemoteFromChannel(channelID string, remoteID string) error
|
||||
|
||||
// UpdateUserRoles updates the role for a user.
|
||||
//
|
||||
// @tag Team
|
||||
// @tag User
|
||||
// Minimum server version: 9.8
|
||||
UpdateUserRoles(userID, newRoles string) (*model.User, *model.AppError)
|
||||
}
|
||||
|
||||
var handshake = plugin.HandshakeConfig{
|
||||
|
||||
@@ -1364,3 +1364,10 @@ func (api *apiTimerLayer) UninviteRemoteFromChannel(channelID string, remoteID s
|
||||
api.recordTime(startTime, "UninviteRemoteFromChannel", _returnsA == nil)
|
||||
return _returnsA
|
||||
}
|
||||
|
||||
func (api *apiTimerLayer) UpdateUserRoles(userID, newRoles string) (*model.User, *model.AppError) {
|
||||
startTime := timePkg.Now()
|
||||
_returnsA, _returnsB := api.apiImpl.UpdateUserRoles(userID, newRoles)
|
||||
api.recordTime(startTime, "UpdateUserRoles", _returnsB == nil)
|
||||
return _returnsA, _returnsB
|
||||
}
|
||||
|
||||
@@ -6535,3 +6535,33 @@ func (s *apiRPCServer) UninviteRemoteFromChannel(args *Z_UninviteRemoteFromChann
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Z_UpdateUserRolesArgs struct {
|
||||
A string
|
||||
B string
|
||||
}
|
||||
|
||||
type Z_UpdateUserRolesReturns struct {
|
||||
A *model.User
|
||||
B *model.AppError
|
||||
}
|
||||
|
||||
func (g *apiRPCClient) UpdateUserRoles(userID, newRoles string) (*model.User, *model.AppError) {
|
||||
_args := &Z_UpdateUserRolesArgs{userID, newRoles}
|
||||
_returns := &Z_UpdateUserRolesReturns{}
|
||||
if err := g.client.Call("Plugin.UpdateUserRoles", _args, _returns); err != nil {
|
||||
log.Printf("RPC call to UpdateUserRoles API failed: %s", err.Error())
|
||||
}
|
||||
return _returns.A, _returns.B
|
||||
}
|
||||
|
||||
func (s *apiRPCServer) UpdateUserRoles(args *Z_UpdateUserRolesArgs, returns *Z_UpdateUserRolesReturns) error {
|
||||
if hook, ok := s.impl.(interface {
|
||||
UpdateUserRoles(userID, newRoles string) (*model.User, *model.AppError)
|
||||
}); ok {
|
||||
returns.A, returns.B = hook.UpdateUserRoles(args.A, args.B)
|
||||
} else {
|
||||
return encodableError(fmt.Errorf("API UpdateUserRoles called but not implemented."))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -4355,6 +4355,34 @@ func (_m *API) UpdateUserCustomStatus(userID string, customStatus *model.CustomS
|
||||
return r0
|
||||
}
|
||||
|
||||
// UpdateUserRoles provides a mock function with given fields: userID, newRoles
|
||||
func (_m *API) UpdateUserRoles(userID string, newRoles string) (*model.User, *model.AppError) {
|
||||
ret := _m.Called(userID, newRoles)
|
||||
|
||||
var r0 *model.User
|
||||
var r1 *model.AppError
|
||||
if rf, ok := ret.Get(0).(func(string, string) (*model.User, *model.AppError)); ok {
|
||||
return rf(userID, newRoles)
|
||||
}
|
||||
if rf, ok := ret.Get(0).(func(string, string) *model.User); ok {
|
||||
r0 = rf(userID, newRoles)
|
||||
} else {
|
||||
if ret.Get(0) != nil {
|
||||
r0 = ret.Get(0).(*model.User)
|
||||
}
|
||||
}
|
||||
|
||||
if rf, ok := ret.Get(1).(func(string, string) *model.AppError); ok {
|
||||
r1 = rf(userID, newRoles)
|
||||
} else {
|
||||
if ret.Get(1) != nil {
|
||||
r1 = ret.Get(1).(*model.AppError)
|
||||
}
|
||||
}
|
||||
|
||||
return r0, r1
|
||||
}
|
||||
|
||||
// UpdateUserStatus provides a mock function with given fields: userID, status
|
||||
func (_m *API) UpdateUserStatus(userID string, status string) (*model.Status, *model.AppError) {
|
||||
ret := _m.Called(userID, status)
|
||||
|
||||
Ссылка в новой задаче
Block a user