Skip to content

Commit 45afa6f

Browse files
committed
fix(api-fields): fix api fields for vaultwarden v1.33.x + add v1.33 to CI tests
1 parent 51b3536 commit 45afa6f

6 files changed

Lines changed: 18 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
python-version: [ '3.10', '3.11', '3.12' ]
16+
python-version: [ '3.10', '3.11', '3.12', '3.13' ]
1717
os: [ ubuntu-latest ]
18-
vaultwarden-version: [ '1.30.5', '1.31.0' , '1.32.0']
18+
vaultwarden-version: [ '1.30.5', '1.31.0' , '1.32.7', '1.33.2' ]
1919
runs-on: ${{ matrix.os }}
2020
steps:
2121
- uses: actions/checkout@v3

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ test = "coverage run --source=src/vaultwarden -m unittest discover -p 'test_*.py
7373
_coverage = ["test", "coverage xml", "coverage report --show-missing"]
7474
with-coverage = "test"
7575
[[tool.hatch.envs.test.matrix]]
76-
python = ["3.10", "3.11", "3.12"]
76+
python = ["3.10", "3.11", "3.12", "3.13"]
7777
type = ["default"]
7878
[tool.hatch.envs.test.overrides]
7979
matrix.type.scripts = [

src/vaultwarden/clients/vaultwarden.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def invite(self, email: str) -> bool:
144144
self._load_users()
145145
return res
146146

147-
def delete(self, identifier: str) -> bool:
147+
def delete(self, identifier: str | UUID) -> bool:
148148
logger.info(f"Deleting {identifier} account")
149149
res = True
150150
try:

src/vaultwarden/models/bitwarden.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ def update_collection(self, collections: list[UUID]):
9191
class CollectionAccess(BitwardenBaseModel):
9292
ReadOnly: bool = False
9393
HidePasswords: bool = False
94+
Manage: bool = False
9495

9596

9697
class CollectionUser(CollectionAccess):
@@ -154,6 +155,7 @@ def set_users(
154155
users: list[CollectionUser] | list[UUID],
155156
default_readonly: bool = False,
156157
default_hide_passwords: bool = False,
158+
default_manage: bool = False,
157159
):
158160
users_payload = []
159161
if users is not None and len(users) > 0:
@@ -172,6 +174,7 @@ def set_users(
172174
"id": str(user_id),
173175
"readOnly": default_readonly,
174176
"hidePasswords": default_hide_passwords,
177+
"manage": default_manage,
175178
}
176179
for user_id in users
177180
]
@@ -203,6 +206,7 @@ class OrganizationUserDetails(BitwardenBaseModel):
203206
Collections: list[UserCollection]
204207
Groups: list | None = None
205208
TwoFactorEnabled: bool
209+
Permissions: dict | None = None
206210

207211
@field_validator("OrganizationId")
208212
@classmethod
@@ -221,6 +225,7 @@ def add_collections(self, collections: list[UUID]):
221225
UserId=self.Id,
222226
ReadOnly=False,
223227
HidePasswords=False,
228+
Manage=False
224229
)
225230
user.bitwarden_client = self.api_client
226231
self.Collections.append(user)
@@ -231,6 +236,7 @@ def add_collections(self, collections: list[UUID]):
231236
"CollectionId": True,
232237
"ReadOnly": True,
233238
"HidePasswords": True,
239+
"Manage": True,
234240
}
235241
},
236242
"Groups": True,
@@ -348,9 +354,13 @@ def invite(
348354
) = None,
349355
access_all: bool = False,
350356
user_type: OrganizationUserType = OrganizationUserType.User,
357+
permissions=None,
351358
default_readonly: bool = False,
352359
default_hide_passwords: bool = False,
360+
default_manage: bool = False,
353361
):
362+
if permissions is None:
363+
permissions = {}
354364
collections_payload = []
355365
if collections is not None and len(collections) > 0:
356366
for coll in collections:
@@ -378,6 +388,7 @@ def invite(
378388
"id": coll_id,
379389
"readOnly": default_readonly,
380390
"hidePasswords": default_hide_passwords,
391+
"manage": default_manage,
381392
}
382393
)
383394

@@ -387,6 +398,7 @@ def invite(
387398
"type": user_type,
388399
"collections": collections_payload,
389400
"groups": [],
401+
"permissions": permissions,
390402
}
391403
resp = self.api_client.api_request(
392404
"POST", f"api/organizations/{self.Id}/users/invite", json=payload

src/vaultwarden/models/enum.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class OrganizationUserType(IntEnum):
1313
Admin = 1
1414
User = 2
1515
Manager = 3
16+
Custom = 4
1617

1718

1819
class CipherType(IntEnum):

tests/e2e/run_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
if [[ -z "${VAULTWARDEN_VERSION}" ]]; then
4-
VAULTWARDEN_VERSION="1.32.0"
4+
VAULTWARDEN_VERSION="1.33.2"
55
fi
66

77
temp_dir=$(mktemp -d)

0 commit comments

Comments
 (0)