Example #1
0
        public Controller_SSOAccessToken(
            string _AccessToken_TokenTypeSpacePrepended,
            IBDatabaseServiceInterface _DatabaseService,
            IBMemoryServiceInterface _MemoryService,
            string _AzureAD_AppID,
            string _AzureAD_ClientSecret,
            List <string> _SSOSuperAdmins,
            Action <string> _ErrorMessageAction = null)
        {
            AccessToken_TokenTypeSpacePrepended = _AccessToken_TokenTypeSpacePrepended;

            DatabaseService = _DatabaseService;
            MemoryService   = _MemoryService;

            AzureAD_AppID        = _AzureAD_AppID;
            AzureAD_ClientSecret = _AzureAD_ClientSecret;

            SSOSuperAdmins = _SSOSuperAdmins;

            int SpaceIx = AccessToken_TokenTypeSpacePrepended.IndexOf(' ');

            if (SpaceIx < 0)
            {
                throw new ArgumentException("Invalid _AccessToken_TokenTypeSpacePrepended. It must contain the token type.");
            }
            AccessToken_WithoutTokenType = AccessToken_TokenTypeSpacePrepended.Substring(SpaceIx + 1);

            ErrorMessageAction = _ErrorMessageAction;
        }
Example #2
0
 public Model_GetUpdateDeleteRevision(IBDatabaseServiceInterface _DatabaseService, string _RestfulUrlParameter_ModelsKey, string _RestfulUrlParameter_RevisionsKey, string _CadFileStorageBucketName)
 {
     DatabaseService                  = _DatabaseService;
     CadFileStorageBucketName         = _CadFileStorageBucketName;
     RestfulUrlParameter_ModelsKey    = _RestfulUrlParameter_ModelsKey;
     RestfulUrlParameter_RevisionsKey = _RestfulUrlParameter_RevisionsKey;
 }
Example #3
0
        public static bool TryGettingModelID(
            IBDatabaseServiceInterface _DatabaseService,
            string _RequestedModelName,
            out string _ModelID,
            out BWebServiceResponse _FailureResponse,
            Action <string> _ErrorMessageAction)
        {
            _FailureResponse = BWebResponse.InternalError("");
            _ModelID         = string.Empty;

            if (!_DatabaseService.GetItem(
                    UniqueFileFieldsDBEntry.DBSERVICE_UNIQUEFILEFIELDS_TABLE(),
                    UniqueFileFieldsDBEntry.KEY_NAME_MODEL_UNIQUE_NAME,
                    new BPrimitiveType(_RequestedModelName),
                    UniqueFileFieldsDBEntry.Properties,
                    out JObject ModelIDResponse,
                    _ErrorMessageAction) || !ModelIDResponse.ContainsKey(ModelDBEntry.KEY_NAME_MODEL_ID))
            {
                _FailureResponse = BWebResponse.InternalError("Model ID could not be retrieved from the database.");
                return(false);
            }

            _ModelID = (string)ModelIDResponse[ModelDBEntry.KEY_NAME_MODEL_ID];
            return(true);
        }
Example #4
0
 public User_UpdateDeleteBaseRight_ForUser(IBDatabaseServiceInterface _DatabaseService, IBMemoryServiceInterface _MemoryService, string _RestfulUrlParameter_UsersKey, string _RestfulUrlParameter_BaseAccessRightsKey)
 {
     DatabaseService = _DatabaseService;
     MemoryService   = _MemoryService;
     RestfulUrlParameter_UsersKey            = _RestfulUrlParameter_UsersKey;
     RestfulUrlParameter_BaseAccessRightsKey = _RestfulUrlParameter_BaseAccessRightsKey;
 }
Example #5
0
 public BDatabaseServicesTest(IBDatabaseServiceInterface _DBService, string _TableName, string _StringKey, Action <string> _PrintAction)
 {
     SelectedDBService = _DBService;
     TableName         = _TableName;
     Key         = _StringKey;
     PrintAction = _PrintAction;
 }
