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 <mark.laing@canonical.com>
  • Loading branch information
markylaing committed Oct 25, 2023
1 parent 4c9f808 commit c4edd45
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 @@ -31,16 +32,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 c4edd45

Please sign in to comment.