Exemplo n.º 1
0
        public AmplaViewProperties(IModelProperties <TModel> modelProperties)
        {
            this.modelProperties = modelProperties;
            permissions          = new ViewPermissions();
            IViewPermissions modulePermissions =
                ModuleMapping.GetModuleMapping(modelProperties.Module).GetSupportedOperations();

            enforcePermissions = new EnforceViewPermissionsAdapter(modelProperties.Module.ToString(), permissions,
                                                                   modulePermissions);
        }
Exemplo 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));
        }
Exemplo 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));
        }
Exemplo n.º 4
0
        protected override IViewPermissions CreateViewPermissions(ViewPermissions permissions)
        {
            ViewPermissions modulePermissions = new ViewPermissions(
                ViewAllowedOperations.AddRecord,
                ViewAllowedOperations.ConfirmRecord,
                ViewAllowedOperations.DeleteRecord,
                ViewAllowedOperations.ModifyRecord,
                ViewAllowedOperations.SplitRecord,
                ViewAllowedOperations.UnconfirmRecord,
                ViewAllowedOperations.ViewRecord);

            return(new EnforceViewPermissionsAdapter("Downtime", permissions, modulePermissions));
        }
Exemplo n.º 5
0
 protected override IViewPermissions CreateViewPermissions(ViewPermissions permissions)
 {
     return(permissions);
 }
Exemplo n.º 6
0
 protected override IViewPermissions CreateViewPermissions(ViewPermissions permissions)
 {
     viewPermissions = new ValidateViewPermissions("Downtime", permissions, downtimePermissions);
     return(viewPermissions);
 }
Exemplo n.º 7
0
 private void Create(Func <ViewPermissions> createFunc)
 {
     permissions     = createFunc();
     viewPermissions = CreateViewPermissions(permissions);
 }
Exemplo n.º 8
0
 protected abstract IViewPermissions CreateViewPermissions(ViewPermissions permissions);