apexauthlib 0.1.5__tar.gz → 0.1.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: apexauthlib
3
- Version: 0.1.5
3
+ Version: 0.1.6
4
4
  Summary: Apex authorization library for services
5
5
  Author: Apex Dev
6
6
  Author-email: dev@apex.ge
@@ -1,7 +1,7 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from dataclasses import dataclass, field
4
- from typing import Any, Generic, Mapping
4
+ from typing import Any, Generic, Iterable, Mapping
5
5
 
6
6
  from apexdevkit.formatter import DataclassFormatter, Formatter
7
7
  from apexdevkit.http import FluentHttp, JsonDict
@@ -95,6 +95,27 @@ class AuthApi(Generic[ItemT]):
95
95
  metadata=self.formatter.load(result["metadata"]),
96
96
  )
97
97
 
98
+ def users_for_service(self) -> Iterable[ServiceUserInfo[ItemT]]:
99
+ result = JsonDict(
100
+ (
101
+ self.http.with_header("Authorization", f"Bearer {self.token}")
102
+ .get()
103
+ .on_endpoint(f"/services/{self.service_name}/users")
104
+ .on_failure(raises=RuntimeError)
105
+ .json()
106
+ )
107
+ )["data"]["users"]
108
+
109
+ for raw_user in result["users"]:
110
+ user = dict(raw_user["user"])
111
+ user["hashed_password"] = "unknown"
112
+
113
+ yield ServiceUserInfo[ItemT](
114
+ user=self.user_formatter.load(user),
115
+ is_superuser=bool(raw_user["is_superuser"]),
116
+ metadata=self.formatter.load(raw_user["metadata"]),
117
+ )
118
+
98
119
 
99
120
  @dataclass
100
121
  class AuthCodeApi:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "apexauthlib"
3
- version = "0.1.5"
3
+ version = "0.1.6"
4
4
  description = "Apex authorization library for services"
5
5
  authors = [{ name = "Apex Dev", email = "dev@apex.ge" }]
6
6
  readme = "README.md"
File without changes
File without changes