Example #6
0
 public GetModelsBy_MetadataKeyValueUserPair(IBDatabaseServiceInterface _DatabaseService, string _RestfulUrlParameter_UserID, string _RestfulUrlParameter_MetadataKey, string _RestfulUrlParameter_MetadataValues)
 {
     DatabaseService                    = _DatabaseService;
     RestfulUrlParameter_UserID         = _RestfulUrlParameter_UserID;
     RestfulUrlParameter_MetadataKey    = _RestfulUrlParameter_MetadataKey;
     RestfulUrlParameter_MetadataValues = _RestfulUrlParameter_MetadataValues;
 }
Example #7
0
 public Model_ChangeSharingWithUsers(string _InternalCallPrivateKey, string _AuthServiceEndpoint, IBDatabaseServiceInterface _DatabaseService, string _RestfulUrlParameter_ModelsKey)
 {
     InternalCallPrivateKey        = _InternalCallPrivateKey;
     AuthServiceEndpoint           = _AuthServiceEndpoint;
     DatabaseService               = _DatabaseService;
     RestfulUrlParameter_ModelsKey = _RestfulUrlParameter_ModelsKey;
 }
Example #8
0
 public User_DeleteUserAccessMethod_ForUser(IBDatabaseServiceInterface _DatabaseService, IBMemoryServiceInterface _MemoryService, string _RestfulUrlParameter_UsersKey, string _RestfulUrlParameter_AccessMethodKey)
 {
     DatabaseService = _DatabaseService;
     MemoryService   = _MemoryService;
     RestfulUrlParameter_UsersKey        = _RestfulUrlParameter_UsersKey;
     RestfulUrlParameter_AccessMethodKey = _RestfulUrlParameter_AccessMethodKey;
 }
Example #9
0
        public static bool GetProcessedFile(
            WebServiceBaseTimeoutable _Request,
            ENodeType _FileType,
            IBDatabaseServiceInterface _DatabaseService,
            IBFileServiceInterface _FileService,
            string _CadFileStorageBucketName,
            string _ModelID,
            int _RevisionIndex,
            out BWebServiceResponse _SuccessResponse,
            out BWebServiceResponse _FailureResponse,
            Action <string> _ErrorMessageAction = null)
        {
            _SuccessResponse = BWebResponse.InternalError("");

            if (!Controller_AtomicDBOperation.Get().GetClearanceForDBOperation(_Request.InnerProcessor, ModelDBEntry.DBSERVICE_MODELS_TABLE(), _ModelID, _ErrorMessageAction))
            {
                _FailureResponse = BWebResponse.InternalError("Atomic operation control has failed.");
                return(false);
            }

            var bResult = GetProcessedFile_Internal(
                _FileType,
                _DatabaseService,
                _FileService,
                _CadFileStorageBucketName,
                _ModelID,
                _RevisionIndex,
                out _SuccessResponse,
                out _FailureResponse,
                _ErrorMessageAction);

            Controller_AtomicDBOperation.Get().SetClearanceForDBOperationForOthers(_Request.InnerProcessor, ModelDBEntry.DBSERVICE_MODELS_TABLE(), _ModelID, _ErrorMessageAction);

            return(bResult);
        }
Example #10
0
        public static bool RegisterUserAsPlaceholder(out string _UserID, IBDatabaseServiceInterface _DatabaseService, string _EmailWithoutPrefix, string _Name, List <string> _SSOSuperAdmins, Action <string> _ErrorMessageAction)
        {
            JArray NewBaseRights;

            if (_SSOSuperAdmins.Contains(_EmailWithoutPrefix))
            {
                if (!CreateUser(out _UserID, out _, _DatabaseService, _EmailWithoutPrefix, _Name, _ErrorMessageAction))
                {
                    return(false);
                }
                NewBaseRights = new JArray()
                {
                    JObject.Parse(JsonConvert.SerializeObject(
                                      new AccessScope()
                    {
                        WildcardPath = "*",
                        AccessRights = new List <string>()
                        {
                            "GET", "POST", "PUT", "DELETE"
                        }
                    }))
                };
            }
            else if (!CreateUser(out _UserID, out NewBaseRights, _DatabaseService, _EmailWithoutPrefix, _Name, _ErrorMessageAction))
            {
                return(false);
            }

            if (!Controller_Rights_Internal.Get().GrantUserWithRights(false, _UserID, NewBaseRights, _ErrorMessageAction))
            {
                return(false);
            }

            return(true);
        }
