adding inputs output struct based on argo naming for now
This commit is contained in:
parent
2662709fed
commit
275bd56fe6
@ -83,9 +83,6 @@ func (ao *CollaborativeArea) VerifyAuth(request *tools.APIRequest) bool {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ao.CreatorID == request.PeerID {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return ao.AbstractObject.VerifyAuth(request)
|
||||
}
|
||||
|
@ -26,9 +26,6 @@ func (r *WorkflowResource) GetType() string {
|
||||
func (d *WorkflowResource) Trim() {
|
||||
/* EMPTY */
|
||||
}
|
||||
func (abs *WorkflowResource) VerifyAuth(request *tools.APIRequest) bool {
|
||||
return true
|
||||
}
|
||||
func (w *WorkflowResource) SetAllowedInstances(request *tools.APIRequest) {
|
||||
/* EMPTY */
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ func GenericStoreOne(data DBObject, a Accessor) (DBObject, int, error) {
|
||||
},
|
||||
}
|
||||
if a.ShouldVerifyAuth() && !data.VerifyAuth(a.GetRequest()) {
|
||||
return nil, 403, errors.New("you are not allowed to access this collaborative area")
|
||||
return nil, 403, errors.New("you are not allowed to access : " + a.GetType().String())
|
||||
}
|
||||
if cursor, _, _ := a.Search(&f, "", data.IsDrafted()); len(cursor) > 0 {
|
||||
return nil, 409, errors.New(a.GetType().String() + " with name " + data.GetName() + " already exists")
|
||||
@ -52,14 +52,14 @@ func GenericStoreOne(data DBObject, a Accessor) (DBObject, int, error) {
|
||||
func GenericDeleteOne(id string, a Accessor) (DBObject, int, error) {
|
||||
res, code, err := a.LoadOne(id)
|
||||
if !res.CanDelete() {
|
||||
return nil, 403, errors.New("you are not allowed to delete this collaborative area")
|
||||
return nil, 403, errors.New("you are not allowed to delete :" + a.GetType().String())
|
||||
}
|
||||
if err != nil {
|
||||
a.GetLogger().Error().Msg("Could not retrieve " + id + " to db. Error: " + err.Error())
|
||||
return nil, code, err
|
||||
}
|
||||
if a.ShouldVerifyAuth() && !res.VerifyAuth(a.GetRequest()) {
|
||||
return nil, 403, errors.New("you are not allowed to access this collaborative area")
|
||||
return nil, 403, errors.New("you are not allowed to access " + a.GetType().String())
|
||||
}
|
||||
_, code, err = mongo.MONGOService.DeleteOne(id, a.GetType().String())
|
||||
if err != nil {
|
||||
@ -78,12 +78,12 @@ func GenericUpdateOne(set DBObject, id string, a Accessor, new DBObject) (DBObje
|
||||
}
|
||||
ok, newSet := r.CanUpdate(set)
|
||||
if !ok {
|
||||
return nil, 403, errors.New("you are not allowed to delete this collaborative area")
|
||||
return nil, 403, errors.New("you are not allowed to delete :" + a.GetType().String())
|
||||
}
|
||||
set = newSet
|
||||
r.UpToDate(a.GetUser(), a.GetPeerID(), false)
|
||||
if a.ShouldVerifyAuth() && !r.VerifyAuth(a.GetRequest()) {
|
||||
return nil, 403, errors.New("you are not allowed to access this collaborative area")
|
||||
return nil, 403, errors.New("you are not allowed to access :" + a.GetType().String())
|
||||
}
|
||||
change := set.Serialize(set) // get the changes
|
||||
loaded := r.Serialize(r) // get the loaded object
|
||||
@ -108,7 +108,7 @@ func GenericLoadOne[T DBObject](id string, f func(DBObject) (DBObject, int, erro
|
||||
}
|
||||
res_mongo.Decode(&data)
|
||||
if a.ShouldVerifyAuth() && !data.VerifyAuth(a.GetRequest()) {
|
||||
return nil, 403, errors.New("you are not allowed to access this collaborative area")
|
||||
return nil, 403, errors.New("you are not allowed to access :" + a.GetType().String())
|
||||
}
|
||||
return f(data)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user