Exemple #1
0
 public void SetUp()
 {
     _documentService     = new Mock <IDocumentService>();
     _approvalRepository  = new Mock <IApprovalRepository>();
     _rejectionRepository = new Mock <IRejectionRepository>();
     _approvalEngine      = new ApprovalEngine(_documentService.Object, _approvalRepository.Object);
 }
Exemple #2
0
        public ContentApprovalsManagerPageController(
            IApprovalDefinitionRepository repoDefinitions,
            IContentRepository repoContent,
            IApprovalRepository repoApprovals,
            IApprovalEngine engine,
            UIRoleProvider roles,
            UIUserProvider users,
            IContentSecurityRepository repoSecurity)
        {
            this.repoDefinitions = repoDefinitions;
            this.repoContent     = repoContent;
            this.repoApprovals   = repoApprovals;
            this.engine          = engine;

            // if the editors role does not exist, create it and assign access rights
            if (!roles.RoleExists(editors))
            {
                roles.CreateRole(editors);

                var permissions = repoSecurity.Get(ContentReference.RootPage).CreateWritableClone() as IContentSecurityDescriptor;
                permissions.AddEntry(new AccessControlEntry(editors,
                                                            AccessLevel.Create | AccessLevel.Edit | AccessLevel.Delete | AccessLevel.Read | AccessLevel.Publish));
                repoSecurity.Save(ContentReference.RootPage, permissions, SecuritySaveType.Replace);
            }

            // create three users and add them to roles

            UIUserCreateStatus   status;
            IEnumerable <string> errors = Enumerable.Empty <string>();

            if (users.GetUser(userName1) == null)
            {
                users.CreateUser(
                    userName1, password,
                    email: userName1.ToLower() + emailBase,
                    passwordQuestion: null, passwordAnswer: null,
                    isApproved: true, status: out status, errors: out errors);

                roles.AddUserToRoles(userName1, new string[] { admins });
            }

            if (users.GetUser(userName2) == null)
            {
                users.CreateUser(
                    userName2, password, userName2.ToLower() + emailBase,
                    null, null, true, out status, out errors);

                roles.AddUserToRoles(userName2, new string[] { editors });
            }

            if (users.GetUser(userName3) == null)
            {
                users.CreateUser(
                    userName3, password, userName3.ToLower() + emailBase,
                    null, null, true, out status, out errors);

                roles.AddUserToRoles(userName3, new string[] { editors });
            }
        }
Exemple #3
0
 public AdvancedTaskController(IApprovalRepository approvalRepository, IContentRepository contentRepository, IContentTypeRepository contentTypeRepository, IUserNotificationRepository userNotificationRepository, IApprovalEngine approvalEngine, LocalizationService localizationService, IAsyncDatabaseExecutor asyncDatabaseExecutor, ChangeTaskHelper changeTaskHelper, UIHelper helper)
 {
     _approvalRepository         = approvalRepository;
     _contentRepository          = contentRepository;
     _contentTypeRepository      = contentTypeRepository;
     _userNotificationRepository = userNotificationRepository;
     _approvalEngine             = approvalEngine;
     _localizationService        = localizationService;
     _changeTaskHelper           = changeTaskHelper;
     _helper = helper;
 }
Exemple #4
0
        private void PerformIOC()
        {
            string test = ConfigurationManager.AppSettings["companyCode"];

            IoCContainer.ResoloveDependencies();

            _documentService         = IoCContainer.Resolve <IDocumentService>();
            _documentApprovalService = IoCContainer.Resolve <IAutoApprovalService>();
            _subDocTypeService       = IoCContainer.Resolve <ISubDocTypeService>();
            _gridRunEngine           = IoCContainer.Resolve <IGridRunEngine>();
            _manCoService            = IoCContainer.Resolve <IManCoService>();
            _approvalEngine          = IoCContainer.Resolve <IApprovalEngine>();
            _gridRunService          = IoCContainer.Resolve <IGridRunService>();
        }
        public void Initialize(InitializationEngine context)
        {
            _approvalEngine       = context.Locate.Advanced.GetInstance <IApprovalEngine>();
            _approvalEngineEvents = context.Locate.Advanced.GetInstance <IApprovalEngineEvents>();
            _approvalDefinitionVersionRepository = context.Locate.Advanced.GetInstance <IApprovalDefinitionVersionRepository>();
            _contentRepository = context.Locate.Advanced.GetInstance <IContentRepository>();

            _bots = new ILegionApprover[]
            {
                new SpellCheckApprover(),
                new ImageCheckApprover(),
                new SentimentCheckApprover()
            };

            _approvalEngineEvents.StepStarted += OnStepStarted;
        }
Exemple #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Allocation" /> class.
 /// </summary>
 /// <param name="engine">The engine.</param>
 /// <param name="appInfo">The application information.</param>
 /// <param name="documentService">The document service.</param>
 /// <param name="documentApprovalService">The document approval service.</param>
 /// <param name="subDocTypeService">The sub document type service.</param>
 public Allocation(
     NexdoxEngine engine,
     ApplicationInfo appInfo,
     IDocumentService documentService,
     IAutoApprovalService documentApprovalService,
     ISubDocTypeService subDocTypeService,
     IGridRunEngine gridRunEngine,
     IManCoService manCoService,
     IApprovalEngine approvalEngine,
     IGridRunService gridRunService)
 {
     _engine                  = engine;
     _appInfo                 = appInfo;
     _documentService         = documentService;
     _documentApprovalService = documentApprovalService;
     _subDocTypeService       = subDocTypeService;
     _gridRunEngine           = gridRunEngine;
     _manCoService            = manCoService;
     _approvalEngine          = approvalEngine;
     _gridRunService          = gridRunService;
 }
Exemple #7
0
 public ApprovalService(IApprovalEngine approvalEngine)
 {
     _approvalEngine = approvalEngine;
 }