massive draft for payment process (UNCOMPLETE)

This commit is contained in:
mr
2024-12-12 16:25:47 +01:00
parent fbbce7817b
commit 02d1e93c78
55 changed files with 3018 additions and 1177 deletions

View File

@@ -1,6 +1,8 @@
package workspace
import (
"fmt"
"cloud.o-forge.io/core/oc-lib/models/collaborative_area/shallow_collaborative_area"
"cloud.o-forge.io/core/oc-lib/models/resources"
"cloud.o-forge.io/core/oc-lib/models/utils"
@@ -16,17 +18,20 @@ type Workspace struct {
Shared string `json:"shared,omitempty" bson:"shared,omitempty"` // Shared is the ID of the shared workspace
}
func (d *Workspace) GetAccessor(username string, peerID string, groups []string, caller *tools.HTTPCaller) utils.Accessor {
return New(tools.WORKSPACE, username, peerID, groups, caller) // Create a new instance of the accessor
func (d *Workspace) GetAccessor(request *tools.APIRequest) utils.Accessor {
return NewAccessor(request) // Create a new instance of the accessor
}
func (ao *Workspace) VerifyAuth(username string, peerID string, groups []string) bool {
func (ao *Workspace) VerifyAuth(request *tools.APIRequest) bool {
fmt.Println("Workspace.VerifyAuth", ao.Shared)
if ao.Shared != "" {
shared, code, _ := shallow_collaborative_area.New(tools.COLLABORATIVE_AREA, username, peerID, groups, nil).LoadOne(ao.Shared)
shared, code, _ := shallow_collaborative_area.NewAccessor(request).LoadOne(ao.Shared)
fmt.Println("Workspace.VerifyAuth", shared, code)
if code != 200 || shared == nil {
return false
}
return shared.VerifyAuth(username, peerID, groups)
return shared.VerifyAuth(request)
}
return ao.AbstractObject.VerifyAuth(username, peerID, groups)
fmt.Println("Workspace.VerifyAuth", ao.AbstractObject.VerifyAuth(request))
return ao.AbstractObject.VerifyAuth(request)
}