massive draft for payment process (UNCOMPLETE)
This commit is contained in:
		@@ -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)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user