MM-58548 Remove manage_team permissions from System Console Ancillary permissions (#27395)
* remove manage team permissions from sysconsole_write_user_management_chanels and sysconsole_write_user_management_groups * update migrations, add unit tests * run migrations-extract * make updating ancillary permissions a post * update file names * add new api to doc, update body to just be []string * revert moving ancillary permissions to post * fix queries after final testing * Update channel.go * Update channel.go * Update 000124_remove_manage_team_permission.up.sql * Update 000124_remove_manage_team_permission.up.sql --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
485dc64c5f
Коммит
99881b819a
@@ -2293,6 +2293,30 @@ func TestRestoreChannel(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
// Make BasicUser, a User Manager
|
||||
oldRoles := th.BasicUser.Roles
|
||||
|
||||
// Because the permissions get set on initialization,
|
||||
// remove the manage_team permission from the User Management Role
|
||||
th.RemovePermissionFromRole(model.PermissionManageTeam.Id, model.SystemUserManagerRoleId)
|
||||
th.App.UpdateUserRoles(th.Context, th.BasicUser.Id, model.SystemUserManagerRoleId, false)
|
||||
defer func() {
|
||||
th.App.UpdateUserRoles(th.Context, th.BasicUser.Id, oldRoles, false)
|
||||
}()
|
||||
th.App.Srv().InvalidateAllCaches()
|
||||
th.Client.Login(context.Background(), th.BasicUser.Email, th.BasicUser.Password)
|
||||
|
||||
_, resp, err = th.Client.RestoreChannel(context.Background(), publicChannel1.Id)
|
||||
require.NoError(t, err)
|
||||
CheckOKStatus(t, resp)
|
||||
|
||||
_, resp, err = th.Client.RestoreChannel(context.Background(), privateChannel1.Id)
|
||||
require.NoError(t, err)
|
||||
CheckOKStatus(t, resp)
|
||||
|
||||
th.Client.DeleteChannel(context.Background(), publicChannel1.Id)
|
||||
th.Client.DeleteChannel(context.Background(), privateChannel1.Id)
|
||||
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
|
||||
defer func() {
|
||||
client.DeleteChannel(context.Background(), publicChannel1.Id)
|
||||
|
||||
Ссылка в новой задаче
Block a user