MM-58525 Fix upload file permissions (#27298)

* tie create_post and upload_file permissions together

* update tests

* update file name

* update migration to do in batches

* Update 000122_remove_upload_file_permission.up.sql

* fix formatting

* simplify migrations, fix regex issue

* update file names for recent merge

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Scott Bishel
2024-06-24 10:47:52 -06:00
коммит произвёл GitHub
родитель 6a2078ecf0
Коммит 71c25fb316
10 изменённых файлов: 130 добавлений и 10 удалений

Просмотреть файл

@@ -0,0 +1 @@
-- Skipping it because the forward migrations are destructive

Просмотреть файл

@@ -0,0 +1,18 @@
CREATE PROCEDURE RemoveUuploadFilePermission()
BEGIN
updateRoles: LOOP
-- update affected rows
UPDATE Roles
SET Permissions = REGEXP_REPLACE(Permissions, 'upload_file([[:space:]]|$)', '')
WHERE Permissions like '%upload_file%' and Permissions not REGEXP 'create_post([[:space:]]|$)'
LIMIT 100;
-- check if the loop has completed
IF ROW_COUNT() < 100 THEN
LEAVE updateRoles;
END IF;
END LOOP updateRoles;
END;
CALL RemoveUuploadFilePermission();
DROP PROCEDURE IF EXISTS RemoveUuploadFilePermission;