/// <summary> /// View swagger definition for this API /// </summary> /// <remarks> /// View swagger definition for this API /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> GetSwaggerAsync(this ITenancyService operations, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetSwaggerWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Gets a tenant /// </summary> /// <remarks> /// Gets the tenant /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='tenantId'> /// The tenant within which the request should operate /// </param> /// <param name='ifNoneMatch'> /// The ETag of the last known version. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> GetTenantAsync(this ITenancyService operations, string tenantId, string ifNoneMatch = default(string), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetTenantWithHttpMessagesAsync(tenantId, ifNoneMatch, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Update a tenant /// </summary> /// <remarks> /// Updates the tenant /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='tenantId'> /// The tenant within which the request should operate /// </param> /// <param name='body'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> UpdateTenantAsync(this ITenancyService operations, string tenantId, IList <UpdateTenantJsonPatchEntry> body, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateTenantWithHttpMessagesAsync(tenantId, body, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public ClaimsBenchmarksBase() { IConfigurationBuilder configurationBuilder = new ConfigurationBuilder() .AddEnvironmentVariables() .AddJsonFile("local.settings.json", optional: true, reloadOnChange: true); IConfiguration configuration = configurationBuilder.Build(); this.ClientTenantId = configuration["ClientTenantId"]; this.AdministratorPrincipalObjectId = configuration["AdministratorPrincipalObjectId"]; ServiceProvider serviceProvider = new ServiceCollection() .AddClaimsClient(sp => configuration.GetSection("ClaimsClient").Get <ClaimsClientOptions>()) .AddSingleton(sp => configuration.GetSection("TenancyClient").Get <TenancyClientOptions>()) .AddTenancyClient(enableResponseCaching: true) .AddJsonNetPropertyBag() .AddBlobContainerV2ToV3Transition() .AddAzureBlobStorageClientSourceFromDynamicConfiguration() .AddServiceIdentityAzureTokenCredentialSourceFromLegacyConnectionString(configuration["AzureServicesAuthConnectionString"]) .AddMicrosoftRestAdapterForServiceIdentityAccessTokenSource() .BuildServiceProvider(); this.ClaimsService = serviceProvider.GetRequiredService <IClaimsService>(); this.TenancyService = serviceProvider.GetRequiredService <ITenancyService>(); this.TenantBlobContainerClientFactory = serviceProvider.GetRequiredService <IBlobContainerSourceWithTenantLegacyTransition>(); this.PropertyBagFactory = serviceProvider.GetRequiredService <IPropertyBagFactory>(); }
/// <summary> /// Adds the root tenant to the collection, using the <see cref="ITenancyService"/>. /// </summary> /// <param name="services">The service collection to which to add the root tenant.</param> /// <returns>The configured service collection.</returns> public static IServiceCollection AddTenantServiceClientRootTenant(this IServiceCollection services) { if (services.Any(s => typeof(RootTenant).IsAssignableFrom(s.ServiceType))) { return(services); } services.AddContent(contentFactory => contentFactory.RegisterTransientContent <Tenant>()); // Construct a root tenant from the tenant retrieved from the service, using the // root tenant ID. services.AddSingleton(s => { ITenancyService tenancyService = s.GetRequiredService <ITenancyService>(); ITenantMapper tenantMapper = s.GetRequiredService <ITenantMapper>(); IPropertyBagFactory propertyBagFactory = s.GetRequiredService <IPropertyBagFactory>(); ITenant fetchedRootTenant = tenantMapper.MapTenant(tenancyService.GetTenant(RootTenant.RootTenantId)); var localRootTenant = new RootTenant(propertyBagFactory); IReadOnlyDictionary <string, object> propertiesToSetOrAdd = fetchedRootTenant.Properties.AsDictionary(); localRootTenant.UpdateProperties(propertiesToSetOrAdd); return(localRootTenant); }); return(services); }
/// <summary> /// Get all child tenants of the current tenant /// </summary> /// <remarks> /// Get all child tenants of the current tenant /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='tenantId'> /// The tenant within which the request should operate /// </param> /// <param name='continuationToken'> /// A continuation token for an operation where more data is available /// </param> /// <param name='maxItems'> /// The maximum number of items to return in the request. Fewer than this /// number may be returned. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> GetChildrenAsync(this ITenancyService operations, string tenantId, string continuationToken = default(string), int?maxItems = default(int?), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetChildrenWithHttpMessagesAsync(tenantId, continuationToken, maxItems, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Create a child tenant /// </summary> /// <remarks> /// Creates a child tenant of the parent tenant /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='tenantId'> /// The tenant within which the request should operate /// </param> /// <param name='tenantName'> /// The name for the new tenant /// </param> /// <param name='wellKnownChildTenantGuid'> /// The well known Guid for the new tenant. If provided, this will be used to /// create the child tenant Id. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <CreateChildTenantHeaders> CreateChildTenantAsync(this ITenancyService operations, string tenantId, string tenantName, System.Guid?wellKnownChildTenantGuid = default(System.Guid?), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.CreateChildTenantWithHttpMessagesAsync(tenantId, tenantName, wellKnownChildTenantGuid, null, cancellationToken).ConfigureAwait(false)) { return(_result.Headers); } }
public HomeController(ILogger <HomeController> logger, IPropertyService propertySvc, ITenancyService tenancySvc, IPersonService personSvc, IActionService actionSvc, UserManager <ApplicationUser> userManager) { _logger = logger; _propertySvc = propertySvc; _tenancySvc = tenancySvc; _personSvc = personSvc; _actionSvc = actionSvc; _userManager = userManager; }
/// <summary> /// Initializes a new instance of the <see cref="ClientTenantProvider"/> class. /// </summary> /// <param name="root">The Root tenant.</param> /// <param name="tenantService">The tenant service.</param> /// <param name="tenantMapper">The tenant mapper to use.</param> /// <param name="jsonSerializerSettingsProvider">The JSON serializer settings provider.</param> public ClientTenantStore( RootTenant root, ITenancyService tenantService, ITenantMapper tenantMapper, IJsonSerializerSettingsProvider jsonSerializerSettingsProvider) : base(root, tenantService, tenantMapper) { this.jsonSerializerSettingsProvider = jsonSerializerSettingsProvider ?? throw new ArgumentNullException(nameof(jsonSerializerSettingsProvider)); }
public TenancyClientSteps( FeatureContext featureContext, ScenarioContext scenarioContext, TestTenantCleanup testTenantCleanup) { this.scenarioContext = scenarioContext; this.testTenantCleanup = testTenantCleanup; this.store = ContainerBindings.GetServiceProvider(featureContext).GetRequiredService <ITenantStore>(); this.client = ContainerBindings.GetServiceProvider(featureContext).GetRequiredService <ITenancyService>(); this.propertyBagFactory = ContainerBindings.GetServiceProvider(featureContext).GetRequiredService <IJsonNetPropertyBagFactory>(); }
public TenanciesController(IConfiguration config, ITenancyService tenancySvc, IPropertyService propertySvc, IActionService actionSvc, IAlertService alertSvc, IRentAccountService rentAccountSvc, UserManager <ApplicationUser> userManager) { _config = config; _tenancySvc = tenancySvc; _propertySvc = propertySvc; _actionSvc = actionSvc; _alertSvc = alertSvc; _userManager = userManager; _rentAccountSvc = rentAccountSvc; //AutoMapper mapping config _mapperConfig = new MapperConfiguration(cfg => { cfg.CreateMap <tenancy, TenancyViewModel>(); cfg.CreateMap <TenancyViewModel, tenancy>(); }); //Create mapper instance _mapper = _mapperConfig.CreateMapper(); }
public PropertiesController(IConfiguration config, IPropertyService propertySvc, ITenancyService tenancySvc, UserManager <ApplicationUser> userManager) { //Get config instance _config = config; //Assign services _propertySvc = propertySvc; _tenancySvc = tenancySvc; _userManager = userManager; //AutoMapper mapping config _mapperConfig = new MapperConfiguration(cfg => { cfg.CreateMap <property, PropertyViewModel>(); cfg.CreateMap <PropertyViewModel, property>(); }); //Create mapper instance _mapper = _mapperConfig.CreateMapper(); }
/// <summary> /// Initializes a new instance of the <see cref="ClientTenantProvider"/> class. /// </summary> /// <param name="root">The Root tenant.</param> /// <param name="tenantService">The tenant service.</param> /// <param name="tenantMapper">The tenant mapper to use.</param> public ClientTenantProvider(RootTenant root, ITenancyService tenantService, ITenantMapper tenantMapper) { this.Root = root ?? throw new ArgumentNullException(nameof(root)); this.TenantService = tenantService ?? throw new ArgumentNullException(nameof(tenantService)); this.TenantMapper = tenantMapper ?? throw new ArgumentNullException(nameof(tenantMapper)); }
/// <summary> /// Gets a tenant /// </summary> /// <remarks> /// Gets the tenant /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='tenantId'> /// The tenant within which the request should operate /// </param> /// <param name='ifNoneMatch'> /// The ETag of the last known version. /// </param> public static object GetTenant(this ITenancyService operations, string tenantId, string ifNoneMatch = default(string)) { return(operations.GetTenantAsync(tenantId, ifNoneMatch).GetAwaiter().GetResult()); }
/// <summary> /// Update a tenant /// </summary> /// <remarks> /// Updates the tenant /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='tenantId'> /// The tenant within which the request should operate /// </param> /// <param name='body'> /// </param> public static object UpdateTenant(this ITenancyService operations, string tenantId, IList <UpdateTenantJsonPatchEntry> body) { return(operations.UpdateTenantAsync(tenantId, body).GetAwaiter().GetResult()); }
public TenancyHouseholdViewComponent(UserManager <ApplicationUser> userManager, ITenancyService tenancySvc) { _userManager = userManager; _tenancySvc = tenancySvc; }
/// <summary> /// View swagger definition for this API /// </summary> /// <remarks> /// View swagger definition for this API /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> public static object GetSwagger(this ITenancyService operations) { return(operations.GetSwaggerAsync().GetAwaiter().GetResult()); }
/// <summary> /// Delete a child tenant by ID /// </summary> /// <remarks> /// Deletes a child tenant of the parent tenant by ID /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='tenantId'> /// The tenant within which the request should operate /// </param> /// <param name='childTenantId'> /// The child tenant within the current tenant. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task DeleteChildTenantAsync(this ITenancyService operations, string tenantId, string childTenantId, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.DeleteChildTenantWithHttpMessagesAsync(tenantId, childTenantId, null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <summary> /// Delete a child tenant by ID /// </summary> /// <remarks> /// Deletes a child tenant of the parent tenant by ID /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='tenantId'> /// The tenant within which the request should operate /// </param> /// <param name='childTenantId'> /// The child tenant within the current tenant. /// </param> public static void DeleteChildTenant(this ITenancyService operations, string tenantId, string childTenantId) { operations.DeleteChildTenantAsync(tenantId, childTenantId).GetAwaiter().GetResult(); }
/// <summary> /// Create a child tenant /// </summary> /// <remarks> /// Creates a child tenant of the parent tenant /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='tenantId'> /// The tenant within which the request should operate /// </param> /// <param name='tenantName'> /// The name for the new tenant /// </param> /// <param name='wellKnownChildTenantGuid'> /// The well known Guid for the new tenant. If provided, this will be used to /// create the child tenant Id. /// </param> public static CreateChildTenantHeaders CreateChildTenant(this ITenancyService operations, string tenantId, string tenantName, System.Guid?wellKnownChildTenantGuid = default(System.Guid?)) { return(operations.CreateChildTenantAsync(tenantId, tenantName, wellKnownChildTenantGuid).GetAwaiter().GetResult()); }
/// <summary> /// Get all child tenants of the current tenant /// </summary> /// <remarks> /// Get all child tenants of the current tenant /// </remarks> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='tenantId'> /// The tenant within which the request should operate /// </param> /// <param name='continuationToken'> /// A continuation token for an operation where more data is available /// </param> /// <param name='maxItems'> /// The maximum number of items to return in the request. Fewer than this /// number may be returned. /// </param> public static object GetChildren(this ITenancyService operations, string tenantId, string continuationToken = default(string), int?maxItems = default(int?)) { return(operations.GetChildrenAsync(tenantId, continuationToken, maxItems).GetAwaiter().GetResult()); }