Example #11
0
        public static void Initialize(
            IBDatabaseServiceInterface _DatabaseService,
            IBFileServiceInterface _FileService,
            string _DeploymentBranchName,
            string _DeploymentBuildNumber,
            string _CadProcessServiceName,
            Dictionary <string, string> _FileWorkerEnvironmentVariables,
            System.Action _InitFailedAction,
            Action <string> _ErrorMessageAction = null)
        {
            FileWorkerEnvironmentVariables = _FileWorkerEnvironmentVariables;
            DeploymentBranchName           = _DeploymentBranchName;
            DeploymentBuildNumber          = _DeploymentBuildNumber;


            FileService     = _FileService;
            DatabaseService = _DatabaseService;
            Instance        = new BatchProcessingCreationService();

            string CadProcessServiceName = _CadProcessServiceName;

            BTaskWrapper.Run(() =>
            {
                while (true)
                {
                    try
                    {
                        V1Service CadProcessService = Instance.K8sManager.GetServiceByNameAndNamespace(CadProcessServiceName, SERVICE_NAMESPACE);

                        if (CadProcessService != null &&
                            CadProcessService.Status != null &&
                            CadProcessService.Status.LoadBalancer != null &&
                            CadProcessService.Status.LoadBalancer.Ingress != null &&
                            CadProcessService.Status.LoadBalancer.Ingress.Any()

                            && CadProcessService.Spec != null &&
                            CadProcessService.Spec.Ports != null &&
                            CadProcessService.Spec.Ports.Any() &&
                            !string.IsNullOrWhiteSpace(CadProcessService.Status.LoadBalancer.Ingress.First().Ip))
                        {
                            CadProcessUrl = $"http://{CadProcessService.Status.LoadBalancer.Ingress.First().Ip}:{CadProcessService.Spec.Ports.First().Port}/";
                            WaitInit.Set();
                            break;
                        }
                        else
                        {
                            Thread.Sleep(1000);
                        }
                    }
                    catch (Exception ex)
                    {
                        _ErrorMessageAction?.Invoke($"Failed to initialize Batch process environment: {ex.Message}\n{ex.StackTrace}");
                        //If we fail at this point then it means the cluster master endpoint is unavailable or there is no ingress which means batch process can't system can't initialize.
                        //This can happen instantly or 5 minutes after the program started depending on if an ingress is still being created and how long it takes so decide what to do in provided action
                        _InitFailedAction.Invoke();
                    }
                }
            });
        }
Example #12
0
 public Model_GetHierarchyFile_ForRevision(IBFileServiceInterface _FileService, IBDatabaseServiceInterface _DatabaseService, string _RestfulUrlParameter_ModelsKey, string _RestfulUrlParameter_RevisionsKey, string _CadFileStorageBucketName)
 {
     FileService                      = _FileService;
     DatabaseService                  = _DatabaseService;
     CadFileStorageBucketName         = _CadFileStorageBucketName;
     RestfulUrlParameter_ModelsKey    = _RestfulUrlParameter_ModelsKey;
     RestfulUrlParameter_RevisionsKey = _RestfulUrlParameter_RevisionsKey;
 }
Example #13
0
        public static bool FetchUserInfoFromDatabaseService_ByMethod(
            IBDatabaseServiceInterface _DatabaseService,
            IBMemoryServiceInterface _MemoryService,
            string _Method,
            out string _UserID,
            out string _UserEmail,
            out string _UserName,
            out BWebServiceResponse _FailureResponse,
            Action <string> _ErrorMessageAction = null)
        {
            _UserID          = null;
            _UserEmail       = null;
            _UserName        = null;
            _FailureResponse = new BWebServiceResponse();

            string ReturnedEntryAsString = null;

            if (!_DatabaseService.GetItem(
                    AuthDBEntry.DBSERVICE_AUTHMETHODS_TABLE(),
                    AuthDBEntry.KEY_NAME_AUTH_DB_ENTRY,
                    new BPrimitiveType(_Method),
                    AuthDBEntry.Properties,
                    out JObject ReturnedObject,
                    _ErrorMessageAction))
            {
                _FailureResponse = BWebResponse.InternalError("Database fetch operation has failed");
                return(false);
            }
            if (ReturnedObject == null)
            {
                _ErrorMessageAction?.Invoke("FetchFromDatabaseService: Given credentials are invalid: " + _Method);
                _FailureResponse = BWebResponse.Unauthorized("Given credentials are invalid.");
                return(false);
            }

            try
            {
                ReturnedEntryAsString = ReturnedObject.ToString();
                var ReturnedEntry = JsonConvert.DeserializeObject <AuthDBEntry>(ReturnedEntryAsString);
                _UserID    = ReturnedEntry.UserID;
                _UserEmail = ReturnedEntry.UserEmail;
                _UserName  = ReturnedEntry.UserName;
            }
            catch (Exception e)
            {
                _ErrorMessageAction?.Invoke("FetchFromDatabaseService: " + e.Message + ", Trace: " + e.StackTrace);
                _FailureResponse = BWebResponse.InternalError("Database fetch operation failed.");
                return(false);
            }

            _MemoryService.SetKeyValue(CommonData.MemoryQueryParameters, new Tuple <string, BPrimitiveType>[]
            {
                new Tuple <string, BPrimitiveType>(AuthDBEntry.KEY_NAME_AUTH_DB_ENTRY + _Method, new BPrimitiveType(ReturnedEntryAsString))
            },
                                       _ErrorMessageAction);

            return(true);
        }
