Skip to content

Commit

Permalink
lxd: Update authorization for warnings.
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Laing <[email protected]>
  • Loading branch information
markylaing committed Sep 27, 2023
1 parent 957d1d6 commit ee4ebdd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lxd/warnings.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (

"github.com/gorilla/mux"

"github.com/canonical/lxd/lxd/auth"
"github.com/canonical/lxd/lxd/db"
"github.com/canonical/lxd/lxd/db/cluster"
"github.com/canonical/lxd/lxd/db/operationtype"
Expand All @@ -32,16 +33,16 @@ import (
var warningsCmd = APIEndpoint{
Path: "warnings",

Get: APIEndpointAction{Handler: warningsGet},
Get: APIEndpointAction{Handler: warningsGet, AccessHandler: allowPermission(auth.ObjectTypeServer, auth.EntitlementCanEdit)},
}

var warningCmd = APIEndpoint{
Path: "warnings/{id}",

Get: APIEndpointAction{Handler: warningGet},
Patch: APIEndpointAction{Handler: warningPatch},
Put: APIEndpointAction{Handler: warningPut},
Delete: APIEndpointAction{Handler: warningDelete},
Get: APIEndpointAction{Handler: warningGet, AccessHandler: allowPermission(auth.ObjectTypeServer, auth.EntitlementCanEdit)},
Patch: APIEndpointAction{Handler: warningPatch, AccessHandler: allowPermission(auth.ObjectTypeServer, auth.EntitlementCanEdit)},
Put: APIEndpointAction{Handler: warningPut, AccessHandler: allowPermission(auth.ObjectTypeServer, auth.EntitlementCanEdit)},
Delete: APIEndpointAction{Handler: warningDelete, AccessHandler: allowPermission(auth.ObjectTypeServer, auth.EntitlementCanEdit)},
}

func filterWarnings(warnings []api.Warning, clauses *filter.ClauseSet) ([]api.Warning, error) {
Expand Down

0 comments on commit ee4ebdd

Please sign in to comment.