Skip to content

Commit 7276adf

Browse files
committed
Remove vault permission operations for groups
Currently, they're not working as expected to be part of a beta release. They will be brought back once they're in a working state.
1 parent b38e88f commit 7276adf

File tree

4 files changed

+30
-223
lines changed

4 files changed

+30
-223
lines changed

src/onepassword/client.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@
88
from .secrets import Secrets
99
from .items import Items
1010
from .vaults import Vaults
11-
from .groups import Groups
1211

1312

1413
class Client:
1514
secrets: Secrets
1615
items: Items
1716
vaults: Vaults
18-
groups: Groups
1917

2018
@classmethod
2119
async def authenticate(
@@ -39,7 +37,6 @@ async def authenticate(
3937
authenticated_client.secrets = Secrets(client_id, core)
4038
authenticated_client.items = Items(client_id, core)
4139
authenticated_client.vaults = Vaults(client_id, core)
42-
authenticated_client.groups = Groups(client_id, core)
4340

4441
authenticated_client._finalizer = weakref.finalize(
4542
cls, core.release_client, client_id

src/onepassword/groups.py

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/onepassword/types.py

Lines changed: 30 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -140,108 +140,6 @@ class GeneratePasswordResponse(BaseModel):
140140
"""
141141

142142

143-
class GroupType(str, Enum):
144-
OWNERS = "owners"
145-
"""
146-
The owners group, which gives the following permissions:
147-
- Do everything the Admin group can do
148-
- See every vault other than the personal vaults
149-
- Change people's names
150-
- See billing
151-
- Change billing
152-
- Make other people owners
153-
- Delete a person
154-
"""
155-
ADMINISTRATORS = "administrators"
156-
"""
157-
The administrators group, which gives the following permissions:
158-
- Perform recovery
159-
- Create new vaults
160-
- Invite new members
161-
- See vault metadata, including the vault name and who has access.
162-
- Make other people admins
163-
"""
164-
RECOVERY = "recovery"
165-
"""
166-
The recovery group. It contains recovery keysets, and is added to every vault to allow for recovery.
167-
168-
No one is added to this.
169-
"""
170-
EXTERNALACCOUNTMANAGERS = "externalAccountManagers"
171-
"""
172-
The external account managers group or EAM is a mandatory group for managed accounts that has
173-
same permissions as the owners.
174-
"""
175-
TEAMMEMBERS = "teamMembers"
176-
"""
177-
Members of a team that a user is on.
178-
"""
179-
USERDEFINED = "userDefined"
180-
"""
181-
A custom, user defined group.
182-
"""
183-
UNSUPPORTED = "unsupported"
184-
"""
185-
Support for new or renamed group types
186-
"""
187-
188-
189-
class GroupState(str, Enum):
190-
ACTIVE = "active"
191-
"""
192-
This group is active
193-
"""
194-
DELETED = "deleted"
195-
"""
196-
This group has been deleted
197-
"""
198-
UNSUPPORTED = "unsupported"
199-
"""
200-
This group is in an unknown state
201-
"""
202-
203-
204-
class VaultAccessorType(str, Enum):
205-
USER = "user"
206-
GROUP = "group"
207-
208-
209-
class VaultAccess(BaseModel):
210-
"""
211-
Represents the vault access information.
212-
"""
213-
214-
model_config = ConfigDict(populate_by_name=True)
215-
216-
vault_uuid: str = Field(alias="vaultUuid")
217-
"""
218-
The vault's UUID.
219-
"""
220-
accessor_type: VaultAccessorType = Field(alias="accessorType")
221-
"""
222-
The vault's accessor type.
223-
"""
224-
accessor_uuid: str = Field(alias="accessorUuid")
225-
"""
226-
The vault's accessor UUID.
227-
"""
228-
permissions: int
229-
"""
230-
The permissions granted to this vault
231-
"""
232-
233-
234-
class Group(BaseModel):
235-
model_config = ConfigDict(populate_by_name=True)
236-
237-
id: str
238-
title: str
239-
description: str
240-
group_type: GroupType = Field(alias="groupType")
241-
state: GroupState
242-
vault_access: Optional[List[VaultAccess]] = Field(alias="vaultAccess", default=None)
243-
244-
245143
class GroupAccess(BaseModel):
246144
"""
247145
Represents a group's access to a 1Password vault.
@@ -258,12 +156,6 @@ class GroupAccess(BaseModel):
258156
"""
259157

260158

261-
class GroupGetParams(BaseModel):
262-
model_config = ConfigDict(populate_by_name=True)
263-
264-
vault_permissions: Optional[bool] = Field(alias="vaultPermissions", default=None)
265-
266-
267159
class GroupVaultAccess(BaseModel):
268160
"""
269161
Represents a group's access to a 1Password vault.
@@ -1262,6 +1154,36 @@ class VaultType(str, Enum):
12621154
UNSUPPORTED = "unsupported"
12631155

12641156

1157+
class VaultAccessorType(str, Enum):
1158+
USER = "user"
1159+
GROUP = "group"
1160+
1161+
1162+
class VaultAccess(BaseModel):
1163+
"""
1164+
Represents the vault access information.
1165+
"""
1166+
1167+
model_config = ConfigDict(populate_by_name=True)
1168+
1169+
vault_uuid: str = Field(alias="vaultUuid")
1170+
"""
1171+
The vault's UUID.
1172+
"""
1173+
accessor_type: VaultAccessorType = Field(alias="accessorType")
1174+
"""
1175+
The vault's accessor type.
1176+
"""
1177+
accessor_uuid: str = Field(alias="accessorUuid")
1178+
"""
1179+
The vault's accessor UUID.
1180+
"""
1181+
permissions: int
1182+
"""
1183+
The permissions granted to this vault
1184+
"""
1185+
1186+
12651187
class Vault(BaseModel):
12661188
"""
12671189
Represents regular vault information together with the vault's access information.
@@ -1528,19 +1450,3 @@ class WordListType(str, Enum):
15281450
"""
15291451
Three (random) letter "words"
15301452
"""
1531-
1532-
1533-
ARCHIVE_ITEMS: int = 256
1534-
CREATE_ITEMS: int = 128
1535-
DELETE_ITEMS: int = 512
1536-
EXPORT_ITEMS: int = 4194304
1537-
IMPORT_ITEMS: int = 2097152
1538-
MANAGE_VAULT: int = 2
1539-
NO_ACCESS: int = 0
1540-
PRINT_ITEMS: int = 8388608
1541-
READ_ITEMS: int = 32
1542-
RECOVER_VAULT: int = 1
1543-
REVEAL_ITEM_PASSWORD: int = 16
1544-
SEND_ITEMS: int = 1048576
1545-
UPDATE_ITEMS: int = 64
1546-
UPDATE_ITEM_HISTORY: int = 1024

src/onepassword/vaults.py

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
from typing import Optional, List
55
from pydantic import TypeAdapter
66
from .types import (
7-
GroupAccess,
8-
GroupVaultAccess,
97
Vault,
108
VaultGetParams,
119
VaultListParams,
@@ -75,63 +73,3 @@ async def get(self, vault_uuid: str, vault_params: VaultGetParams) -> Vault:
7573

7674
response = TypeAdapter(Vault).validate_json(response)
7775
return response
78-
79-
async def grant_group_permissions(
80-
self, vault_id: str, group_permissions_list: List[GroupAccess]
81-
) -> None:
82-
response = await self.core.invoke(
83-
{
84-
"invocation": {
85-
"clientId": self.client_id,
86-
"parameters": {
87-
"name": "VaultsGrantGroupPermissions",
88-
"parameters": {
89-
"vault_id": vault_id,
90-
"group_permissions_list": [
91-
o.model_dump(by_alias=True)
92-
for o in group_permissions_list
93-
],
94-
},
95-
},
96-
}
97-
}
98-
)
99-
100-
return None
101-
102-
async def update_group_permissions(
103-
self, group_permissions_list: List[GroupVaultAccess]
104-
) -> None:
105-
response = await self.core.invoke(
106-
{
107-
"invocation": {
108-
"clientId": self.client_id,
109-
"parameters": {
110-
"name": "VaultsUpdateGroupPermissions",
111-
"parameters": {
112-
"group_permissions_list": [
113-
o.model_dump(by_alias=True)
114-
for o in group_permissions_list
115-
]
116-
},
117-
},
118-
}
119-
}
120-
)
121-
122-
return None
123-
124-
async def revoke_group_permissions(self, vault_id: str, group_id: str) -> None:
125-
response = await self.core.invoke(
126-
{
127-
"invocation": {
128-
"clientId": self.client_id,
129-
"parameters": {
130-
"name": "VaultsRevokeGroupPermissions",
131-
"parameters": {"vault_id": vault_id, "group_id": group_id},
132-
},
133-
}
134-
}
135-
)
136-
137-
return None

0 commit comments

Comments
 (0)