Example #14
0
 public Model_GetUpdateDeleteRaw_ForRevision(IBFileServiceInterface _FileService, IBDatabaseServiceInterface _DatabaseService, string _RestfulUrlParameter_ModelsKey, string _RestfulUrlParameter_RevisionsKey, string _CadFileStorageBucketName, string _CadProcessServiceEndpoint)
 {
     FileService                      = _FileService;
     DatabaseService                  = _DatabaseService;
     CadFileStorageBucketName         = _CadFileStorageBucketName;
     RestfulUrlParameter_ModelsKey    = _RestfulUrlParameter_ModelsKey;
     RestfulUrlParameter_RevisionsKey = _RestfulUrlParameter_RevisionsKey;
     CadProcessServiceEndpoint        = _CadProcessServiceEndpoint;
 }
Example #15
0
 public Model_RemoveModelShare(
     IBDatabaseServiceInterface _DatabaseService,
     string _RestfulUrlParameter_ModelsKey,
     string _RestfulUrlParameter_UserIDKey)
 {
     DatabaseService = _DatabaseService;
     RestfulUrlParameter_ModelsKey = _RestfulUrlParameter_ModelsKey;
     RestfulUrlParameter_UserIDKey = _RestfulUrlParameter_UserIDKey;
 }
Example #16
0
 public Model_GetUnrealGeometry(IBFileServiceInterface _FileService, IBDatabaseServiceInterface _DatabaseService, string _RestfulUrlParameter_ModelsKey, string _RestfulUrlParameter_RevisionsKey, string _RestfulUrlParameter_GeometryKey, string _CadFileStorageBucketName)
 {
     FileService                      = _FileService;
     DatabaseService                  = _DatabaseService;
     CadFileStorageBucketName         = _CadFileStorageBucketName;
     RestfulUrlParameter_ModelsKey    = _RestfulUrlParameter_ModelsKey;
     RestfulUrlParameter_RevisionsKey = _RestfulUrlParameter_RevisionsKey;
     RestfulUrlParameter_GeometryKey  = _RestfulUrlParameter_GeometryKey;
 }
