Esempio n. 1
0
        /// <summary>
        /// Validates the permissions for the view
        /// </summary>
        /// <returns></returns>
        public IList <string> ValidateViewPermissions()
        {
            IViewPermissions        modulePermissions   = ModuleMapping.GetModuleMapping(modelProperties.Module).GetSupportedOperations();
            ValidateViewPermissions validatePermissions = new ValidateViewPermissions(modelProperties.Module.ToString(), permissions,
                                                                                      modulePermissions);

            validatePermissions.ValidatePermissions();

            return(validatePermissions.Messages);
        }
Esempio n. 2
0
        public void ValidatesNoPermissions()
        {
            ViewPermissions         permissions = new ViewPermissions();
            ValidateViewPermissions view        = new ValidateViewPermissions("Production", permissions, productionPermissions);

            Assert.That(view.Messages, Is.Empty);
            view.ValidatePermissions();
            Assert.That(view.Messages, Is.Not.Empty);
            Assert.That(view.Messages.Count, Is.EqualTo(6));
        }
Esempio n. 3
0
        public void ValidatesViewAddModifyOnly()
        {
            ViewPermissions permissions = new ViewPermissions();

            permissions.Initialise(new[] { View(), Add(), Modify() });
            ValidateViewPermissions view = new ValidateViewPermissions("Production", permissions, productionPermissions);

            Assert.That(view.Messages, Is.Empty);
            view.ValidatePermissions();
            Assert.That(view.Messages, Is.Not.Empty);
            Assert.That(view.Messages.Count, Is.EqualTo(3));
        }
Esempio n. 4
0
 protected override IViewPermissions CreateViewPermissions(ViewPermissions permissions)
 {
     viewPermissions = new ValidateViewPermissions("Downtime", permissions, downtimePermissions);
     return(viewPermissions);
 }