XYZ-51: Unit tests for and changes to SetRolePermissionsFromConfig. (#8160)
* XYZ-10: Role store. * XYZ-37: Update unit tests to work with database roles. * XYZ-51: Tests 'SetRolePermissionsFromConfig' against JSON from policy page. * XYZ-51: Adds permissions in non-licensed cases also. * XYZ-51: Removes some permissions from team_user role. * XYZ-51: Merge fix for change to default permissions from PR 8208. * XYZ-51: Removes unused function.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0aa7ecd5e8
Коммит
3b83cc7dd3
@@ -460,7 +460,7 @@ func (a *App) DoAdvancedPermissionsMigration() {
|
||||
|
||||
l4g.Info("Migrating roles to database.")
|
||||
roles := model.MakeDefaultRoles()
|
||||
roles = utils.SetRolePermissionsFromConfig(roles, a.Config())
|
||||
roles = utils.SetRolePermissionsFromConfig(roles, a.Config(), utils.IsLicensed())
|
||||
|
||||
allSucceeded := true
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ package app
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
@@ -275,6 +276,8 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
||||
model.PERMISSION_GET_PUBLIC_LINK.Id,
|
||||
model.PERMISSION_CREATE_POST.Id,
|
||||
model.PERMISSION_USE_SLASH_COMMANDS.Id,
|
||||
model.PERMISSION_DELETE_PUBLIC_CHANNEL.Id,
|
||||
model.PERMISSION_DELETE_PRIVATE_CHANNEL.Id,
|
||||
model.PERMISSION_MANAGE_PRIVATE_CHANNEL_MEMBERS.Id,
|
||||
model.PERMISSION_DELETE_POST.Id,
|
||||
model.PERMISSION_EDIT_POST.Id,
|
||||
@@ -389,7 +392,7 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
||||
for name, permissions := range expected2 {
|
||||
role, err := th.App.GetRoleByName(name)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, permissions, role.Permissions)
|
||||
assert.Equal(t, permissions, role.Permissions, fmt.Sprintf("'%v' did not have expected permissions", name))
|
||||
}
|
||||
|
||||
// Remove the license.
|
||||
|
||||
Ссылка в новой задаче
Block a user