mirror of
https://github.com/dani-garcia/vaultwarden.wiki.git
synced 2026-11-15 18:25:56 +02:00
Add Custom Roles account recovery permission (#7965)
This commit is contained in:
11 files changed
+168
-38
No files matched your search
@@ -0,0 +1,13 @@
|
||||
-- Dropping the permission would silently take it away from the Custom members holding it. So while there are any,
|
||||
-- this fails on the duplicate key below, before anything is dropped: take it away first, or restore the backup
|
||||
-- taken before the upgrade.
|
||||
-- A failed attempt leaves the temporary table on this connection. Clear it before retrying.
|
||||
DROP TEMPORARY TABLE IF EXISTS custom_role_downgrade;
|
||||
CREATE TEMPORARY TABLE custom_role_downgrade (blocked_by VARCHAR(255) NOT NULL PRIMARY KEY);
|
||||
INSERT INTO custom_role_downgrade VALUES ('Manage account recovery: take it away first, or restore the backup taken before the upgrade');
|
||||
INSERT INTO custom_role_downgrade
|
||||
SELECT 'Manage account recovery: take it away first, or restore the backup taken before the upgrade'
|
||||
FROM users_organizations WHERE manage_reset_password LIMIT 1;
|
||||
DROP TEMPORARY TABLE custom_role_downgrade;
|
||||
|
||||
ALTER TABLE users_organizations DROP COLUMN manage_reset_password;
|
||||
@@ -0,0 +1,3 @@
|
||||
-- The Manage account recovery permission of the Custom member role. Like the other permissions it only takes
|
||||
-- effect on a Custom membership (atype 4) while EXPERIMENTAL_CUSTOM_ROLES is enabled, and nobody starts with it.
|
||||
ALTER TABLE users_organizations ADD COLUMN manage_reset_password BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
-- Dropping the permission would silently take it away from the Custom members holding it. So while there are any,
|
||||
-- this fails on the duplicate key below: take it away first, or restore the backup taken before the upgrade.
|
||||
-- It needs to run in one transaction, as Diesel does.
|
||||
CREATE TEMPORARY TABLE custom_role_downgrade (blocked_by VARCHAR(255) NOT NULL PRIMARY KEY);
|
||||
INSERT INTO custom_role_downgrade VALUES ('Manage account recovery: take it away first, or restore the backup taken before the upgrade');
|
||||
INSERT INTO custom_role_downgrade
|
||||
SELECT 'Manage account recovery: take it away first, or restore the backup taken before the upgrade'
|
||||
FROM users_organizations WHERE manage_reset_password LIMIT 1;
|
||||
DROP TABLE custom_role_downgrade;
|
||||
|
||||
ALTER TABLE users_organizations DROP COLUMN manage_reset_password;
|
||||
@@ -0,0 +1,3 @@
|
||||
-- The Manage account recovery permission of the Custom member role. Like the other permissions it only takes
|
||||
-- effect on a Custom membership (atype 4) while EXPERIMENTAL_CUSTOM_ROLES is enabled, and nobody starts with it.
|
||||
ALTER TABLE users_organizations ADD COLUMN manage_reset_password BOOLEAN NOT NULL DEFAULT FALSE;
|
||||
@@ -0,0 +1,11 @@
|
||||
-- Dropping the permission would silently take it away from the Custom members holding it. So while there are any,
|
||||
-- this fails on the duplicate key below: take it away first, or restore the backup taken before the upgrade.
|
||||
-- It needs to run in one transaction, as Diesel does.
|
||||
CREATE TEMPORARY TABLE custom_role_downgrade (blocked_by VARCHAR(255) NOT NULL PRIMARY KEY);
|
||||
INSERT INTO custom_role_downgrade VALUES ('Manage account recovery: take it away first, or restore the backup taken before the upgrade');
|
||||
INSERT INTO custom_role_downgrade
|
||||
SELECT 'Manage account recovery: take it away first, or restore the backup taken before the upgrade'
|
||||
FROM users_organizations WHERE manage_reset_password LIMIT 1;
|
||||
DROP TABLE custom_role_downgrade;
|
||||
|
||||
ALTER TABLE users_organizations DROP COLUMN manage_reset_password;
|
||||
@@ -0,0 +1,3 @@
|
||||
-- The Manage account recovery permission of the Custom member role. Like the other permissions it only takes
|
||||
-- effect on a Custom membership (atype 4) while EXPERIMENTAL_CUSTOM_ROLES is enabled, and nobody starts with it.
|
||||
ALTER TABLE users_organizations ADD COLUMN manage_reset_password BOOLEAN NOT NULL DEFAULT 0; -- FALSE
|
||||
Reference in new issue
Block a user