This commit is contained in:
mr
2024-12-03 10:57:28 +01:00
parent 471e0c9d9b
commit ea55c94c73
3 changed files with 27 additions and 5 deletions

View File

@@ -3,6 +3,7 @@ package workflow
import (
"errors"
"cloud.o-forge.io/core/oc-lib/models/collaborative_area/shallow_collaborative_area"
"cloud.o-forge.io/core/oc-lib/models/peer"
"cloud.o-forge.io/core/oc-lib/models/resources"
"cloud.o-forge.io/core/oc-lib/models/utils"
@@ -97,6 +98,20 @@ type Workflow struct {
AbstractWorkflow // AbstractWorkflow contains the basic fields of a workflow
}
func (ao *Workflow) VerifyAuth(peerID string, groups []string) bool {
isAuthorized := false
if len(ao.Shared) > 0 {
for _, shared := range ao.Shared {
shared, code, _ := shallow_collaborative_area.New(tools.COLLABORATIVE_AREA, peerID, groups, nil).LoadOne(shared)
if code != 200 || shared == nil {
isAuthorized = false
}
isAuthorized = shared.VerifyAuth(peerID, groups)
}
}
return isAuthorized
}
/*
* CheckBooking is a function that checks the booking of the workflow on peers (even ourselves)
*/