Example #17
0
        public bool WithDatabaseService()
        {
            /*
             * File service initialization
             */
            if (!RequiredEnvironmentVariables.ContainsKey("MONGODB_DATABASE"))
            {
                LoggingService.WriteLogs(BLoggingServiceMessageUtility.Single(EBLoggingServiceLogType.Critical, "((MONGODB_CONNECTION_STRING) or (MONGODB_CLIENT_CONFIG, MONGODB_PASSWORD) or (MONGODB_HOST, MONGODB_PORT)) and MONGODB_DATABASE must be provided and valid."), ProgramID, "Initialization");
                return(false);
            }

            if (RequiredEnvironmentVariables.ContainsKey("MONGODB_CLIENT_CONFIG") &&
                RequiredEnvironmentVariables.ContainsKey("MONGODB_PASSWORD"))
            {
                DatabaseService = new BDatabaseServiceMongoDB(RequiredEnvironmentVariables["MONGODB_CLIENT_CONFIG"], RequiredEnvironmentVariables["MONGODB_PASSWORD"], RequiredEnvironmentVariables["MONGODB_DATABASE"],
                                                              (string Message) =>
                {
                    LoggingService.WriteLogs(BLoggingServiceMessageUtility.Single(EBLoggingServiceLogType.Critical, Message), ProgramID, "Initialization");
                });
            }
            else if (RequiredEnvironmentVariables.ContainsKey("MONGODB_CONNECTION_STRING"))
            {
                DatabaseService = new BDatabaseServiceMongoDB(RequiredEnvironmentVariables["MONGODB_CONNECTION_STRING"], RequiredEnvironmentVariables["MONGODB_DATABASE"],
                                                              (string Message) =>
                {
                    LoggingService.WriteLogs(BLoggingServiceMessageUtility.Single(EBLoggingServiceLogType.Critical, Message), ProgramID, "Initialization");
                });
            }
            else if (RequiredEnvironmentVariables.ContainsKey("MONGODB_HOST") &&
                     RequiredEnvironmentVariables.ContainsKey("MONGODB_PORT") &&
                     int.TryParse(RequiredEnvironmentVariables["MONGODB_PORT"], out int MongoDbPort))
            {
                DatabaseService = new BDatabaseServiceMongoDB(RequiredEnvironmentVariables["MONGODB_HOST"], MongoDbPort, RequiredEnvironmentVariables["MONGODB_DATABASE"],
                                                              (string Message) =>
                {
                    LoggingService.WriteLogs(BLoggingServiceMessageUtility.Single(EBLoggingServiceLogType.Critical, Message), ProgramID, "Initialization");
                });
            }
            else
            {
                LoggingService.WriteLogs(BLoggingServiceMessageUtility.Single(EBLoggingServiceLogType.Critical, "((MONGODB_CONNECTION_STRING) or (MONGODB_CLIENT_CONFIG, MONGODB_PASSWORD) or (MONGODB_HOST, MONGODB_PORT)) and MONGODB_DATABASE must be provided and valid."), ProgramID, "Initialization");
                return(false);
            }

            if (DatabaseService == null || !DatabaseService.HasInitializationSucceed())
            {
                LoggingService.WriteLogs(BLoggingServiceMessageUtility.Single(EBLoggingServiceLogType.Critical, "Database service initialization has failed."), ProgramID, "Initialization");
                return(false);
            }

            return(true);
        }
Example #18
0
        public static bool GetProcessedFileNode(
            WebServiceBaseTimeoutable _Request,
            ENodeType _FileType,
            IBDatabaseServiceInterface _DatabaseService,
            IBFileServiceInterface _FileService,
            string _CadFileStorageBucketName,
            string _ModelID,
            int _RevisionIndex,
            bool _bRootNodeRequested, ulong _NodeID,
            out BWebServiceResponse _SuccessResponse,
            out BWebServiceResponse _FailureResponse,
            Action <string> _ErrorMessageAction = null)
        {
            _SuccessResponse = BWebResponse.InternalError("");

            uint StartIndex = 0, Size = 0;

            if (!_bRootNodeRequested)
            {
                Convert.UniqueIDToStartIndexAndSize(_NodeID, out StartIndex, out Size);
                if (StartIndex == 0 || Size == 0)
                {
                    _FailureResponse = BWebResponse.BadRequest("Invalid Node ID.");
                    return(false);
                }
            }

            if (!Controller_AtomicDBOperation.Get().GetClearanceForDBOperation(_Request.InnerProcessor, ModelDBEntry.DBSERVICE_MODELS_TABLE(), _ModelID, _ErrorMessageAction))
            {
                _FailureResponse = BWebResponse.InternalError("Atomic operation control has failed.");
                return(false);
            }

            var bResult = GetProcessedFileNode_Internal(
                _FileType,
                _DatabaseService,
                _FileService,
                _CadFileStorageBucketName,
                _ModelID,
                _RevisionIndex,
                _bRootNodeRequested,
                StartIndex,
                Size,
                out _SuccessResponse,
                out _FailureResponse,
                _ErrorMessageAction);

            Controller_AtomicDBOperation.Get().SetClearanceForDBOperationForOthers(_Request.InnerProcessor, ModelDBEntry.DBSERVICE_MODELS_TABLE(), _ModelID, _ErrorMessageAction);

            return(bResult);
        }
