public frmUserSettingsParameters() { InitializeComponent(); this._model = null; this._layoutSettingsProvider = new LayoutSettingsProvider<frmUserSettingsParametersLayout>(this); }
public CreateItemByIdParameters(ISessionConfig sessionSettings, IItemSource itemSource, IQueryParameters queryParameters, CreateItemParameters createParameters, string itemId) { this.SessionSettings = sessionSettings; this.ItemSource = itemSource; this.ItemId = itemId; this.QueryParameters = queryParameters; this.CreateParameters = createParameters; }
public UpdateItemByPathParameters(ISessionConfig sessionSettings, IItemSource itemSource, IQueryParameters queryParameters, IDictionary<string, string> fieldsRawValuesByName, string itemPath) { this.SessionSettings = sessionSettings; this.ItemSource = itemSource; this.ItemPath = itemPath; this.QueryParameters = queryParameters; this.FieldsRawValuesByName = fieldsRawValuesByName; }
public ReadItemsByIdParameters( ISessionConfig sessionSettings, IItemSource itemSource, IQueryParameters queryParameters, IPagingParameters pagingSettings, string itemId) { this.SessionSettings = sessionSettings; this.ItemSource = itemSource; this.ItemId = itemId; this.QueryParameters = queryParameters; this.PagingSettings = pagingSettings; }
public ReadItemByQueryParameters( ISessionConfig sessionSettings, IItemSource itemSource, IQueryParameters queryParameters, IPagingParameters pagingSettings, string sitecoreQuery) { this.SessionSettings = sessionSettings; this.ItemSource = itemSource; this.SitecoreQuery = sitecoreQuery; this.QueryParameters = queryParameters; this.PagingSettings = pagingSettings; }
internal frmUserSettingsParameters(IQueryParameters model) : this() { dgvParameters.AutoGenerateColumns = false; this._model = model; iQueryParametersBindingSource.DataSource = this._model; if (this._model != null) { this.Text = String.Format("{0} : '{1}'", GetLocalizedText("captionText") ,this._model.Name != null ? this._model.Name : "?" ); } else { this.Text = String.Format("{0}", GetLocalizedText("captionText") ); } }
public override Task<Resource[]> Query(IQueryParameters parameters, string correlationIdentifier) { Resource[] resources = new Resource[] { this.Resource }; Task<Resource[]> result = Task.FromResult<Resource[]>(resources); return result; }
private async Task<Resource[]> QueryReference( IQueryParameters parameters, string correlationIdentifier) { if (null == parameters) { throw new ArgumentNullException(AmazonWebServicesProvider.ArgumentNameParameters); } if (string.IsNullOrWhiteSpace(correlationIdentifier)) { throw new ArgumentNullException(AmazonWebServicesProvider.ArgumentNameCorrelationIdentifier); } if (null == parameters.RequestedAttributePaths || !parameters.RequestedAttributePaths.Any()) { throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery); } string selectedAttribute = parameters.RequestedAttributePaths.SingleOrDefault(); if (string.IsNullOrWhiteSpace(selectedAttribute)) { throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery); } ProvisioningAgentMonitor.Instance.Inform(selectedAttribute, true, correlationIdentifier); if ( !string.Equals( selectedAttribute, Microsoft.SystemForCrossDomainIdentityManagement.AttributeNames.Identifier, StringComparison.OrdinalIgnoreCase) ) { throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery); } if (null == parameters.AlternateFilters) { throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters); } if (string.IsNullOrWhiteSpace(parameters.SchemaIdentifier)) { throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters); } string informationAlternateFilterCount = parameters.AlternateFilters.Count.ToString(CultureInfo.InvariantCulture); ProvisioningAgentMonitor.Instance.Inform(informationAlternateFilterCount, true, correlationIdentifier); if (parameters.AlternateFilters.Count != 1) { string exceptionMessage = string.Format( CultureInfo.InvariantCulture, ProvisioningAgentResources.ExceptionFilterCountTemplate, 1, parameters.AlternateFilters.Count); throw new NotSupportedException(exceptionMessage); } AmazonWebServicesProvider.Validate(parameters); IFilter filterPrimary = parameters.AlternateFilters.Single(); if (null == filterPrimary.AdditionalFilter) { throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters); } IFilter filterAdditional = filterPrimary.AdditionalFilter; if (filterAdditional.AdditionalFilter != null) { throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery); } IReadOnlyCollection<IFilter> filters = new IFilter[] { filterPrimary, filterAdditional }; IFilter filterIdentifier = filters .SingleOrDefault( (IFilter item) => string.Equals( AttributeNames.Identifier, item.AttributePath, StringComparison.OrdinalIgnoreCase)); if (null == filterIdentifier) { throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery); } IFilter filterReference = filters .SingleOrDefault( (IFilter item) => string.Equals( AttributeNames.Members, item.AttributePath, StringComparison.OrdinalIgnoreCase)); if (null == filterReference) { return new Resource[0]; } IAmazonIdentityManagementService proxy = null; try { proxy = AWSClientFactory.CreateAmazonIdentityManagementServiceClient(this.credentials); Amazon.IdentityManagement.Model.User member = await this.RetrieveUser(filterReference.ComparisonValue, proxy); if (member != null) { return new Resource[0]; } ListGroupsForUserRequest request = new ListGroupsForUserRequest() { MaxItems = AmazonWebServicesProvider.SizeListPage, UserName = member.UserName }; while (true) { ListGroupsForUserResponse response = await proxy.ListGroupsForUserAsync(request); if (null == response.Groups || !response.Groups.Any()) { return null; } Group group = response .Groups .SingleOrDefault( (Group item) => string.Equals(item.GroupName, filterReference.ComparisonValue, StringComparison.OrdinalIgnoreCase)); if (group != null) { WindowsAzureActiveDirectoryGroup groupResource = new WindowsAzureActiveDirectoryGroup() { Identifier = group.GroupId, ExternalIdentifier = group.GroupName }; Resource[] results = new Resource[] { groupResource }; return results; } if (string.IsNullOrWhiteSpace(response.Marker)) { return null; } if (string.Equals(request.Marker, response.Marker, StringComparison.OrdinalIgnoreCase)) { return null; } request.Marker = response.Marker; } } finally { if (proxy != null) { proxy.Dispose(); proxy = null; } } }
public override async Task<Resource[]> Query( IQueryParameters parameters, string correlationIdentifier) { if (null == parameters) { throw new ArgumentNullException(AmazonWebServicesProvider.ArgumentNameParameters); } if (string.IsNullOrWhiteSpace(correlationIdentifier)) { throw new ArgumentNullException(AmazonWebServicesProvider.ArgumentNameCorrelationIdentifier); } if (null == parameters.AlternateFilters) { throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters); } if (string.IsNullOrWhiteSpace(parameters.SchemaIdentifier)) { throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters); } string informationAlternateFilterCount = parameters.AlternateFilters.Count.ToString(CultureInfo.InvariantCulture); ProvisioningAgentMonitor.Instance.Inform(informationAlternateFilterCount, true, correlationIdentifier); if (parameters.AlternateFilters.Count != 1) { string exceptionMessage = string.Format( CultureInfo.InvariantCulture, ProvisioningAgentResources.ExceptionFilterCountTemplate, 1, parameters.AlternateFilters.Count); throw new NotSupportedException(exceptionMessage); } Resource[] results; IFilter queryFilter = parameters.AlternateFilters.Single(); if (queryFilter.AdditionalFilter != null) { results = await this.QueryReference(parameters, correlationIdentifier); return results; } AmazonWebServicesProvider.Validate(parameters); if (string.IsNullOrWhiteSpace(queryFilter.AttributePath)) { throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters); } if (string.IsNullOrWhiteSpace(queryFilter.ComparisonValue)) { throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters); } if (!string.Equals(queryFilter.AttributePath, AttributeNames.ExternalIdentifier, StringComparison.Ordinal)) { throw new NotSupportedException(queryFilter.AttributePath); } IAmazonIdentityManagementService proxy = null; try { proxy = AWSClientFactory.CreateAmazonIdentityManagementServiceClient(this.credentials); switch (parameters.SchemaIdentifier) { case SchemaIdentifiers.Core2EnterpriseUser: GetUserRequest getRequestUser = new GetUserRequest() { UserName = queryFilter.ComparisonValue }; GetUserResult responseUser = await proxy.GetUserAsync(getRequestUser); if (null == responseUser.User) { return new Resource[0]; } Core2EnterpriseUser resourceUser = new Core2EnterpriseUser() { Identifier = responseUser.User.UserId, ExternalIdentifier = responseUser.User.UserName }; Resource[] resourceUsers = new Resource[] { resourceUser }; return resourceUsers; case SchemaIdentifiers.WindowsAzureActiveDirectoryGroup: GetGroupRequest getRequestGroup = new GetGroupRequest() { GroupName = queryFilter.ComparisonValue }; GetGroupResult responseGroup = await proxy.GetGroupAsync(getRequestGroup); if (null == responseGroup.Group) { return new Resource[0]; } WindowsAzureActiveDirectoryGroup resourceGroup = new WindowsAzureActiveDirectoryGroup() { Identifier = responseGroup.Group.GroupId, ExternalIdentifier = responseGroup.Group.GroupName }; Resource[] resourceGroups = new Resource[] { resourceGroup }; return resourceGroups; default: throw new NotSupportedException(parameters.SchemaIdentifier); } } finally { if (proxy != null) { proxy.Dispose(); proxy = null; } } }
internal QueryViewRequest(IQueryParameters queryParameters) { Ensure.That(queryParameters, "queryParameters").IsNotNull(); State = queryParameters; }
private async Task<Resource[]> QueryReference(IQueryParameters parameters, string correlationIdentifier) { if (null == parameters) { throw new ArgumentNullException(FileProvider.ArgumentNameParameters); } if (string.IsNullOrWhiteSpace(correlationIdentifier)) { throw new ArgumentNullException(FileProvider.ArgumentNameCorrelationIdentifier); } if (null == parameters.RequestedAttributePaths || !parameters.RequestedAttributePaths.Any()) { throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery); } string selectedAttribute = parameters.RequestedAttributePaths.SingleOrDefault(); if (string.IsNullOrWhiteSpace(selectedAttribute)) { throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery); } ProvisioningAgentMonitor.Instance.Inform(selectedAttribute, true, correlationIdentifier); if ( !string.Equals( selectedAttribute, Microsoft.SystemForCrossDomainIdentityManagement.AttributeNames.Identifier, StringComparison.OrdinalIgnoreCase) ) { throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery); } if (null == parameters.AlternateFilters) { throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters); } if (string.IsNullOrWhiteSpace(parameters.SchemaIdentifier)) { throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters); } string informationAlternateFilterCount = parameters.AlternateFilters.Count.ToString(CultureInfo.InvariantCulture); ProvisioningAgentMonitor.Instance.Inform(informationAlternateFilterCount, true, correlationIdentifier); if (parameters.AlternateFilters.Count != 1) { string exceptionMessage = string.Format( CultureInfo.InvariantCulture, ProvisioningAgentResources.ExceptionFilterCountTemplate, 1, parameters.AlternateFilters.Count); throw new NotSupportedException(exceptionMessage); } IReadOnlyCollection<string> requestedColumns = this.IdentifyRequestedColumns(parameters); IFilter filterPrimary = parameters.AlternateFilters.Single(); if (null == filterPrimary.AdditionalFilter) { throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters); } IFilter filterAdditional = filterPrimary.AdditionalFilter; if (filterAdditional.AdditionalFilter != null) { throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery); } IReadOnlyCollection<IFilter> filters = new IFilter[] { filterPrimary, filterAdditional }; IFilter filterIdentifier = filters .SingleOrDefault( (IFilter item) => string.Equals( AttributeNames.Identifier, item.AttributePath, StringComparison.OrdinalIgnoreCase)); if (null == filterIdentifier) { throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery); } IRow row; IFilter filterReference = filters .SingleOrDefault( (IFilter item) => string.Equals( AttributeNames.Members, item.AttributePath, StringComparison.OrdinalIgnoreCase)); if (filterReference != null) { Dictionary<string, string> columns = new Dictionary<string, string>() { { AttributeNames.Schemas, parameters.SchemaIdentifier }, { AttributeNames.Identifier, filterIdentifier.ComparisonValue }, { filterReference.AttributePath, filterReference.ComparisonValue } }; IReadOnlyCollection<IRow> rows = await this.file.Query(columns); if (null == rows || !rows.Any()) { return new Resource[0]; } row = await this.file.ReadRow(filterIdentifier.ComparisonValue); } else { filterReference = filters .SingleOrDefault( (IFilter item) => string.Equals( AttributeNames.Manager, item.AttributePath, StringComparison.OrdinalIgnoreCase)); if (null == filterReference) { throw new NotSupportedException(ProvisioningAgentResources.ExceptionUnsupportedQuery); } row = await this.file.ReadRow(filterIdentifier.ComparisonValue); if ( null == row.Columns || !row .Columns .Any( (KeyValuePair<string, string> columnItem) => string.Equals(columnItem.Key, filterReference.AttributePath, StringComparison.Ordinal) && string.Equals(columnItem.Value, filterReference.ComparisonValue, StringComparison.Ordinal)) ) { return new Resource[0]; } } string rowSchema = null; if ( !row.Columns.TryGetValue(AttributeNames.Schemas, out rowSchema) || !string.Equals(rowSchema, parameters.SchemaIdentifier, StringComparison.Ordinal) ) { return new Resource[0]; } IRow reducedRow = FileProvider.FilterColumns(row, requestedColumns); ResourceFactory resourceFactory; switch (rowSchema) { case SchemaIdentifiers.Core2EnterpriseUser: resourceFactory = new UserFactory(reducedRow); break; case SchemaIdentifiers.WindowsAzureActiveDirectoryGroup: resourceFactory = new GroupFactory(reducedRow); break; default: throw new NotSupportedException(parameters.SchemaIdentifier); } Resource resource = resourceFactory.CreateResource(); Resource[] results = new Resource[] { resource }; return results; }
public override async Task<Resource[]> Query(IQueryParameters parameters, string correlationIdentifier) { if (null == parameters) { throw new ArgumentNullException(FileProvider.ArgumentNameParameters); } if (string.IsNullOrWhiteSpace(correlationIdentifier)) { throw new ArgumentNullException(FileProvider.ArgumentNameCorrelationIdentifier); } if (null == parameters.AlternateFilters) { throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters); } if (string.IsNullOrWhiteSpace(parameters.SchemaIdentifier)) { throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters); } string informationAlternateFilterCount = parameters.AlternateFilters.Count.ToString(CultureInfo.InvariantCulture); ProvisioningAgentMonitor.Instance.Inform(informationAlternateFilterCount, true, correlationIdentifier); if (parameters.AlternateFilters.Count != 1) { string exceptionMessage = string.Format( CultureInfo.InvariantCulture, ProvisioningAgentResources.ExceptionFilterCountTemplate, 1, parameters.AlternateFilters.Count); throw new NotSupportedException(exceptionMessage); } Resource[] results; IFilter queryFilter = parameters.AlternateFilters.Single(); if (queryFilter.AdditionalFilter != null) { results = await this.QueryReference(parameters, correlationIdentifier); return results; } IReadOnlyCollection<string> requestedColumns = this.IdentifyRequestedColumns(parameters); if (string.IsNullOrWhiteSpace(queryFilter.AttributePath)) { throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters); } if (string.IsNullOrWhiteSpace(queryFilter.ComparisonValue)) { throw new ArgumentException(ProvisioningAgentResources.ExceptionInvalidParameters); } Dictionary<string, string> columns = new Dictionary<string, string>() { { AttributeNames.Schemas, parameters.SchemaIdentifier }, { queryFilter.AttributePath, queryFilter.ComparisonValue } }; IReadOnlyCollection<IRow> rows = await this.file.Query(columns); if (null == rows) { return new Resource[0]; } IList<Resource> resources = new List<Resource>(rows.Count); foreach (IRow row in rows) { string rowSchema = null; if ( !row.Columns.TryGetValue(AttributeNames.Schemas, out rowSchema) || !string.Equals(rowSchema, parameters.SchemaIdentifier, StringComparison.Ordinal) ) { continue; } IRow reducedRow = FileProvider.FilterColumns(row, requestedColumns); ResourceFactory resourceFactory; switch (rowSchema) { case SchemaIdentifiers.Core2EnterpriseUser: resourceFactory = new UserFactory(reducedRow); break; case SchemaIdentifiers.WindowsAzureActiveDirectoryGroup: resourceFactory = new GroupFactory(reducedRow); break; default: throw new NotSupportedException(parameters.SchemaIdentifier); } Resource resource = resourceFactory.CreateResource(); resources.Add(resource); } results = resources.ToArray(); return results; }