Show grants on instance info page

This commit is contained in:
Tom Wiesing 2023-01-03 12:19:10 +01:00
parent 69b6579de7
commit dab7a5c4ae
No known key found for this signature in database
4 changed files with 69 additions and 1 deletions

View file

@ -0,0 +1,24 @@
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
target.Grants, err = up.Malt.Policy.Instance(flags.Context, up.Slug)
return err
}