MM-25641: Check if member was deleted in HasPermissionToTeam (#14737)
This PR adds a check to verify if a team member got deleted in HasPermissionToTeam, and accordingly returns false.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e0edd2bebb
Коммит
fc028e703a
@@ -6,6 +6,7 @@ package app
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v5/model"
|
||||
@@ -41,3 +42,14 @@ func TestChannelRolesGrantPermission(t *testing.T) {
|
||||
require.Equal(t, testData.shouldHavePermission, th.App.RolesGrantPermission([]string{testData.channelRole.Name}, testData.permission.Id), "row: %+v\n", testData.truthTableRow)
|
||||
})
|
||||
}
|
||||
|
||||
func TestHasPermissionToTeam(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
assert.True(t, th.App.HasPermissionToTeam(th.BasicUser.Id, th.BasicTeam.Id, model.PERMISSION_LIST_TEAM_CHANNELS))
|
||||
|
||||
th.RemoveUserFromTeam(th.BasicUser, th.BasicTeam)
|
||||
|
||||
assert.False(t, th.App.HasPermissionToTeam(th.BasicUser.Id, th.BasicTeam.Id, model.PERMISSION_LIST_TEAM_CHANNELS))
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user