can delete + search

This commit is contained in:
mr
2026-04-07 08:32:42 +02:00
parent 3ad0a69f54
commit 2e9f4cb9f4
5 changed files with 138 additions and 7 deletions

View File

@@ -81,10 +81,6 @@ func (r *AbstractResource) CanUpdate(set utils.DBObject) (bool, utils.DBObject)
return r.IsDraft, set
}
func (r *AbstractResource) CanDelete() bool {
return r.IsDraft // only draft bookings can be deleted
}
type AbstractInstanciatedResource[T ResourceInstanceITF] struct {
AbstractResource // AbstractResource contains the basic fields of an object (id, name)

View File

@@ -78,9 +78,6 @@ func GenericDeleteOne(id string, a Accessor) (DBObject, int, error) {
if !res.CanDelete() {
return nil, 403, errors.New("you are not allowed to delete :" + a.GetType().String())
}
if err != nil {
return nil, code, err
}
if a.ShouldVerifyAuth() && !res.VerifyAuth("delete", a.GetRequest()) {
return nil, 403, errors.New("you are not allowed to access " + a.GetType().String())
}

View File

@@ -25,6 +25,8 @@ func (g *GraphItem) GetResource() (tools.DataType, resources.ResourceInterface)
return tools.PROCESSING_RESOURCE, g.Processing
} else if g.Storage != nil {
return tools.STORAGE_RESOURCE, g.Storage
} else if g.NativeTool != nil {
return tools.NATIVE_TOOL, g.NativeTool
}
return tools.INVALID, nil
}