From 45009dfacc931a632f1257cb399b8ef45a7dc4e7 Mon Sep 17 00:00:00 2001 From: Meik Date: Sun, 29 Mar 2026 23:26:16 +0200 Subject: [PATCH] Add integer data area type id --- LiamBaseClasses/C4IT.LIAM.Base.cs | 1 + LiamM42WebApi/LiamM42WebApiController.cs | 657 +++++++++--------- LiamWorkflowActivities/LiamWorkflowRuntime.cs | 3 +- 3 files changed, 332 insertions(+), 329 deletions(-) diff --git a/LiamBaseClasses/C4IT.LIAM.Base.cs b/LiamBaseClasses/C4IT.LIAM.Base.cs index d377fe6..8a76372 100644 --- a/LiamBaseClasses/C4IT.LIAM.Base.cs +++ b/LiamBaseClasses/C4IT.LIAM.Base.cs @@ -373,6 +373,7 @@ namespace C4IT.LIAM public string Description { get; set; } public string UniqueId { get; set; } public string DataAreaType { get; set; } + public int DataAreaTypeId { get; set; } } public class LiamApiVersionInfo { diff --git a/LiamM42WebApi/LiamM42WebApiController.cs b/LiamM42WebApi/LiamM42WebApiController.cs index 4a6945d..ca54e4e 100644 --- a/LiamM42WebApi/LiamM42WebApiController.cs +++ b/LiamM42WebApi/LiamM42WebApiController.cs @@ -557,238 +557,238 @@ where "; return RetVal; } - private bool TryLoadProviderFragments(Guid providerConfigClassID, out Guid objectId, out DataTable tblMain, out DataTable tblBase, out DataTable tblAdditionalAttr, out DataTable tblNamingConvention, out DataTable tblCustomTags) - { - objectId = Guid.Empty; - tblMain = null; - tblBase = null; - tblAdditionalAttr = null; - tblNamingConvention = null; - tblCustomTags = null; - - try - { - var classID = SPSDataEngineSchemaReader.ClassGetIDFromName(constFragmentNameConfigProviderMain); - LogEntry($"Config provider class ID: {classID}", LogLevels.Debug); - var fragment = FragmentRequest.GetSPSFragment(classID, providerConfigClassID); - if (fragment == null) - { - LogEntry($"Provider config fragment not found: ClassID={classID}, FragmentId={providerConfigClassID}", LogLevels.Debug); - return false; - } - - objectId = fragment.ObjectID; - if (objectId == Guid.Empty) - { - LogEntry($"Provider config fragment not found: ClassID={classID}, FragmentId={providerConfigClassID}", LogLevels.Debug); - return false; - } - - tblMain = fragment.FragmentTable; - LogEntry($"Config provider object ID: {objectId}", LogLevels.Debug); - - classID = SPSDataEngineSchemaReader.ClassGetIDFromName(constFragmentNameConfigProviderBase); - LogEntry($"Config provider base class ID: {classID}", LogLevels.Debug); - - Guid[] ids = { objectId }; - tblBase = FragmentRequestBase.SimpleLoad(classID, - "Account, Password", - AsqlHelper.BuildInCondition("[Expression-ObjectID]", ids)); - if (tblBase?.Rows == null || tblBase.Rows.Count <= 0) - { - LogEntry($"Provider config base fragment not found: ClassId={classID}, ObjectId={objectId}", LogLevels.Debug); - return false; - } - - classID = SPSDataEngineSchemaReader.ClassGetIDFromName(constFragmentNameConfigProviderAdditionalAttributes); - LogEntry($"Config provider additional config class ID: {classID}", LogLevels.Debug); - tblAdditionalAttr = FragmentRequestBase.SimpleLoad(classID, - "Name, Value", - AsqlHelper.BuildInCondition("[Expression-ObjectID]", ids)); - if (tblAdditionalAttr == null) - { - LogEntry($"Provider additional config class fragment not found: ClassId={classID}, ObjectId={objectId}", LogLevels.Debug); - return false; - } - - classID = SPSDataEngineSchemaReader.ClassGetIDFromName(constFragmentNameCustomTagBase); - LogEntry($"Custom Tag class ID: {classID}", LogLevels.Debug); - tblCustomTags = FragmentRequestBase.SimpleLoad(classID, "Key, Name", $"[Expression-ObjectID]='{objectId}'") ?? new DataTable(); - - classID = SPSDataEngineSchemaReader.ClassGetIDFromName(constFragmentNameConfigNamingConvention); - LogEntry($"Naming convention config class ID: {classID}", LogLevels.Debug); - tblNamingConvention = FragmentRequestBase.SimpleLoad(classID, - "ID, Usage, NamingConvention.Description as Description, NamingConvention.DescriptionTemplate as DescriptionTemplate, " + - "NamingConvention.Name as Name, NamingConvention.NamingTemplate as NamingTemplate, NamingConvention.Wildcard as Wildcard", - $"[Expression-ObjectID]='{objectId}'") ?? new DataTable(); - - return true; - } - catch (Exception e) - { - LogException(e); - return false; - } - } - - private cLiamProviderData buildProviderData(DataTable dtMain, DataTable dtBase, DataTable dtAdditional, DataTable dtNamingConvention, DataTable dtCustomTag, bool includeSecret, out string sanitizedJson) - { - sanitizedJson = null; - if (dtMain?.Rows == null || dtMain.Rows.Count <= 0) - return null; - if (dtBase?.Rows == null || dtBase.Rows.Count <= 0) - return null; - if (dtAdditional == null) - return null; - - var dataMain = dtMain.Rows[0]; - var dataBase = dtBase.Rows[0]; - - var encPW = cLIAMHelper.getStringFromObject(dataBase["Password"]); - if (!CryptoManager.Instance.TryDecryptDBText(encPW, out string password)) - password = encPW; - - var providerData = new cLiamProviderData() - { - Domain = cLIAMHelper.getStringFromObject(dataMain["GCCDomain"]), - Credential = new cLiamCredential() - { - Domain = cLIAMHelper.getStringFromObject(dataMain["GCCDomain"]), - Identification = cLIAMHelper.getStringFromObject(dataBase["Account"]), - Secret = "***" - }, - RootPath = cLIAMHelper.getStringFromObject(dataMain["GCCTarget"]), - MaxDepth = cLIAMHelper.getIntFromObject(dataMain["GCCMaxDepth"]), - GroupFilter = cLIAMHelper.getStringFromObject(dataMain["GCCgroupLDAPFilter"]), - GroupPath = cLIAMHelper.getStringFromObject(dataMain["GCCgroupOUPath"]), - GroupStrategy = (eLiamGroupStrategies)cLIAMHelper.getIntFromObject(dataMain["GCCPermissionGroupStrategy"]), - ProviderType = (eLiamProviderTypes)cLIAMHelper.getIntFromObject(dataMain["GCCtargetType"]) - }; - - if (dtAdditional?.Rows != null) - { - foreach (DataRow row in dtAdditional.Rows) - { - var name = cLIAMHelper.getStringFromObject(row["Name"]); - var value = cLIAMHelper.getStringFromObject(row["Value"]); - if (!string.IsNullOrEmpty(name)) - providerData.AdditionalConfiguration[name] = value; - } - } - - if (dtCustomTag?.Rows != null) - { - foreach (DataRow row in dtCustomTag.Rows) - { - var name = cLIAMHelper.getStringFromObject(row["Key"]); - var value = cLIAMHelper.getStringFromObject(row["Name"]); - if (!string.IsNullOrEmpty(name)) - providerData.CustomTags[name] = value; - } - } - - if (dtNamingConvention?.Rows != null) - { - foreach (DataRow row in dtNamingConvention.Rows) - { - var usage = cLIAMHelper.getIntFromObject(row["Usage"]); - var accessRole = eLiamAccessRoles.Read; - var scope = eLiamAccessRoleScopes.Unknown; - switch (usage) - { - case -10: - accessRole = eLiamAccessRoles.Traverse; - scope = eLiamAccessRoleScopes.Global; - break; - case 10: - accessRole = eLiamAccessRoles.Read; - scope = eLiamAccessRoleScopes.Global; - break; - case 20: - accessRole = eLiamAccessRoles.Write; - scope = eLiamAccessRoleScopes.Global; - break; - case 30: - accessRole = eLiamAccessRoles.Owner; - scope = eLiamAccessRoleScopes.Global; - break; - case 40: - accessRole = eLiamAccessRoles.Read; - scope = eLiamAccessRoleScopes.DomainLocal; - break; - case 50: - accessRole = eLiamAccessRoles.Write; - scope = eLiamAccessRoleScopes.DomainLocal; - break; - case 60: - accessRole = eLiamAccessRoles.Owner; - scope = eLiamAccessRoleScopes.DomainLocal; - break; - case 100: - accessRole = eLiamAccessRoles.ADOwner; - scope = eLiamAccessRoleScopes.Global; - break; - case 110: - accessRole = eLiamAccessRoles.ADMember; - scope = eLiamAccessRoleScopes.Global; - break; - case 200: - accessRole = eLiamAccessRoles.ExchangeMLMember; - scope = eLiamAccessRoleScopes.Universal; - break; - case 210: - accessRole = eLiamAccessRoles.ExchangeMLOwner; - scope = eLiamAccessRoleScopes.Universal; - break; - case 250: - accessRole = eLiamAccessRoles.ExchangeSMBFullAccess; - scope = eLiamAccessRoleScopes.Universal; - break; - case 260: - accessRole = eLiamAccessRoles.ExchangeSMBSendAs; - scope = eLiamAccessRoleScopes.Universal; - break; - case 270: - accessRole = eLiamAccessRoles.ExchangeSMBOwner; - scope = eLiamAccessRoleScopes.Universal; - break; - } - - providerData.NamingConventions.Add(new cLiamNamingConvention() - { - AccessRole = accessRole, - Scope = scope, - Description = cLIAMHelper.getStringFromObject(row["Description"]), - DescriptionTemplate = cLIAMHelper.getStringFromObject(row["DescriptionTemplate"]), - Name = cLIAMHelper.getStringFromObject(row["Name"]), - NamingTemplate = cLIAMHelper.getStringFromObject(row["NamingTemplate"]), - Wildcard = cLIAMHelper.getStringFromObject(row["Wildcard"]) - }); - } - } - - sanitizedJson = JsonConvert.SerializeObject(providerData, Newtonsoft.Json.Formatting.Indented); - - if (includeSecret && providerData.Credential != null) - providerData.Credential.Secret = password; - - return providerData; - } - - private cLiamProviderBase createProvider(DataTable dtMain, DataTable dtBase, DataTable dtAdditional, DataTable dtNamingConvention = null, DataTable dtCustomTag = null) + private bool TryLoadProviderFragments(Guid providerConfigClassID, out Guid objectId, out DataTable tblMain, out DataTable tblBase, out DataTable tblAdditionalAttr, out DataTable tblNamingConvention, out DataTable tblCustomTags) + { + objectId = Guid.Empty; + tblMain = null; + tblBase = null; + tblAdditionalAttr = null; + tblNamingConvention = null; + tblCustomTags = null; + + try + { + var classID = SPSDataEngineSchemaReader.ClassGetIDFromName(constFragmentNameConfigProviderMain); + LogEntry($"Config provider class ID: {classID}", LogLevels.Debug); + var fragment = FragmentRequest.GetSPSFragment(classID, providerConfigClassID); + if (fragment == null) + { + LogEntry($"Provider config fragment not found: ClassID={classID}, FragmentId={providerConfigClassID}", LogLevels.Debug); + return false; + } + + objectId = fragment.ObjectID; + if (objectId == Guid.Empty) + { + LogEntry($"Provider config fragment not found: ClassID={classID}, FragmentId={providerConfigClassID}", LogLevels.Debug); + return false; + } + + tblMain = fragment.FragmentTable; + LogEntry($"Config provider object ID: {objectId}", LogLevels.Debug); + + classID = SPSDataEngineSchemaReader.ClassGetIDFromName(constFragmentNameConfigProviderBase); + LogEntry($"Config provider base class ID: {classID}", LogLevels.Debug); + + Guid[] ids = { objectId }; + tblBase = FragmentRequestBase.SimpleLoad(classID, + "Account, Password", + AsqlHelper.BuildInCondition("[Expression-ObjectID]", ids)); + if (tblBase?.Rows == null || tblBase.Rows.Count <= 0) + { + LogEntry($"Provider config base fragment not found: ClassId={classID}, ObjectId={objectId}", LogLevels.Debug); + return false; + } + + classID = SPSDataEngineSchemaReader.ClassGetIDFromName(constFragmentNameConfigProviderAdditionalAttributes); + LogEntry($"Config provider additional config class ID: {classID}", LogLevels.Debug); + tblAdditionalAttr = FragmentRequestBase.SimpleLoad(classID, + "Name, Value", + AsqlHelper.BuildInCondition("[Expression-ObjectID]", ids)); + if (tblAdditionalAttr == null) + { + LogEntry($"Provider additional config class fragment not found: ClassId={classID}, ObjectId={objectId}", LogLevels.Debug); + return false; + } + + classID = SPSDataEngineSchemaReader.ClassGetIDFromName(constFragmentNameCustomTagBase); + LogEntry($"Custom Tag class ID: {classID}", LogLevels.Debug); + tblCustomTags = FragmentRequestBase.SimpleLoad(classID, "Key, Name", $"[Expression-ObjectID]='{objectId}'") ?? new DataTable(); + + classID = SPSDataEngineSchemaReader.ClassGetIDFromName(constFragmentNameConfigNamingConvention); + LogEntry($"Naming convention config class ID: {classID}", LogLevels.Debug); + tblNamingConvention = FragmentRequestBase.SimpleLoad(classID, + "ID, Usage, NamingConvention.Description as Description, NamingConvention.DescriptionTemplate as DescriptionTemplate, " + + "NamingConvention.Name as Name, NamingConvention.NamingTemplate as NamingTemplate, NamingConvention.Wildcard as Wildcard", + $"[Expression-ObjectID]='{objectId}'") ?? new DataTable(); + + return true; + } + catch (Exception e) + { + LogException(e); + return false; + } + } + + private cLiamProviderData buildProviderData(DataTable dtMain, DataTable dtBase, DataTable dtAdditional, DataTable dtNamingConvention, DataTable dtCustomTag, bool includeSecret, out string sanitizedJson) + { + sanitizedJson = null; + if (dtMain?.Rows == null || dtMain.Rows.Count <= 0) + return null; + if (dtBase?.Rows == null || dtBase.Rows.Count <= 0) + return null; + if (dtAdditional == null) + return null; + + var dataMain = dtMain.Rows[0]; + var dataBase = dtBase.Rows[0]; + + var encPW = cLIAMHelper.getStringFromObject(dataBase["Password"]); + if (!CryptoManager.Instance.TryDecryptDBText(encPW, out string password)) + password = encPW; + + var providerData = new cLiamProviderData() + { + Domain = cLIAMHelper.getStringFromObject(dataMain["GCCDomain"]), + Credential = new cLiamCredential() + { + Domain = cLIAMHelper.getStringFromObject(dataMain["GCCDomain"]), + Identification = cLIAMHelper.getStringFromObject(dataBase["Account"]), + Secret = "***" + }, + RootPath = cLIAMHelper.getStringFromObject(dataMain["GCCTarget"]), + MaxDepth = cLIAMHelper.getIntFromObject(dataMain["GCCMaxDepth"]), + GroupFilter = cLIAMHelper.getStringFromObject(dataMain["GCCgroupLDAPFilter"]), + GroupPath = cLIAMHelper.getStringFromObject(dataMain["GCCgroupOUPath"]), + GroupStrategy = (eLiamGroupStrategies)cLIAMHelper.getIntFromObject(dataMain["GCCPermissionGroupStrategy"]), + ProviderType = (eLiamProviderTypes)cLIAMHelper.getIntFromObject(dataMain["GCCtargetType"]) + }; + + if (dtAdditional?.Rows != null) + { + foreach (DataRow row in dtAdditional.Rows) + { + var name = cLIAMHelper.getStringFromObject(row["Name"]); + var value = cLIAMHelper.getStringFromObject(row["Value"]); + if (!string.IsNullOrEmpty(name)) + providerData.AdditionalConfiguration[name] = value; + } + } + + if (dtCustomTag?.Rows != null) + { + foreach (DataRow row in dtCustomTag.Rows) + { + var name = cLIAMHelper.getStringFromObject(row["Key"]); + var value = cLIAMHelper.getStringFromObject(row["Name"]); + if (!string.IsNullOrEmpty(name)) + providerData.CustomTags[name] = value; + } + } + + if (dtNamingConvention?.Rows != null) + { + foreach (DataRow row in dtNamingConvention.Rows) + { + var usage = cLIAMHelper.getIntFromObject(row["Usage"]); + var accessRole = eLiamAccessRoles.Read; + var scope = eLiamAccessRoleScopes.Unknown; + switch (usage) + { + case -10: + accessRole = eLiamAccessRoles.Traverse; + scope = eLiamAccessRoleScopes.Global; + break; + case 10: + accessRole = eLiamAccessRoles.Read; + scope = eLiamAccessRoleScopes.Global; + break; + case 20: + accessRole = eLiamAccessRoles.Write; + scope = eLiamAccessRoleScopes.Global; + break; + case 30: + accessRole = eLiamAccessRoles.Owner; + scope = eLiamAccessRoleScopes.Global; + break; + case 40: + accessRole = eLiamAccessRoles.Read; + scope = eLiamAccessRoleScopes.DomainLocal; + break; + case 50: + accessRole = eLiamAccessRoles.Write; + scope = eLiamAccessRoleScopes.DomainLocal; + break; + case 60: + accessRole = eLiamAccessRoles.Owner; + scope = eLiamAccessRoleScopes.DomainLocal; + break; + case 100: + accessRole = eLiamAccessRoles.ADOwner; + scope = eLiamAccessRoleScopes.Global; + break; + case 110: + accessRole = eLiamAccessRoles.ADMember; + scope = eLiamAccessRoleScopes.Global; + break; + case 200: + accessRole = eLiamAccessRoles.ExchangeMLMember; + scope = eLiamAccessRoleScopes.Universal; + break; + case 210: + accessRole = eLiamAccessRoles.ExchangeMLOwner; + scope = eLiamAccessRoleScopes.Universal; + break; + case 250: + accessRole = eLiamAccessRoles.ExchangeSMBFullAccess; + scope = eLiamAccessRoleScopes.Universal; + break; + case 260: + accessRole = eLiamAccessRoles.ExchangeSMBSendAs; + scope = eLiamAccessRoleScopes.Universal; + break; + case 270: + accessRole = eLiamAccessRoles.ExchangeSMBOwner; + scope = eLiamAccessRoleScopes.Universal; + break; + } + + providerData.NamingConventions.Add(new cLiamNamingConvention() + { + AccessRole = accessRole, + Scope = scope, + Description = cLIAMHelper.getStringFromObject(row["Description"]), + DescriptionTemplate = cLIAMHelper.getStringFromObject(row["DescriptionTemplate"]), + Name = cLIAMHelper.getStringFromObject(row["Name"]), + NamingTemplate = cLIAMHelper.getStringFromObject(row["NamingTemplate"]), + Wildcard = cLIAMHelper.getStringFromObject(row["Wildcard"]) + }); + } + } + + sanitizedJson = JsonConvert.SerializeObject(providerData, Newtonsoft.Json.Formatting.Indented); + + if (includeSecret && providerData.Credential != null) + providerData.Credential.Secret = password; + + return providerData; + } + + private cLiamProviderBase createProvider(DataTable dtMain, DataTable dtBase, DataTable dtAdditional, DataTable dtNamingConvention = null, DataTable dtCustomTag = null) { var CM = MethodBase.GetCurrentMethod(); LogMethodBegin(CM); try { - var DataProviderData = buildProviderData(dtMain, dtBase, dtAdditional, dtNamingConvention, dtCustomTag, includeSecret: true, out var sanitizedJson); - if (DataProviderData == null) - return null; - - LogEntry("Provider configuration (sanitized JSON, copy for diagnostics tool):", LogLevels.Info); - LogEntry(sanitizedJson, LogLevels.Info); - - var DataProvider = CreateProviderInstance(new cLiamConfiguration(), DataProviderData); + var DataProviderData = buildProviderData(dtMain, dtBase, dtAdditional, dtNamingConvention, dtCustomTag, includeSecret: true, out var sanitizedJson); + if (DataProviderData == null) + return null; + + LogEntry("Provider configuration (sanitized JSON, copy for diagnostics tool):", LogLevels.Info); + LogEntry(sanitizedJson, LogLevels.Info); + + var DataProvider = CreateProviderInstance(new cLiamConfiguration(), DataProviderData); return DataProvider; } @@ -804,11 +804,11 @@ where "; } [Route("initializeDataProvider"), HttpGet] - public async Task initializeDataProvider(Guid ProviderConfigClassID, bool force = false) - { - var CM = MethodBase.GetCurrentMethod(); - LogMethodBegin(CM); - try + public async Task initializeDataProvider(Guid ProviderConfigClassID, bool force = false) + { + var CM = MethodBase.GetCurrentMethod(); + LogMethodBegin(CM); + try { if (cC4ITLicenseM42ESM.Instance == null) LoadLicensingInformation(); @@ -829,61 +829,61 @@ where "; finally { LogMethodEnd(CM); - } - } - - [Route("exportProviderConfiguration"), HttpGet] - public IHttpActionResult exportProviderConfiguration(Guid ProviderConfigClassID) - { - var CM = MethodBase.GetCurrentMethod(); - LogMethodBegin(CM); - try - { - if (cC4ITLicenseM42ESM.Instance == null) - LoadLicensingInformation(); - - if (!cC4ITLicenseM42ESM.Instance.IsValid) - { - LogEntry($"Error: License not valid", LogLevels.Error); - return Content(HttpStatusCode.Forbidden, "License not valid"); - } - - if (!TryLoadProviderFragments(ProviderConfigClassID, out var objectId, out var tblMain, out var tblBase, out var tblAdditionalAttr, out var tblNamingConvention, out var tblCustomTags)) - { - return Content(HttpStatusCode.NotFound, $"Provider configuration '{ProviderConfigClassID}' not found."); - } - - var providerData = buildProviderData(tblMain, tblBase, tblAdditionalAttr, tblNamingConvention, tblCustomTags, includeSecret: false, out var sanitizedJson); - if (providerData == null) - return Content(HttpStatusCode.InternalServerError, "Provider configuration could not be loaded."); - - var export = new ProviderConfigurationExport - { - ProviderConfigClassID = ProviderConfigClassID, - ProviderConfigObjectID = objectId, - SanitizedJson = sanitizedJson, - Configuration = providerData, - GeneratedAtUtc = DateTime.UtcNow - }; - - return Ok(export); - } - catch (Exception E) - { - LogException(E); - return InternalServerError(E); - } - finally - { - LogMethodEnd(CM); - } - } - - private async Task getDataProvider(Guid ProviderConfigClassID, bool force = false) - { - var CM = MethodBase.GetCurrentMethod(); - LogMethodBegin(CM); - try + } + } + + [Route("exportProviderConfiguration"), HttpGet] + public IHttpActionResult exportProviderConfiguration(Guid ProviderConfigClassID) + { + var CM = MethodBase.GetCurrentMethod(); + LogMethodBegin(CM); + try + { + if (cC4ITLicenseM42ESM.Instance == null) + LoadLicensingInformation(); + + if (!cC4ITLicenseM42ESM.Instance.IsValid) + { + LogEntry($"Error: License not valid", LogLevels.Error); + return Content(HttpStatusCode.Forbidden, "License not valid"); + } + + if (!TryLoadProviderFragments(ProviderConfigClassID, out var objectId, out var tblMain, out var tblBase, out var tblAdditionalAttr, out var tblNamingConvention, out var tblCustomTags)) + { + return Content(HttpStatusCode.NotFound, $"Provider configuration '{ProviderConfigClassID}' not found."); + } + + var providerData = buildProviderData(tblMain, tblBase, tblAdditionalAttr, tblNamingConvention, tblCustomTags, includeSecret: false, out var sanitizedJson); + if (providerData == null) + return Content(HttpStatusCode.InternalServerError, "Provider configuration could not be loaded."); + + var export = new ProviderConfigurationExport + { + ProviderConfigClassID = ProviderConfigClassID, + ProviderConfigObjectID = objectId, + SanitizedJson = sanitizedJson, + Configuration = providerData, + GeneratedAtUtc = DateTime.UtcNow + }; + + return Ok(export); + } + catch (Exception E) + { + LogException(E); + return InternalServerError(E); + } + finally + { + LogMethodEnd(CM); + } + } + + private async Task getDataProvider(Guid ProviderConfigClassID, bool force = false) + { + var CM = MethodBase.GetCurrentMethod(); + LogMethodBegin(CM); + try { if (!force) { @@ -894,17 +894,17 @@ where "; return Provider; } } - if (!TryLoadProviderFragments(ProviderConfigClassID, out var ObjectID, out var tblMain, out var tblBase, out var tblAdditionalAttr, out var tblNamingConvention, out var tblCustomTags)) - return null; - - var DataProvider = createProvider(tblMain, tblBase, tblAdditionalAttr, tblNamingConvention, tblCustomTags); - if (DataProvider == null) - { - LogEntry($"Provider configuration '{ProviderConfigClassID}' could not be materialized.", LogLevels.Warning); - return null; - } - - var validLogon = await DataProvider.LogonAsync(); + if (!TryLoadProviderFragments(ProviderConfigClassID, out var ObjectID, out var tblMain, out var tblBase, out var tblAdditionalAttr, out var tblNamingConvention, out var tblCustomTags)) + return null; + + var DataProvider = createProvider(tblMain, tblBase, tblAdditionalAttr, tblNamingConvention, tblCustomTags); + if (DataProvider == null) + { + LogEntry($"Provider configuration '{ProviderConfigClassID}' could not be materialized.", LogLevels.Warning); + return null; + } + + var validLogon = await DataProvider.LogonAsync(); if (!validLogon) return null; @@ -1178,6 +1178,7 @@ where "; Level = DataArea.Level.ToString(), ConfigurationId = ProviderEntry.ObjectID.ToString(), DataAreaType = DataArea.DataType.ToString(), + DataAreaTypeId = (int)DataArea.DataType, Owner = owner, Write = write, Read = DataAreaNtfsFolder?.ReadGroupIdentifier ?? string.Empty, @@ -1857,34 +1858,34 @@ where "; return accountEoid; } - private string GetUserPrincipalNameFromEOID(Guid accountEoid) - { - var ClassID = SPSDataEngineSchemaReader.ClassGetIDFromName(constFragmentNameAccountAd); - LogEntry($"Data area class ID: {ClassID}", LogLevels.Debug); - var tbl = FragmentRequestBase.SimpleLoad(ClassID, "UserPrincipalName", $"[Expression-ObjectId]='{accountEoid}'"); - if (tbl?.Rows == null || tbl.Rows.Count == 0) - { - LogEntry($"No AD account entry list found with eoid='{accountEoid}'", LogLevels.Warning); - return null; - } - - var UPN = cLIAMHelper.getStringFromObject(tbl.Rows[0]["UserPrincipalName"]); - if (string.IsNullOrEmpty(UPN)) - { - LogEntry("No UserPrincipalName found for AccountAd entry", LogLevels.Warning); - return null; - } - return UPN; - } - - public class ProviderConfigurationExport - { - public Guid ProviderConfigClassID { get; set; } - public Guid ProviderConfigObjectID { get; set; } - public string SanitizedJson { get; set; } - public cLiamProviderData Configuration { get; set; } - public DateTime GeneratedAtUtc { get; set; } - } - } -} + private string GetUserPrincipalNameFromEOID(Guid accountEoid) + { + var ClassID = SPSDataEngineSchemaReader.ClassGetIDFromName(constFragmentNameAccountAd); + LogEntry($"Data area class ID: {ClassID}", LogLevels.Debug); + var tbl = FragmentRequestBase.SimpleLoad(ClassID, "UserPrincipalName", $"[Expression-ObjectId]='{accountEoid}'"); + if (tbl?.Rows == null || tbl.Rows.Count == 0) + { + LogEntry($"No AD account entry list found with eoid='{accountEoid}'", LogLevels.Warning); + return null; + } + + var UPN = cLIAMHelper.getStringFromObject(tbl.Rows[0]["UserPrincipalName"]); + if (string.IsNullOrEmpty(UPN)) + { + LogEntry("No UserPrincipalName found for AccountAd entry", LogLevels.Warning); + return null; + } + return UPN; + } + + public class ProviderConfigurationExport + { + public Guid ProviderConfigClassID { get; set; } + public Guid ProviderConfigObjectID { get; set; } + public string SanitizedJson { get; set; } + public cLiamProviderData Configuration { get; set; } + public DateTime GeneratedAtUtc { get; set; } + } + } +} diff --git a/LiamWorkflowActivities/LiamWorkflowRuntime.cs b/LiamWorkflowActivities/LiamWorkflowRuntime.cs index 75261f2..3d05cf1 100644 --- a/LiamWorkflowActivities/LiamWorkflowRuntime.cs +++ b/LiamWorkflowActivities/LiamWorkflowRuntime.cs @@ -669,7 +669,8 @@ namespace LiamWorkflowActivities ConfigurationId = configurationId ?? string.Empty, BaseFolder = ntfsFolder?.Share?.TechnicalName ?? dataArea.Provider?.RootPath ?? string.Empty, UniqueId = dataArea.UID ?? string.Empty, - DataAreaType = dataArea.DataType.ToString() + DataAreaType = dataArea.DataType.ToString(), + DataAreaTypeId = (int)dataArea.DataType }; }