mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 08:55:24 +00:00
18faa5a06b
- Add policy.rego file defining authorization policies. - Add Go integrations to evaluate Rego policies (via OPA). - Add middleware to ensure requests without authorization check are rejected (guard against programmer error). - Add authorization checks to most service endpoints.
14 lines
337 B
Go
14 lines
337 B
Go
package test
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/fleetdm/fleet/server/contexts/viewer"
|
|
"github.com/fleetdm/fleet/server/kolide"
|
|
)
|
|
|
|
// UserContext returns a new context with the provided user as the viewer.
|
|
func UserContext(user *kolide.User) context.Context {
|
|
return viewer.NewContext(context.Background(), viewer.Viewer{User: user})
|
|
}
|