[MM-28717] Refactor applyMultiRoleFilters to use sq builder (#15500)
* Refactor apply multi role filters and add role filters to get all profiles * Add some tests * Fix tests * Fix lint * Trigger CI * Rename param to make more sense * Tie get filtered user stats to usermanagement read users * Dont filter out other system roles when searching for team members or team admins only filter out system admins * add new permissions * add migration * fix test * remove system roles as default permissions * implement changes discussed with dennis * add read only and fix i18n * use model consts instead of strings * turn the permissions into pseudo constants * Update read only default permissions Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: Hossein Ahmadian-Yazdi <hyazdi1997@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
1d15900f84
Коммит
c9a4a475d3
@@ -502,6 +502,15 @@ func (a *App) getAddConvertChannelPermissionsMigration() (permissionsMap, error)
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *App) getSystemRolesPermissionsMigration() (permissionsMap, error) {
|
||||
return permissionsMap{
|
||||
permissionTransformation{
|
||||
On: isRole(model.SYSTEM_ADMIN_ROLE_ID),
|
||||
Add: []string{model.PERMISSION_SYSCONSOLE_READ_USERMANAGEMENT_SYSTEM_ROLES.Id, model.PERMISSION_SYSCONSOLE_WRITE_USERMANAGEMENT_SYSTEM_ROLES.Id},
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (a *App) getAddManageSharedChannelsPermissionsMigration() (permissionsMap, error) {
|
||||
return permissionsMap{
|
||||
permissionTransformation{
|
||||
@@ -531,6 +540,7 @@ func (a *App) DoPermissionsMigrations() error {
|
||||
{Key: model.MIGRATION_KEY_ADD_SYSTEM_CONSOLE_PERMISSIONS, Migration: a.getAddSystemConsolePermissionsMigration},
|
||||
{Key: model.MIGRATION_KEY_ADD_CONVERT_CHANNEL_PERMISSIONS, Migration: a.getAddConvertChannelPermissionsMigration},
|
||||
{Key: model.MIGRATION_KEY_ADD_MANAGE_SHARED_CHANNEL_PERMISSIONS, Migration: a.getAddManageSharedChannelsPermissionsMigration},
|
||||
{Key: model.MIGRATION_KEY_ADD_SYSTEM_ROLES_PERMISSIONS, Migration: a.getSystemRolesPermissionsMigration},
|
||||
}
|
||||
|
||||
for _, migration := range PermissionsMigrations {
|
||||
|
||||
Ссылка в новой задаче
Block a user