Skip to content

Commit 2e0dc4b

Browse files
committed
fix(permissions): remove access_all field and add detailed permissions/groups for vaultwarden v1.34
1 parent 964e13b commit 2e0dc4b

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

src/vaultwarden/clients/vaultwarden.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,9 @@ def reset_account(
218218
org.invite(
219219
email,
220220
collections=user_details.Collections,
221-
access_all=user_details.AccessAll,
222221
user_type=user_details.Type,
222+
groups=user_details.Groups,
223+
permissions=user_details.Permissions,
223224
)
224225
if len(orgs) == 0:
225226
logger.warning("No organisation in the rights")
@@ -254,7 +255,8 @@ def transfer_account_rights(
254255
org.invite(
255256
new_email,
256257
collections=user_details.Collections,
257-
access_all=user_details.AccessAll,
258258
user_type=user_details.Type,
259+
groups=user_details.Groups,
260+
permissions=user_details.Permissions,
259261
)
260262
self.set_user_enabled(str(user.Id), enabled=False)

src/vaultwarden/models/bitwarden.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ class OrganizationUserDetails(BitwardenBaseModel):
199199
OrganizationId: UUID | None = Field(None, validate_default=True)
200200
Status: int
201201
Type: OrganizationUserType
202-
AccessAll: bool
203202
ExternalId: str | None
204203
Key: str | None = None
205204
ResetPasswordKey: str | None = None
@@ -241,7 +240,7 @@ def add_collections(self, collections: list[UUID]):
241240
},
242241
"Groups": True,
243242
"Type": True,
244-
"AccessAll": True,
243+
"Permissions": True,
245244
},
246245
by_alias=True,
247246
mode="json",
@@ -273,7 +272,7 @@ def remove_collections(self, collections: list[UUID]):
273272
},
274273
"Groups": True,
275274
"Type": True,
276-
"AccessAll": True,
275+
"Permissions": True,
277276
},
278277
by_alias=True,
279278
mode="json",
@@ -308,7 +307,7 @@ def update_collection(self, collections: list[UUID]):
308307
},
309308
"Groups": True,
310309
"Type": True,
311-
"AccessAll": True,
310+
"Permissions": True,
312311
},
313312
by_alias=True,
314313
mode="json",
@@ -352,15 +351,17 @@ def invite(
352351
| list[str]
353352
| None
354353
) = None,
355-
access_all: bool = False,
356354
user_type: OrganizationUserType = OrganizationUserType.User,
357355
permissions=None,
356+
groups: list[UUID] | None = None,
358357
default_readonly: bool = False,
359358
default_hide_passwords: bool = False,
360359
default_manage: bool = False,
361360
):
362361
if permissions is None:
363362
permissions = {}
363+
if groups is None:
364+
groups = []
364365
collections_payload = []
365366
if collections is not None and len(collections) > 0:
366367
for coll in collections:
@@ -394,10 +395,9 @@ def invite(
394395

395396
payload = {
396397
"emails": [email],
397-
"accessAll": access_all,
398398
"type": user_type,
399399
"collections": collections_payload,
400-
"groups": [],
400+
"groups": groups,
401401
"permissions": permissions,
402402
}
403403
resp = self.api_client.api_request(

0 commit comments

Comments
 (0)