mirror of
https://github.com/bitwarden/server.git
synced 2024-11-22 12:15:36 +01:00
[AC-1682] Fixed Postgres query
This commit is contained in:
parent
deee483ab7
commit
c3ca9ec3c8
@ -24,6 +24,7 @@
|
||||
DROP TABLE IF EXISTS "TempUserManagers";
|
||||
CREATE TEMPORARY TABLE "TempUserManagers" AS
|
||||
SELECT "OU"."Id" AS "OrganizationUserId",
|
||||
"OU"."OrganizationId",
|
||||
CASE WHEN "OU"."Type" = 3 THEN true ELSE false END AS "IsManager"
|
||||
FROM "OrganizationUser" "OU"
|
||||
INNER JOIN "Organization" "O" ON "OU"."OrganizationId" = "O"."Id"
|
||||
@ -39,9 +40,12 @@
|
||||
SET "ReadOnly" = false,
|
||||
"HidePasswords" = false,
|
||||
"Manage" = false
|
||||
WHERE "CG"."CollectionId" IN (
|
||||
SELECT "C"."Id"
|
||||
FROM "Collection" "C"
|
||||
JOIN "TempGroupsAccessAll" "TG" ON "CG"."GroupId" = "TG"."GroupId"
|
||||
WHERE "CG"."CollectionId" = "C"."Id" AND "C"."OrganizationId" = TG."OrganizationId";
|
||||
INNER JOIN "TempGroupsAccessAll" "TG" ON "C"."OrganizationId" = "TG"."OrganizationId"
|
||||
WHERE "CG"."GroupId" = "TG"."GroupId"
|
||||
);
|
||||
|
||||
-- Insert new rows into CollectionGroups
|
||||
INSERT INTO "CollectionGroups" ("CollectionId", "GroupId", "ReadOnly", "HidePasswords", "Manage")
|
||||
@ -62,10 +66,12 @@
|
||||
SET "ReadOnly" = false,
|
||||
"HidePasswords" = false,
|
||||
"Manage" = false
|
||||
WHERE "CU"."CollectionId" IN (
|
||||
SELECT "C"."Id"
|
||||
FROM "Collection" "C"
|
||||
INNER JOIN "TempUsersAccessAll" "TU" ON "C"."OrganizationId" = "TU"."OrganizationId" AND
|
||||
"CU"."OrganizationUserId" = "TU"."OrganizationUserId"
|
||||
WHERE "CU"."CollectionId" = "C"."Id";
|
||||
INNER JOIN "TempUsersAccessAll" "TU" ON "C"."OrganizationId" = "TU"."OrganizationId"
|
||||
WHERE "CU"."OrganizationUserId" = "TU"."OrganizationUserId"
|
||||
);
|
||||
|
||||
-- Insert new rows into CollectionUsers
|
||||
INSERT INTO "CollectionUsers" ("CollectionId", "OrganizationUserId", "ReadOnly", "HidePasswords", "Manage")
|
||||
|
Loading…
Reference in New Issue
Block a user