Example #19
0
        public SSOAzureLoginCallback(
            IBDatabaseServiceInterface _DatabaseService,
            IBMemoryServiceInterface _MemoryService,
            string _AzureAD_AppID,
            string _AzureAD_ClientSecret,
            List <string> _SSOSuperAdmins)
        {
            DatabaseService = _DatabaseService;
            MemoryService   = _MemoryService;

            AzureAD_AppID        = _AzureAD_AppID;
            AzureAD_ClientSecret = _AzureAD_ClientSecret;

            SSOSuperAdmins = _SSOSuperAdmins;
        }
Example #20
0
        public SSOAzureTokenRefreshRequest(
            IBDatabaseServiceInterface _DatabaseService,
            IBMemoryServiceInterface _MemoryService,
            string _AzureAD_AppID,
            string _AzureAD_ClientSecret,
            List <string> _SSOSuperAdmins)
        {
            DatabaseService = _DatabaseService;
            MemoryService   = _MemoryService;

            AzureAD_AppID        = _AzureAD_AppID;
            AzureAD_ClientSecret = _AzureAD_ClientSecret;

            SSOSuperAdmins = _SSOSuperAdmins;
        }
Example #21
0
            public SynchronizeUsersWithAzureAD(
                string _InternalCallPrivateKey,
                string _AzureOAuth2TokenRequestUrl,
                string _AzureFetchUsersClientID,
                string _AzureFetchUsersClientSecret,
                string _AzureFetchUsersAppObjectID,
                IBDatabaseServiceInterface _DatabaseService,
                List <string> _SSOSuperAdmins) : base(_InternalCallPrivateKey)
            {
                FetchUsersClientID     = _AzureFetchUsersClientID;
                FetchUsersClientSecret = _AzureFetchUsersClientSecret;
                FetchUsersAppObjectID  = _AzureFetchUsersAppObjectID;

                OAuth2TokenRequestUrl = _AzureOAuth2TokenRequestUrl;

                DatabaseService = _DatabaseService;

                SSOSuperAdmins = _SSOSuperAdmins;
            }
Example #22
0
        public bool WithDatabaseService()
        {
            /*
             * File service initialization
             */
            DatabaseService = new BDatabaseServiceGC(RequiredEnvironmentVariables["GOOGLE_CLOUD_PROJECT_ID"],
                                                     (string Message) =>
            {
                LoggingService.WriteLogs(BLoggingServiceMessageUtility.Single(EBLoggingServiceLogType.Critical, Message), ProgramID, "Initialization");
            });

            if (DatabaseService == null || !DatabaseService.HasInitializationSucceed())
            {
                LoggingService.WriteLogs(BLoggingServiceMessageUtility.Single(EBLoggingServiceLogType.Critical, "Database service initialization has failed."), ProgramID, "Initialization");
                return(false);
            }

            return(true);
        }
Example #23
0
        public bool WithDatabaseService()
        {
            /*
             * Database service initialization
             */
            DatabaseService = new BDatabaseServiceAWS(RequiredEnvironmentVariables["AWS_ACCESS_KEY"], RequiredEnvironmentVariables["AWS_SECRET_KEY"], RequiredEnvironmentVariables["AWS_REGION"],
                                                      (string Message) =>
            {
                LoggingService.WriteLogs(BLoggingServiceMessageUtility.Single(EBLoggingServiceLogType.Critical, Message), ProgramID, "Initialization");
            });

            if (DatabaseService == null || !DatabaseService.HasInitializationSucceed())
            {
                LoggingService.WriteLogs(BLoggingServiceMessageUtility.Single(EBLoggingServiceLogType.Critical, "Database service initialization has failed."), ProgramID, "Initialization");
                return(false);
            }

            return(true);
        }
