Exemple #1
0
        public bool CanModify()
        {
            const string operation  = "ModifyRecord";
            bool         permission = viewPermissions.CanModify();

            ViewPermissionNotGranted(permission, operation);

            bool modulePermission = modulePermissions.CanModify();

            ModuleNotValid(modulePermission, operation);

            return(permission && modulePermission);
        }
Exemple #2
0
        protected void CheckAllowedOperations(params ViewAllowedOperations[] operations)
        {
            IViewPermissions supportedOperations = ModuleMapping.GetSupportedOperations();

            List <ViewAllowedOperations> allowedOperations = new List <ViewAllowedOperations>();

            allowedOperations.AddRange(operations);

            Assert.That(supportedOperations.CanAdd(), Is.EqualTo(allowedOperations.Contains(ViewAllowedOperations.AddRecord)), "AddRecord");
            Assert.That(supportedOperations.CanConfirm(), Is.EqualTo(allowedOperations.Contains(ViewAllowedOperations.ConfirmRecord)), "ConfirmRecord");
            Assert.That(supportedOperations.CanDelete(), Is.EqualTo(allowedOperations.Contains(ViewAllowedOperations.DeleteRecord)), "DeleteRecord");
            Assert.That(supportedOperations.CanModify(), Is.EqualTo(allowedOperations.Contains(ViewAllowedOperations.ModifyRecord)), "ModifyRecord");
            Assert.That(supportedOperations.CanSplit(), Is.EqualTo(allowedOperations.Contains(ViewAllowedOperations.SplitRecord)), "SplitRecord");
            Assert.That(supportedOperations.CanUnconfirm(), Is.EqualTo(allowedOperations.Contains(ViewAllowedOperations.UnconfirmRecord)), "UnconfirmRecord");
            Assert.That(supportedOperations.CanView(), Is.EqualTo(allowedOperations.Contains(ViewAllowedOperations.ViewRecord)), "ViewRecord");
        }