workflow partial allows

This commit is contained in:
mr
2025-02-05 16:41:16 +01:00
parent a8e2445c10
commit 7201cabb43
4 changed files with 87 additions and 8 deletions

View File

@@ -13,6 +13,17 @@ type Owner struct {
Logo string `json:"logo,omitempty" bson:"logo,omitempty"`
}
func VerifyAccess(a Accessor, id string) error {
data, _, err := a.LoadOne(id)
if err != nil {
return err
}
if a.ShouldVerifyAuth() && !data.VerifyAuth(a.GetRequest()) {
return errors.New("you are not allowed to access :" + a.GetType().String())
}
return nil
}
// GenericLoadOne loads one object from the database (generic)
func GenericStoreOne(data DBObject, a Accessor) (DBObject, int, error) {
data.GenerateID()