Show grants on instance info page
This commit is contained in:
parent
69b6579de7
commit
dab7a5c4ae
4 changed files with 69 additions and 1 deletions
24
internal/wisski/ingredient/php/users/policy.go
Normal file
24
internal/wisski/ingredient/php/users/policy.go
Normal 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
|
||||
}
|
||||
|
|
@ -106,6 +106,7 @@ func (wisski *WissKI) allIngredients() []initFunc {
|
|||
auto[*extras.Pathbuilder],
|
||||
auto[*extras.Stats],
|
||||
auto[*users.Users],
|
||||
auto[*users.UserPolicy],
|
||||
|
||||
// info
|
||||
manual(func(info *info.Info) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue