Fix broker 403 for members beyond Cloudron's default 25-user page: paginate all /users reads (per_page=100)
This commit is contained in:
1 parent
64d3c6aa83
commit
e00da486b5
1 file changed
+4
-4
+4
-4
@@ -904,7 +904,7 @@ async def cloudron_create_user(email: str, name: str) -> str:
|
|||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
# Check if user exists
|
# Check if user exists
|
||||||
r = await client.get(
|
r = await client.get(
|
||||||
f"{CLOUDRON_API}/api/v1/users",
|
f"{CLOUDRON_API}/api/v1/users?per_page=100",
|
||||||
headers=cloudron_headers(),
|
headers=cloudron_headers(),
|
||||||
)
|
)
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
@@ -998,7 +998,7 @@ async def cloudron_is_activated(user_id: str) -> bool:
|
|||||||
"""
|
"""
|
||||||
async with httpx.AsyncClient() as client:
|
async with httpx.AsyncClient() as client:
|
||||||
r = await client.get(
|
r = await client.get(
|
||||||
f"{CLOUDRON_API}/api/v1/users",
|
f"{CLOUDRON_API}/api/v1/users?per_page=100",
|
||||||
headers=cloudron_headers(),
|
headers=cloudron_headers(),
|
||||||
)
|
)
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
@@ -1857,7 +1857,7 @@ async def admin_overview(request: Request):
|
|||||||
try:
|
try:
|
||||||
async with httpx.AsyncClient(timeout=15.0) as client:
|
async with httpx.AsyncClient(timeout=15.0) as client:
|
||||||
r = await client.get(
|
r = await client.get(
|
||||||
f"{CLOUDRON_API}/api/v1/users",
|
f"{CLOUDRON_API}/api/v1/users?per_page=100",
|
||||||
headers={"Authorization": f"Bearer {CLOUDRON_TOKEN}"},
|
headers={"Authorization": f"Bearer {CLOUDRON_TOKEN}"},
|
||||||
)
|
)
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
@@ -2057,7 +2057,7 @@ def resolve_member_email(identity: str) -> str:
|
|||||||
import urllib.request
|
import urllib.request
|
||||||
|
|
||||||
req = urllib.request.Request(
|
req = urllib.request.Request(
|
||||||
f"{CLOUDRON_API}/api/v1/users",
|
f"{CLOUDRON_API}/api/v1/users?per_page=100",
|
||||||
headers={"Authorization": f"Bearer {CLOUDRON_TOKEN}"},
|
headers={"Authorization": f"Bearer {CLOUDRON_TOKEN}"},
|
||||||
)
|
)
|
||||||
with urllib.request.urlopen(req, timeout=15) as r:
|
with urllib.request.urlopen(req, timeout=15) as r:
|
||||||
|
|||||||
Reference in new issue
Block a user