private async Task ConfigureBackendAsync(OrganizationModel organizationModel, PCMSOrganizationModel pcms) { // create a private folder to store backend configuration var privateFolder = new FolderModel(new FolderIdentifier(organizationModel.Identifier, ":private")) .InitializeEmptyMetadata() .InitializeEmptyPrivileges(); // write the backend configuration into the folder's metadata var backendConfiguration = new BackendConfiguration { DriverTypeName = "Documents.Backends.Drivers.Encryption.Driver, Documents.Backends.Drivers.Encryption", ConfigurationJSON = JsonConvert.SerializeObject(new { NextDriverTypeName = "Documents.Backends.Drivers.S3.Driver, Documents.Backends.Drivers.S3", MasterKey = pcms.MasterEncryptionKey, NextDriverConfigurationJson = JsonConvert.SerializeObject(new { AWSRegion = pcms.AWSS3Region, BucketName = pcms.AWSS3BucketName, pcms.AWSSecretAccessKey, pcms.AWSAccessKeyID }) }) }; privateFolder.Write(MetadataKeyConstants.BACKEND_CONFIGURATION, backendConfiguration); privateFolder.WriteACLs("read", idSystem); privateFolder.WriteACLs("write", idSystem); privateFolder.WriteACLs("gateway", idSystem, idOrganizationMember); privateFolder.Write("synchronize", new { ConnectionString = pcms.PCMSDBConnectionString, pcms.CountyID, LastChangeLogID = 0, LastAccountChangeLogID = 0 }); if (organizationModel.Read <bool?>("synchronize[isactive]") == null) { organizationModel.Write("synchronize[isactive]", true); } await api.Folder.PutAsync(privateFolder); }
private async Task ConfigureBackendAsync(OrganizationModel organizationModel, BasicOrganizationModel configurationModel) { // create a private folder to store backend configuration var privateFolder = new FolderModel(new FolderIdentifier(organizationModel.Identifier, ":private")) .InitializeEmptyMetadata() .InitializeEmptyPrivileges(); // write the backend configuration into the folder's metadata var backendConfiguration = new BackendConfiguration { DriverTypeName = "Documents.Backends.Drivers.FileSystem.Driver, Documents.Backends.Drivers.FileSystem", ConfigurationJSON = JsonConvert.SerializeObject(new { configurationModel.BasePath }) }; privateFolder.Write(MetadataKeyConstants.BACKEND_CONFIGURATION, backendConfiguration); privateFolder.WriteACLs("read", idSystem); privateFolder.WriteACLs("write", idSystem); privateFolder.WriteACLs("gateway", idSystem, idOrganizationMember); await api.Folder.PutAsync(privateFolder); }