Example #24
0
        public static bool TryGettingAllInfo(
            IBDatabaseServiceInterface _DatabaseService,
            string _ModelID,
            int _RevisionIndex,
            out ModelDBEntry _ModelObject,
            out Revision _RevisionObject,
            out int _RevisionListIx,
            out BWebServiceResponse _FailureResponse,
            Action <string> _ErrorMessageAction = null)
        {
            _RevisionObject  = null;
            _RevisionListIx  = -1;
            _FailureResponse = BWebResponse.InternalError("");

            if (!TryGettingModelInfo(
                    _DatabaseService,
                    _ModelID,
                    out JObject _,
                    true, out _ModelObject,
                    out BWebServiceResponse FailureResponse,
                    _ErrorMessageAction))
            {
                _FailureResponse = FailureResponse;
                return(false);
            }

            if (!DoesRevisionExist(
                    _ModelObject,
                    _RevisionIndex,
                    out _RevisionObject,
                    out _RevisionListIx))
            {
                _FailureResponse = BWebResponse.NotFound("Revision does not exist.");
                return(false);
            }

            return(true);
        }
Example #25
0
        public static bool FetchBaseAccessRights_ByMethod(
            IBDatabaseServiceInterface _DatabaseService,
            IBMemoryServiceInterface _MemoryService,
            string _Method,
            out List <AccessScope> _AccessScopes,
            out string _UserID,
            out string _UserEmail,
            out string _UserName,
            out BWebServiceResponse _FailureResponse,
            Action <string> _ErrorMessageAction = null)
        {
            _AccessScopes = null;

            if (!FetchUserInfoFromMemoryService_ByMethod(_MemoryService, _Method, out _UserID, out _UserEmail, out _UserName, _ErrorMessageAction))
            {
                if (!FetchUserInfoFromDatabaseService_ByMethod(_DatabaseService, _MemoryService, _Method, out _UserID, out _UserEmail, out _UserName, out _FailureResponse, _ErrorMessageAction))
                {
                    return(false);
                }
            }

            return(FetchBaseAccessRights_ByUserID(_DatabaseService, _MemoryService, _UserID, out _AccessScopes, out _FailureResponse, _ErrorMessageAction));
        }
Example #26
0
        public static bool TryGettingModelInfo(
            IBDatabaseServiceInterface _DatabaseService,
            string _ModelID,
            out JObject _SuccessResultJson,
            bool _bDeserialize, out ModelDBEntry _SuccessResultDeserialized,
            out BWebServiceResponse _FailureResponse,
            Action <string> _ErrorMessageAction = null)
        {
            _FailureResponse           = BWebResponse.InternalError("");
            _SuccessResultDeserialized = null;

            var ModelKey = new BPrimitiveType(_ModelID);

            if (!_DatabaseService.GetItem(
                    ModelDBEntry.DBSERVICE_MODELS_TABLE(),
                    ModelDBEntry.KEY_NAME_MODEL_ID,
                    ModelKey,
                    ModelDBEntry.Properties,
                    out _SuccessResultJson,
                    _ErrorMessageAction))
            {
                _FailureResponse = BWebResponse.InternalError("Database fetch-model-info operation has failed.");
                return(false);
            }
            if (_SuccessResultJson == null)
            {
                _FailureResponse = BWebResponse.NotFound("Model does not exist.");
                return(false);
            }

            if (_bDeserialize)
            {
                _SuccessResultDeserialized = JsonConvert.DeserializeObject <ModelDBEntry>(_SuccessResultJson.ToString());
            }

            return(true);
        }
Example #27
0
 public OnMinuteCallRequest(string _InternalPrivateKey, IBDatabaseServiceInterface _DatabaseService) : base(_InternalPrivateKey)
 {
     DatabaseService = _DatabaseService;
 }
Example #28
0
 public CleanupCall(string _InternalCallPrivateKey, IBDatabaseServiceInterface _DatabaseService, IBMemoryServiceInterface _MemoryService) : base(_InternalCallPrivateKey)
 {
     DatabaseService = _DatabaseService;
     MemoryService   = _MemoryService;
 }
Example #29
0
 public PubSub_To_AuthService(string _InternalCallPrivateKey, IBDatabaseServiceInterface _DatabaseService) : base(_InternalCallPrivateKey)
 {
     DatabaseService = _DatabaseService;
 }
Example #30
0
 public User_GetUpdateDeleteUser(IBDatabaseServiceInterface _DatabaseService, IBMemoryServiceInterface _MemoryService, string _RestfulUrlParameter_UsersKey)
 {
     DatabaseService = _DatabaseService;
     MemoryService   = _MemoryService;
     RestfulUrlParameter_UsersKey = _RestfulUrlParameter_UsersKey;
 }