update directory name and access visibility
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
using console_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace console_spo_utils.Services;
|
||||
|
||||
internal class NonComplianceBuildService : INonComplianceBuildService
|
||||
{
|
||||
private readonly ISiteOptions siteOptions;
|
||||
private readonly ISharePointAuthenticationManager sharePointAuthenticationManager;
|
||||
private readonly ISharePointCustomOperation spc;
|
||||
private readonly ITenantService tenantService;
|
||||
private readonly INonComplianceDocLibraryService nonComplianceDocLibraryService;
|
||||
private readonly INonComplianceDocSetService nonComplianceDocSetService;
|
||||
private readonly ILogger<NonComplianceBuildService> logger;
|
||||
|
||||
public NonComplianceBuildService(
|
||||
ISiteOptions siteOptions,
|
||||
ISharePointAuthenticationManager sharePointAuthenticationManager,
|
||||
ISharePointCustomOperation spc,
|
||||
ITenantService tenantService,
|
||||
INonComplianceDocLibraryService nonComplianceDocLibraryService,
|
||||
INonComplianceDocSetService nonComplianceDocSetService,
|
||||
ILogger<NonComplianceBuildService> logger)
|
||||
{
|
||||
this.siteOptions = siteOptions;
|
||||
this.sharePointAuthenticationManager = sharePointAuthenticationManager;
|
||||
this.spc = spc;
|
||||
this.tenantService = tenantService;
|
||||
this.nonComplianceDocLibraryService = nonComplianceDocLibraryService;
|
||||
this.nonComplianceDocSetService = nonComplianceDocSetService;
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
public void CreateIfNotExists(string nonComplianceName)
|
||||
{
|
||||
var site = siteOptions.GetNonComplianceSite();
|
||||
var ctx = sharePointAuthenticationManager.GetContext(site);
|
||||
var list = siteOptions.GetNonComplianceLibrary();
|
||||
var tenant = siteOptions.GetNonComplianceTenant();
|
||||
|
||||
if (!spc.SiteExist(ctx))
|
||||
{
|
||||
tenantService.CreateForNonCompliance();
|
||||
}
|
||||
else if (!spc.ListExist(ctx, list))
|
||||
{
|
||||
nonComplianceDocLibraryService.Create(list, ctx);
|
||||
}
|
||||
else if (!spc.FolderExistsInsideList(ctx, list, nonComplianceName))
|
||||
{
|
||||
nonComplianceDocSetService.Create(nonComplianceName, list, tenant, ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogInformation($"Quotation with {nonComplianceName} already exist");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user