public SitemapService(IRepository repository, ISitemapTreeService treeService, INodeService nodeService, INodesService nodesService) { this.repository = repository; this.treeService = treeService; this.nodeService = nodeService; this.nodesService = nodesService; }
// Constructor, parameters are provided by service provider public ApiController(IIndexService indexService, INodesService nodesService, IGraphService graphService, ITpsService tpsService) { _indexService = indexService; _nodesService = nodesService; _graphService = graphService; _tpsService = tpsService; }
public DocumentController( IAlfrescoHttpClient alfrescoHttpClient, IAuditLogService auditLogService, IComponentService componentService, IDocumentService documentService, IIdentityUser identityUser, INodesService nodesService, ISpisUmConfiguration spisUmConfiguration, ITransactionHistoryService transactionHistory, IShipmentsService shipmentsService, IValidationService validationService, IAlfrescoModelComparer alfrescoModelComparer, ITranslateService translateService ) { _alfrescoHttpClient = alfrescoHttpClient; _auditLogService = auditLogService; _componentService = componentService; _documentService = documentService; _identityUser = identityUser; _nodesService = nodesService; _shipmentsService = shipmentsService; _spisUmConfiguration = spisUmConfiguration; _transactionHistory = transactionHistory; _validationService = validationService; _alfrescoModelComparer = alfrescoModelComparer; _translateService = translateService; }
public ComponentUpdateValidator(IAlfrescoHttpClient alfrescoHttpClient, INodesService nodesService, IIdentityUser identityUser, IDocumentService documentService) { _alfrescoHttpClient = alfrescoHttpClient; _nodesService = nodesService; _documentService = documentService; RuleFor(o => o) .Cascade(CascadeMode.StopOnFirstFailure) .MustAsync(async(context, cancellationToken) => { _groupPaging = await alfrescoHttpClient.GetPersonGroups(identityUser.Id); return(_groupPaging != null); }) .WithName(x => nameof(x.NodeId)) .WithMessage("Something went wrong with alfresco server.") .DependentRules(() => { RuleFor(x => x) .Must(y => _groupPaging?.List?.Entries?.Any(q => q.Entry.Id == identityUser.RequestGroup) ?? false) .WithName(x => "Group") .WithMessage($"User isn't member of group {identityUser.RequestGroup}."); }); RuleFor(x => x.Body.Properties ?? new Dictionary <string, object>()) .Must(x => !_ignoreList.Any(x.ContainsKey)) .WithMessage($"You are not allowed to pass properties {string.Join(", ", _ignoreList)}."); RuleFor(x => x) .MustAsync(CheckMainComponent); }
public CodeListsController(IAlfrescoConfiguration alfrescoConfiguration, IAlfrescoHttpClient alfrescoHttpClient, ISimpleMemoryCache simpleMemoryCache, INodesService nodesService) { _alfrescoConfig = alfrescoConfiguration; _alfrescoHttpClient = alfrescoHttpClient; _simpleMemoryCache = simpleMemoryCache; _nodesService = nodesService; }
/// <summary> /// Initializes a new instance of the <see cref="CategoryTreeService" /> class. /// </summary> /// <param name="repository">The repository.</param> /// <param name="unitOfWork">The unit of work.</param> /// <param name="treeService">The tree service.</param> /// <param name="nodeService">The node service.</param> /// <param name="nodesService">The nodes service.</param> /// <param name="tagService">The tag service.</param> /// <param name="accessControlService">The access control service.</param> /// <param name="securityService">The security service.</param> /// <param name="categoryService">The category service.</param> /// <param name="categoryTreeService">The category tree service</param> /// <param name="cmsConfiguration">The CMS configuration.</param> /// <param name="categorizableItemsService">The categorizable items service</param> public CategoryTreeService( IRepository repository, IUnitOfWork unitOfWork, INodesTreeService treeService, INodeService nodeService, INodesService nodesService, IAccessControlService accessControlService, ISecurityService securityService, Module.Root.Services.ICategoryService categoryService, Module.Root.Services.Categories.Tree.ICategoryTreeService categoryTreeService, ICmsConfiguration cmsConfiguration, ICategorizableItemsService categorizableItemsService ) { this.repository = repository; this.unitOfWork = unitOfWork; this.treeService = treeService; this.nodeService = nodeService; this.nodesService = nodesService; this.accessControlService = accessControlService; this.securityService = securityService; this.categoryService = categoryService; this.categoryTreeService = categoryTreeService; this.cmsConfiguration = cmsConfiguration; this.categorizableItemsService = categorizableItemsService; }
public NodesTests() { TestsData testsData = TestsData.Create(nameof(NodesTests)); fillTestDbHelper = testsData.FillTestDbHelper; nodesService = testsData.AppServiceProvider.NodesService; }
public ConfigurationController(IFileStorage fileStorage, IConnectionsService connectionsService, IFilesService filesService, INodesService nodesService, IKeysService keysService, IAppServiceProvider appServiceProvider) { _fileStorage = fileStorage; _connectionsService = connectionsService; _filesService = filesService; _keysService = keysService; _nodesService = nodesService; _appServiceProvider = appServiceProvider; }
public FilesController(IFileStorage fileStorage, INodeNoticeService nodeNoticeService, IConnectionsService connectionsService, IFilesService filesService, INodesService nodesService, INodeRequestSender nodeRequestSender) { this.fileStorage = fileStorage; this.nodeNoticeService = nodeNoticeService; this.connectionsService = connectionsService; this.filesService = filesService; this.nodesService = nodesService; this.nodeRequestSender = nodeRequestSender; }
public ComponentService(IAlfrescoHttpClient alfrescoHttpClient, INodesService nodesService, IPersonService personService, IIdentityUser identityUser, IAuditLogService auditLogService) { _alfrescoHttpClient = alfrescoHttpClient; _nodesService = nodesService; _personService = personService; _identityUser = identityUser; _auditLogService = auditLogService; }
public NodeNoticeService(IAppServiceProvider appServiceProvider) { _connectionsService = appServiceProvider.ConnectionsService; _updateMessagesService = appServiceProvider.UpdateMessagesService; _loadChatsService = appServiceProvider.LoadChatsService; _loadDialogsService = appServiceProvider.LoadDialogsService; _loadChannelsService = appServiceProvider.LoadChannelsService; _pendingMessagesService = appServiceProvider.PendingMessagesService; _nodesService = appServiceProvider.NodesService; }
public NodeRequestSender( IConnectionsService connectionsService, IFilesService filesService, INodesService nodesService, INodeNoticeService nodeNoticeService) { this.connectionsService = connectionsService; this.nodesService = nodesService; this.filesService = filesService; this.nodeNoticeService = nodeNoticeService; }
public ConnectRequestHandler( CommunicationObject request, NodeConnection node, IConnectionsService connectionsService, INodesService nodesService, INodeNoticeService nodeNoticeService) { this.request = (ConnectNodeRequest)request; this.connectionsService = connectionsService; this.nodesService = nodesService; this.nodeNoticeService = nodeNoticeService; nodeConnection = node; }
public EmailController( IAlfrescoConfiguration alfrescoConfig, IAlfrescoHttpClient alfrescoHttpClient, INodesService nodesService, IEmailDataBoxService emailDataBoxService, IEmailHttpClient emailHttpClient ) { _alfrescoConfig = alfrescoConfig; _alfrescoHttpClient = alfrescoHttpClient; _nodesService = nodesService; _emailDataBoxService = emailDataBoxService; _emailHttpClient = emailHttpClient; }
public EmailDataBoxService( IAlfrescoHttpClient alfrescoHttpClient, IIdentityUser identityUser, IComponentService componentService, IMapper mapper, INodesService nodesService ) { _alfrescoHttpClient = alfrescoHttpClient; _identityUser = identityUser; _componentService = componentService; _mapper = mapper; _nodesService = nodesService; }
public ConceptService(IAlfrescoHttpClient alfrescoHttpClient, INodesService nodesService, ITransactionHistoryService transactionHistoryService, IIdentityUser identityUser, IComponentService componentService, IDocumentService documentService, IAuditLogService auditLogService ) { _alfrescoHttpClient = alfrescoHttpClient; _nodesService = nodesService; _transactionHistoryService = transactionHistoryService; _identityUser = identityUser; _componentService = componentService; _documentService = documentService; _auditLogService = auditLogService; }
public FileController( IAlfrescoHttpClient alfrescoHttpClient, IAuditLogService auditLogService, IFileService fileService, IIdentityUser identityUser, INodesService nodesService, IShipmentsService shipmentsService, ITransactionHistoryService transactionHistoryService ) { _alfrescoHttpClient = alfrescoHttpClient; _auditLogService = auditLogService; _fileService = fileService; _identityUser = identityUser; _nodesService = nodesService; _shipmentsService = shipmentsService; _transactionHistoryService = transactionHistoryService; }
public SearchRequestHandler( Request request, ClientConnection clientConnection, IConnectionsService connectionsService, ILoadChatsService loadChatsService, INodesService nodesService, ILoadUsersService loadUsersService, ILoadChannelsService loadChannelsService, IPrivacyService privacyService, INodeRequestSender nodeRequestSender) { this.request = (SearchRequest)request; this.clientConnection = clientConnection; this.connectionsService = connectionsService; this.loadChatsService = loadChatsService; this.nodesService = nodesService; this.loadUsersService = loadUsersService; this.loadChannelsService = loadChannelsService; this.privacyService = privacyService; this.nodeRequestSender = nodeRequestSender; }
/// <summary> /// Initializes a new instance of the <see cref="SitemapService" /> class. /// </summary> /// <param name="repository">The repository.</param> /// <param name="unitOfWork">The unit of work.</param> /// <param name="treeService">The tree service.</param> /// <param name="nodeService">The node service.</param> /// <param name="nodesService">The nodes service.</param> /// <param name="tagService">The tag service.</param> /// <param name="accessControlService">The access control service.</param> /// <param name="securityService">The security service.</param> /// <param name="sitemapService">The sitemap service.</param> /// <param name="cmsConfiguration">The CMS configuration.</param> public SitemapService( IRepository repository, IUnitOfWork unitOfWork, ISitemapTreeService treeService, INodeService nodeService, INodesService nodesService, ITagService tagService, IAccessControlService accessControlService, ISecurityService securityService, Module.Pages.Services.ISitemapService sitemapService, ICmsConfiguration cmsConfiguration) { this.repository = repository; this.unitOfWork = unitOfWork; this.treeService = treeService; this.nodeService = nodeService; this.nodesService = nodesService; this.tagService = tagService; this.accessControlService = accessControlService; this.securityService = securityService; this.sitemapService = sitemapService; this.cmsConfiguration = cmsConfiguration; }
public DocumentComponentDeleteValidator(IAlfrescoHttpClient alfrescoHttpClient, IIdentityUser identityUser, INodesService nodesService) { RuleFor(o => o) .Cascade(CascadeMode.StopOnFirstFailure) .MustAsync(async(context, cancellationToken) => { _groupPaging = await alfrescoHttpClient.GetPersonGroups(identityUser.Id); _nodeEntry = await alfrescoHttpClient.GetNodeInfo(context.NodeId, ImmutableList <Parameter> .Empty .Add(new Parameter(AlfrescoNames.Headers.Include, $"{AlfrescoNames.Includes.Path},{AlfrescoNames.Includes.IsLocked}", ParameterType.QueryString))); await context.ComponentsId.ForEachAsync(async x => { _nodeParents.Add(new ParentsInfo { Parents = await nodesService.GetParentsByAssociation(x, new List <string> { SpisumNames.Associations.DeletedComponents }), ComponentId = x }); }); return(_groupPaging != null && _nodeEntry != null && _nodeParents.Count != 0); }) .WithName(x => nameof(x.NodeId)) .WithMessage("Something went wrong with alfresco server.") .DependentRules(() => { RuleFor(x => x) .Must(y => _groupPaging?.List?.Entries?.Any(q => q.Entry.Id == identityUser.RequestGroup) ?? false) .WithName(x => "Group") .WithMessage($"User isn't member of group {identityUser.RequestGroup}."); RuleFor(x => x.NodeId) .Must(y => _nodeEntry?.Entry?.NodeType == SpisumNames.NodeTypes.Document) .WithMessage($"Provided nodeId must be type of {SpisumNames.NodeTypes.Document}"); RuleFor(x => x.ComponentsId) .Must(y => _nodeParents.All(x => x.Parents.Count == 0)) .WithMessage("One or more components were already canceleted/deleted"); RuleFor(x => x) .Must(x => { var isPathMailroom = _nodeEntry?.Entry?.Path?.Name?.StartsWith(AlfrescoNames.Prefixes.Path + SpisumNames.Paths.MailRoomUnfinished, StringComparison.OrdinalIgnoreCase); if (isPathMailroom == null) { throw new BadRequestException("", "Something went wrong with document path"); } var properties = _nodeEntry?.Entry?.Properties?.As <JObject>().ToDictionary(); var form = properties.GetNestedValueOrDefault(SpisumNames.Properties.Form)?.ToString(); var documentType = properties.GetNestedValueOrDefault(SpisumNames.Properties.DocumentType)?.ToString(); var senderType = properties.GetNestedValueOrDefault(SpisumNames.Properties.SenderType)?.ToString(); var isLocked = _nodeEntry?.Entry?.IsLocked; if (isPathMailroom.Value) { return(form == "analog" || documentType == "technicalDataCarries"); } if (isLocked != null && !isLocked.Value && senderType == SpisumNames.SenderType.Own) { return(true); } return(false); }) .OnAnyFailure(x => throw new BadRequestException("Adding component is not allowed.")); }); }
public SitemapService(ISitemapTreeService treeService, INodeService nodeService, INodesService nodesService) { this.treeService = treeService; this.nodeService = nodeService; this.nodesService = nodesService; }
public static async Task <List <string> > GetChildrenIds(this INodesService nodeService, string nodeId) => (await nodeService.GetChildren(nodeId)).Select(x => x.Entry.Id).ToList();
public ShipmentUpdatePersonallyValidator(IAlfrescoHttpClient alfrescoHttpClient, IIdentityUser identityUser, INodesService nodesService) { RuleFor(o => o) .Cascade(CascadeMode.StopOnFirstFailure) .MustAsync(async(context, cancellationToken) => { _nodeEntry = await alfrescoHttpClient.GetNodeInfo(context.NodeId, ImmutableList <Parameter> .Empty .Add(new Parameter(AlfrescoNames.Headers.Include, AlfrescoNames.Includes.Path, ParameterType.QueryString))); _nodeParents = await nodesService.GetParentsByAssociation(context.NodeId, new List <string> { SpisumNames.Associations.ShipmentsCreated, SpisumNames.Associations.ShipmentsToReturn, SpisumNames.Associations.ShipmentsToDispatch }); _groupPaging = await alfrescoHttpClient.GetPersonGroups(identityUser.Id); if (_nodeParents?.Any(x => x?.Entry?.Association?.AssocType == SpisumNames.Associations.ShipmentsToDispatch) ?? false) { _groupToDispatch = await alfrescoHttpClient.GetGroupMembers(SpisumNames.Groups.DispatchGroup, ImmutableList <Parameter> .Empty.Add(new Parameter(AlfrescoNames.Headers.Where, AlfrescoNames.MemberType.Group, ParameterType.QueryString))); } return(_nodeEntry?.Entry?.Id != null && _groupPaging != null && _nodeParents != null); }) .WithName(x => nameof(x.NodeId)) .WithMessage("Something went wrong with alfresco server.") .DependentRules(() => { RuleFor(x => x) .Must(y => _groupPaging?.List?.Entries?.Any(q => q.Entry.Id == identityUser.RequestGroup) ?? false) .WithName(x => "Group") .WithMessage($"User isn't member of group {identityUser.RequestGroup}."); RuleFor(x => x.NodeId) .Must(x => _nodeEntry.Entry.NodeType == SpisumNames.NodeTypes.ShipmentPersonally) .WithMessage(x => $"Provided nodeId must be NodeType {SpisumNames.NodeTypes.ShipmentPersonally}"); RuleFor(x => x) .Must(y => _nodeParents?.Any(q => q.Entry.NodeType == SpisumNames.NodeTypes.Document || q.Entry.NodeType == SpisumNames.NodeTypes.File) ?? false) .WithName(x => "Parent") .WithMessage($"Provided shipment does not have a parent type of {SpisumNames.NodeTypes.Document} or {SpisumNames.NodeTypes.File}"); RuleFor(x => x) .Must(y => CheckDispatchGroup(identityUser.RequestGroup)) .WithMessage(x => "Dispatch group") .WithMessage($"Requested group in not part of {SpisumNames.Groups.DispatchGroup}"); }); RuleFor(x => x.Body.Address1) .Must(x => CheckLength(x, 100)) .When(x => x.Body != null) .WithMessage("Address1 is too long"); RuleFor(x => x.Body.Address2) .Must(x => CheckLength(x, 100)) .When(x => x.Body != null) .WithMessage("Address2 is too long"); RuleFor(x => x.Body.Address3) .Must(x => CheckLength(x, 100)) .When(x => x.Body != null) .WithMessage("Address3 is too long"); RuleFor(x => x.Body.Address4) .Must(x => CheckLength(x, 100)) .When(x => x.Body != null) .WithMessage("Address4 is too long"); RuleFor(x => x.Body.AddressStreet) .Must(x => CheckLength(x, 100)) .When(x => x.Body != null) .WithMessage("AddressStreet is too long"); RuleFor(x => x.Body.AddressCity) .Must(x => CheckLength(x, 100)) .When(x => x.Body != null) .WithMessage("AddressCity is too long"); RuleFor(x => x.Body.AddressZip) .Must(x => CheckLength(x, 100)) .When(x => x.Body != null) .WithMessage("AddressZip is too long"); RuleFor(x => x.Body.AddressState) .Must(x => CheckLength(x, 100)) .When(x => x.Body != null) .WithMessage("AddressState is too long"); }
public ShipmentUpdateEmailValidator(IAlfrescoHttpClient alfrescoHttpClient, IIdentityUser identityUser, INodesService nodesService, IEmailHttpClient emailHttpClient) { RuleFor(o => o) .Cascade(CascadeMode.StopOnFirstFailure) .MustAsync(async(context, cancellationToken) => { _nodeEntry = await alfrescoHttpClient.GetNodeInfo(context.NodeId, ImmutableList <Parameter> .Empty .Add(new Parameter(AlfrescoNames.Headers.Include, AlfrescoNames.Includes.Path, ParameterType.QueryString))); _nodeParents = await nodesService.GetParentsByAssociation(context.NodeId, new List <string> { SpisumNames.Associations.ShipmentsCreated, SpisumNames.Associations.ShipmentsToReturn, SpisumNames.Associations.ShipmentsToDispatch }); _groupPaging = await alfrescoHttpClient.GetPersonGroups(identityUser.Id); try { _accounts = await emailHttpClient.Accounts(); } catch { } if (_nodeParents?.Any(x => x?.Entry?.Association?.AssocType == SpisumNames.Associations.ShipmentsToDispatch) ?? false) { _groupToDispatch = await alfrescoHttpClient.GetGroupMembers(SpisumNames.Groups.DispatchGroup, ImmutableList <Parameter> .Empty.Add(new Parameter(AlfrescoNames.Headers.Where, AlfrescoNames.MemberType.Group, ParameterType.QueryString))); } return(_nodeEntry?.Entry?.Id != null && _groupPaging != null && _nodeParents != null && _accounts != null); }) .WithName(x => nameof(x.NodeId)) .WithMessage("Something went wrong with alfresco server.") .DependentRules(() => { RuleFor(x => x) .Must(y => _groupPaging?.List?.Entries?.Any(q => q.Entry.Id == identityUser.RequestGroup) ?? false) .WithName(x => "Group") .WithMessage($"User isn't member of group {identityUser.RequestGroup}."); RuleFor(x => x.NodeId) .Must(x => _nodeEntry.Entry.NodeType == SpisumNames.NodeTypes.ShipmentEmail) .WithMessage(x => $"Provided nodeId must be NodeType {SpisumNames.NodeTypes.ShipmentEmail}"); RuleFor(x => x) .Must(y => _nodeParents?.Any(q => q.Entry.NodeType == SpisumNames.NodeTypes.Document) ?? false) .WithName(x => "Parent") .WithMessage($"Provided shipment does not have a parent type of {SpisumNames.NodeTypes.Document}"); RuleFor(x => x) .Must(y => CheckDispatchGroup(identityUser.RequestGroup)) .WithMessage(x => "Dispatch group") .WithMessage($"Requested group in not part of {SpisumNames.Groups.DispatchGroup}"); RuleFor(x => x) .Must(x => _accounts.Count > 0) .WithMessage(x => "No email configuration on email server"); RuleFor(x => x.Body.Sender) .Must(y => _accounts?.Any(x => x.Username == y) ?? false) .WithMessage(x => "Sender was not found in email configuration on email server"); }); RuleFor(x => x.Body.Recipient) .Must(x => EmailUtils.IsValidEmail(x)) .When(x => x.Body != null) .WithName(x => "Recipient") .WithMessage("Recipient is not a valid email address"); RuleFor(x => x.Body.Subject) .Must(x => CheckLength(x, 255)) .When(x => x.Body != null) .WithName(x => "Subject") .WithMessage("Subject is too long"); RuleFor(x => x.Body.Recipient) .Must(x => CheckLength(x, 254)) .When(x => x.Body != null) .WithName(x => "Recipient") .WithMessage("Recipient is too long"); RuleFor(x => x.Body.Components) .Must(y => y.Count > 0) .WithName(x => "Components") .WithMessage("Components cannot be empty"); }
// ReSharper disable once EmptyConstructor public ReleaseApiController(IIndexService indexService, INodesService nodesService, IGraphService graphService) { _indexService = indexService; _nodesService = nodesService; _graphService = graphService; }
public GetInformationWebRequestHandler(Request request, INodesService nodesService) { this.request = request; this.nodesService = nodesService; }
public ShipmentUpdatePublishValidator(IAlfrescoHttpClient alfrescoHttpClient, IIdentityUser identityUser, INodesService nodesService) { RuleFor(o => o) .Cascade(CascadeMode.StopOnFirstFailure) .MustAsync(async(context, cancellationToken) => { _nodeEntry = await alfrescoHttpClient.GetNodeInfo(context.NodeId, ImmutableList <Parameter> .Empty .Add(new Parameter(AlfrescoNames.Headers.Include, AlfrescoNames.Includes.Path, ParameterType.QueryString))); _nodeParents = await nodesService.GetParentsByAssociation(context.NodeId, new List <string> { SpisumNames.Associations.ShipmentsCreated, SpisumNames.Associations.ShipmentsToReturn, SpisumNames.Associations.ShipmentsToDispatch }); _groupPaging = await alfrescoHttpClient.GetPersonGroups(identityUser.Id); if (_nodeParents?.Any(x => x?.Entry?.Association?.AssocType == SpisumNames.Associations.ShipmentsToDispatch) ?? false) { _groupToDispatch = await alfrescoHttpClient.GetGroupMembers(SpisumNames.Groups.DispatchGroup, ImmutableList <Parameter> .Empty.Add(new Parameter(AlfrescoNames.Headers.Where, AlfrescoNames.MemberType.Group, ParameterType.QueryString))); } return(_nodeEntry?.Entry?.Id != null && _groupPaging != null && _nodeParents != null); }) .WithName(x => nameof(x.NodeId)) .WithMessage("Something went wrong with alfresco server.") .DependentRules(() => { RuleFor(x => x) .Must(y => _groupPaging?.List?.Entries?.Any(q => q.Entry.Id == identityUser.RequestGroup) ?? false) .WithName(x => "Group") .WithMessage($"User isn't member of group {identityUser.RequestGroup}."); RuleFor(x => x.NodeId) .Must(x => _nodeEntry.Entry.NodeType == SpisumNames.NodeTypes.ShipmentPublish) .WithMessage(x => $"Provided nodeId must be NodeType {SpisumNames.NodeTypes.ShipmentPublish}"); RuleFor(x => x) .Must(y => _nodeParents?.Any(q => q.Entry.NodeType == SpisumNames.NodeTypes.Document) ?? false) .WithName(x => "Parent") .WithMessage($"Provided shipment does not have a parent type of {SpisumNames.NodeTypes.Document}"); RuleFor(x => x) .Must(y => CheckDispatchGroup(identityUser.RequestGroup)) .WithName(x => "Dispatch group") .WithMessage($"Requested group in not part of {SpisumNames.Groups.DispatchGroup}"); }); RuleFor(x => x.Body.Components) .Must(y => y.Count > 0) .When(x => x.Body != null) .WithName(x => "Components") .WithMessage("Components cannot be empty"); RuleFor(x => x.Body.DateFrom) .Must(y => y.HasValue && CompareDateTime(y.Value)) .When(x => x.Body != null) .WithName(x => "DateFrom") .WithMessage("DateFrom cannot be in past"); RuleFor(x => x.Body.Days) .Must(y => y.HasValue ? y.Value > 0 : true) .When(x => x.Body != null) .WithName(x => "Days") .WithMessage("Days must be greater than 0"); RuleFor(x => x.Body.Note) .MaximumLength(255) .When(x => x.Body != null) .WithName(x => "Note") .WithMessage("Message cannot be longer than 255 characters"); }
/// <summary> /// Initializes a new instance of the <see cref="CategoryTreeService" /> class. /// </summary> /// <param name="repository">The repository.</param> /// <param name="unitOfWork">The unit of work.</param> /// <param name="treeService">The tree service.</param> /// <param name="nodeService">The node service.</param> /// <param name="nodesService">The nodes service.</param> /// <param name="accessControlService">The access control service.</param> /// <param name="securityService">The security service.</param> /// <param name="categoryService">The category service.</param> /// <param name="categoryTreeService">The category tree service</param> /// <param name="cmsConfiguration">The CMS configuration.</param> /// <param name="categorizableItemsService">The categorizable items service</param> public CategoryTreeService( IRepository repository, IUnitOfWork unitOfWork, INodesTreeService treeService, INodeService nodeService, INodesService nodesService, IAccessControlService accessControlService, ISecurityService securityService, Module.Root.Services.ICategoryService categoryService, Module.Root.Services.Categories.Tree.ICategoryTreeService categoryTreeService, ICmsConfiguration cmsConfiguration, ICategorizableItemsService categorizableItemsService) { this.repository = repository; this.unitOfWork = unitOfWork; this.treeService = treeService; this.nodeService = nodeService; this.nodesService = nodesService; this.accessControlService = accessControlService; this.securityService = securityService; this.categoryService = categoryService; this.categoryTreeService = categoryTreeService; this.cmsConfiguration = cmsConfiguration; this.categorizableItemsService = categorizableItemsService; }
public FileShipmentSendValidator(IAlfrescoHttpClient alfrescoHttpClient, IIdentityUser identityUser, INodesService nodesService) { RuleFor(o => o) .Cascade(CascadeMode.StopOnFirstFailure) .MustAsync(async(context, cancellationToken) => { _nodeEntry = await alfrescoHttpClient.GetNodeInfo(context.NodeId, ImmutableList <Parameter> .Empty .Add(new Parameter(AlfrescoNames.Headers.Include, AlfrescoNames.Includes.Path, ParameterType.QueryString))); await context.ShipmentsId?.ForEachAsync(async x => { _parents.Add(new ParentShipmentInfo { ShipmentId = x, Parents = await nodesService.GetParentsByAssociation(x, new List <string> { SpisumNames.Associations.ShipmentsCreated, SpisumNames.Associations.ShipmentsToReturn }) }); }); _groupPaging = await alfrescoHttpClient.GetPersonGroups(identityUser.Id); return(_groupPaging != null && _nodeEntry != null && _parents != null); }) .WithName(x => nameof(x.NodeId)) .WithMessage("Something went wrong with alfresco server.") .DependentRules(() => { RuleFor(x => x) .Must(y => _groupPaging?.List?.Entries?.Any(q => q.Entry.Id == identityUser.RequestGroup) ?? false) .WithName(x => "Group") .WithMessage($"User isn't member of group {identityUser.RequestGroup}."); RuleFor(x => x.NodeId) .Must(x => _nodeEntry.Entry.NodeType == SpisumNames.NodeTypes.File) .WithMessage(x => $"Provided nodeId must be NodeType {SpisumNames.NodeTypes.File}"); RuleFor(x => x) .Must(y => _parents.All(p => p.Parents.Any(c => c.Entry.Id == y.NodeId))) .WithName(x => "Shipments") .WithMessage($"Not all shipments are type of {SpisumNames.Associations.ShipmentsCreated} or {SpisumNames.Associations.ShipmentsToReturn} or not all shipments are not associated with nodeId"); }); }
public DocumentChangeFileMarkValidator(IAlfrescoHttpClient alfrescoHttpClient, IIdentityUser identityUser, INodesService nodesService) { RuleFor(o => o) .Cascade(CascadeMode.StopOnFirstFailure) .MustAsync(async(context, cancellationToken) => { _nodeEntry = await alfrescoHttpClient.GetNodeInfo(context.NodeId, ImmutableList <Parameter> .Empty .Add(new Parameter(AlfrescoNames.Headers.Include, AlfrescoNames.Includes.Path, ParameterType.QueryString))); _groupPaging = await alfrescoHttpClient.GetPersonGroups(identityUser.Id); return(_nodeEntry?.Entry?.Id != null && _groupPaging != null); }) .WithName(x => nameof(x.NodeId)) .WithMessage("Something went wrong with alfresco server.") .DependentRules(() => { RuleFor(x => x) .Must(y => _groupPaging?.List?.Entries?.Any(q => q.Entry.Id == identityUser.RequestGroup) ?? false) .WithName(x => "Group") .WithMessage($"User isn't member of group {identityUser.RequestGroup}."); RuleFor(x => x.NodeId) .Must(x => _nodeEntry?.Entry?.NodeType == SpisumNames.NodeTypes.Document) .WithMessage($"NodeId must be type of {SpisumNames.NodeTypes.Document}."); }); }
public ApiServiceController(ITpsService tpsService, INodesService nodesService, IGraphService graphService) { _tpsService = tpsService; _nodesService = nodesService; _graphService = graphService; }