Skip to content

Commit ff2fa52

Browse files
authored
Merge pull request #99 from sandialabs/users-group-default
Default all users to 'users' group in mock auth mode
2 parents df2191a + ee18289 commit ff2fa52

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

backend/core/auth.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ async def is_user_in_group(user_id: str, group_id: str) -> bool:
4545
logger.error(f"Error during external auth check: {e}", exc_info=True)
4646
return False
4747
else:
48+
# Everybody is in the users group by default
49+
if (group_id == "users"):
50+
return True
4851
# Fallback to mock implementation if no external endpoint is configured
4952
if (app_settings.debug_mode and
5053
user_id == app_settings.test_user and

docs/02_admin_guide.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,8 @@ You can configure the application to call an external HTTP endpoint to check for
479479
480480
If `AUTH_GROUP_CHECK_URL` is not set, the application will fall back to the mock implementation in `backend/core/auth.py`.
481481
482+
When using the mock implementation (no external endpoint configured), **all users are treated as part of the `users` group by default**. This ensures that basic, non-privileged features remain available even without an authorization service. Higher-privilege groups such as `admin` still require explicit membership via the mock group table or your real authorization system.
483+
482484
#### Legacy Method: Modifying the Code
483485
484486
For advanced use cases, you can still directly modify the `is_user_in_group` function located in `backend/core/auth.py`. The default implementation is a mock and **must be replaced** if you are not using the HTTP endpoint method.

0 commit comments

Comments
 (0)