Skip to content

Commit de5cd62

Browse files
committed
fix: Add missing scopes to TokenScope enum
1 parent 933318c commit de5cd62

File tree

2 files changed

+48
-3
lines changed

2 files changed

+48
-3
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!--
2+
A new scriv changelog fragment.
3+
4+
Uncomment the section that is right (remove the HTML comment wrapper).
5+
-->
6+
7+
<!--
8+
### Removed
9+
10+
- A bullet item for the Removed category.
11+
12+
-->
13+
<!--
14+
### Added
15+
16+
- A bullet item for the Added category.
17+
18+
-->
19+
<!--
20+
### Changed
21+
22+
- A bullet item for the Changed category.
23+
24+
-->
25+
<!--
26+
### Deprecated
27+
28+
- A bullet item for the Deprecated category.
29+
30+
-->
31+
32+
### Fixed
33+
34+
- Added missing scopes to the TokenScope Enum.
35+
36+
<!--
37+
### Security
38+
39+
- A bullet item for the Security category.
40+
41+
-->

pygitguardian/models.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,11 @@ class TokenScope(str, Enum):
749749
IP_ALLOWLIST_WRITE = "ip_allowlist:write"
750750
SOURCES_READ = "sources:read"
751751
SOURCES_WRITE = "sources:write"
752-
NHI_WRITE = "nhi:write"
752+
NHI_WRITE_VAULT = "nhi:write-vault"
753+
NHI_SEND_INVENTORY = "nhi:send-inventory"
754+
CUSTOM_TAGS_READ = "custom_tags:read"
755+
CUSTOM_TAGS_WRITE = "custom_tags:write"
756+
SECRET_READ = "secrets:read"
753757

754758

755759
class APITokensResponseSchema(BaseSchema):
@@ -764,7 +768,7 @@ class APITokensResponseSchema(BaseSchema):
764768
revoked_at = fields.AwareDateTime(allow_none=True)
765769
member_id = fields.Int(allow_none=True)
766770
creator_id = fields.Int(allow_none=True)
767-
scopes = fields.List(fields.Enum(TokenScope, by_value=True), required=False)
771+
scopes = fields.List(fields.String, required=False)
768772

769773
@post_load
770774
def make_api_tokens_response(
@@ -789,7 +793,7 @@ def __init__(
789793
revoked_at: Optional[datetime] = None,
790794
member_id: Optional[int] = None,
791795
creator_id: Optional[int] = None,
792-
scopes: Optional[List[TokenScope]] = None,
796+
scopes: Optional[List[str]] = None,
793797
):
794798
self.id = id
795799
self.name = name

0 commit comments

Comments
 (0)