This commit adds a safeguard to accessing the still from a specific component by requiring access via the component.GetStill method.
25 lines
548 B
Go
25 lines
548 B
Go
package users
|
|
|
|
import (
|
|
"github.com/FAU-CDI/wisski-distillery/internal/status"
|
|
"github.com/FAU-CDI/wisski-distillery/internal/wisski/ingredient"
|
|
)
|
|
|
|
type UserPolicy struct {
|
|
ingredient.Base
|
|
}
|
|
|
|
var (
|
|
_ ingredient.WissKIFetcher = (*UserPolicy)(nil)
|
|
)
|
|
|
|
func (up *UserPolicy) Fetch(flags ingredient.FetcherFlags, target *status.WissKI) (err error) {
|
|
if flags.Quick {
|
|
return nil
|
|
}
|
|
|
|
// read the grants into the info struct
|
|
liquid := ingredient.GetLiquid(up)
|
|
target.Grants, err = liquid.Policy.Instance(flags.Context, liquid.Slug)
|
|
return err
|
|
}
|