Compare commits

2 Commits
Author SHA1 Message Date
Gabriel20xxandClaude Sonnet 5 c9737d1f9f mediaauth: expose SetAuthGuardBaseURL for live AuthGuard-URL retargeting
A project built via NewWithStore previously had no way to react to
ProjectConfigurator's live authguard_url push (coreconfig.Store.OnUpdate)
the way a project holding its own *authclient.Client directly could via
SetBaseURL - this closes that gap without exposing the client itself.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-13 12:30:19 +02:00
Gabriel20xxandClaude Sonnet 5 a5eb37a823 Add changeset for UserManagement's project-access picker
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-13 12:20:56 +02:00
2 changed files with 21 additions and 0 deletions

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@gabriel20xx/web-ui": minor
---
`UserManagement` accepts an optional `projects` prop (`KnownProject[]`): when present, each account gets a per-project login-access picker (checkboxes in the edit row, a summary in the read-only row) and `onUpdate` receives a `projects: string[]` field. Only AuthGuard's own admin UI passes this prop today; every other consumer is unaffected.
+16
View File
@@ -345,6 +345,22 @@ func (s *Service) enabled() bool {
return s.authGuard != nil return s.authGuard != nil
} }
// SetAuthGuardBaseURL retargets the AuthGuard base URL this Service's
// internal authclient.Client calls, taking effect on its very next call -
// wire it as a coreconfig.Store's OnUpdate callback (see
// ProjectConfigurator/README.md's "Pushing core service info to other
// projects" section) so a live authguard_url change applies without a
// restart, the same as a project holding its own *authclient.Client
// directly. A no-op if this Service was constructed in auth-disabled mode
// (AUTHGUARD_URL unset at startup - see the "Auth-disabled mode" section):
// there is no client to retarget, and this package has no path to start
// authenticating requests it previously always let through.
func (s *Service) SetAuthGuardBaseURL(baseURL string) {
if s.authGuard != nil {
s.authGuard.SetBaseURL(baseURL)
}
}
func UserFromContext(ctx context.Context) *User { func UserFromContext(ctx context.Context) *User {
value, _ := ctx.Value(userContextKey).(*User) value, _ := ctx.Value(userContextKey).(*User)
return value return value