2024-07-25 09:28:55 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								package workspace
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								import (
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-03 10:57:28 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									"cloud.o-forge.io/core/oc-lib/models/collaborative_area/shallow_collaborative_area"
							 | 
						
					
						
							
								
									
										
										
										
											2024-07-26 10:36:23 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									"cloud.o-forge.io/core/oc-lib/models/resources"
							 | 
						
					
						
							
								
									
										
										
										
											2024-07-25 09:28:55 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									"cloud.o-forge.io/core/oc-lib/models/utils"
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-12 16:11:25 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									"cloud.o-forge.io/core/oc-lib/tools"
							 | 
						
					
						
							
								
									
										
										
										
											2024-07-25 09:28:55 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-30 14:50:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								// Workspace is a struct that represents a workspace
							 | 
						
					
						
							
								
									
										
										
										
											2024-07-25 09:28:55 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								type Workspace struct {
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-30 14:50:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									utils.AbstractObject         // AbstractObject contains the basic fields of an object (id, name)
							 | 
						
					
						
							
								
									
										
										
										
											2024-11-07 11:05:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									resources.ResourceSet        // ResourceSet contains the resources of the workspace (data, compute, processing, storage, workflow)
							 | 
						
					
						
							
								
									
										
										
										
											2024-08-30 14:50:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									IsContextual          bool   `json:"is_contextual" bson:"is_contextual" default:"false"` // IsContextual is a flag that indicates if the workspace is contextual
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									Active                bool   `json:"active" bson:"active" default:"false"`               // Active is a flag that indicates if the workspace is active
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									Shared                string `json:"shared,omitempty" bson:"shared,omitempty"`           // Shared is the ID of the shared workspace
							 | 
						
					
						
							
								
									
										
										
										
											2024-07-25 09:28:55 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-12 16:25:47 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								func (d *Workspace) GetAccessor(request *tools.APIRequest) utils.Accessor {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									return NewAccessor(request) // Create a new instance of the accessor
							 | 
						
					
						
							
								
									
										
										
										
											2024-07-25 09:28:55 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-03 10:57:28 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-12 16:25:47 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								func (ao *Workspace) VerifyAuth(request *tools.APIRequest) bool {
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-03 10:57:28 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									if ao.Shared != "" {
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-12 16:25:47 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										shared, code, _ := shallow_collaborative_area.NewAccessor(request).LoadOne(ao.Shared)
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-03 10:57:28 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										if code != 200 || shared == nil {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											return false
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										}
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-12 16:25:47 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										return shared.VerifyAuth(request)
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-03 10:57:28 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-12 16:25:47 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									return ao.AbstractObject.VerifyAuth(request)
							 | 
						
					
						
							
								
									
										
										
										
											2024-12-03 10:57:28 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 |