Add initial implementation of grants

This commit is contained in:
Tom Wiesing 2023-01-02 15:12:06 +01:00
parent b8f1281f78
commit 69b6579de7
No known key found for this signature in database
15 changed files with 308 additions and 73 deletions

View file

@ -0,0 +1,27 @@
package policy
import (
"context"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component"
"github.com/FAU-CDI/wisski-distillery/internal/dis/component/sql"
"github.com/FAU-CDI/wisski-distillery/internal/models"
"gorm.io/gorm"
)
type Policy struct {
component.Base
Dependencies struct {
SQL *sql.SQL
}
}
var (
_ component.Provisionable = (*Policy)(nil)
_ component.UserDeleteHook = (*Policy)(nil)
)
func (pol *Policy) table(ctx context.Context) (*gorm.DB, error) {
return pol.Dependencies.SQL.QueryTable(ctx, true, models.GrantTable)
}