Skip to content

Commit

Permalink
lxd: Simplify allowAuthenticated
Browse files Browse the repository at this point in the history
Signed-off-by: hamistao <[email protected]>
  • Loading branch information
hamistao committed Nov 18, 2024
1 parent 2243e4a commit 7e62ce7
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions lxd/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,7 @@ type APIEndpointAction struct {
// allowAuthenticated is an AccessHandler which allows only authenticated requests. This should be used in conjunction
// with further access control within the handler (e.g. to filter resources the user is able to view/edit).
func allowAuthenticated(_ *Daemon, r *http.Request) response.Response {
trusted, err := request.GetCtxValue[bool](r.Context(), request.CtxTrusted)
if err != nil {
return response.SmartError(err)
}

if trusted {
if auth.IsTrusted(r.Context()) {
return response.EmptySyncResponse
}

Expand Down

0 comments on commit 7e62ce7

Please sign in to comment.