Beispiel #1
0
        public void GetClass()
        {
            SecurableClassDefinition   classDefinition = _testHelper.CreateClassDefinition("SecurableClass");
            StatelessAccessControlList acl             = _testHelper.CreateStatelessAcl(classDefinition);

            Assert.That(acl.Class, Is.SameAs(classDefinition));
        }
Beispiel #2
0
        public void OnCommitting_WithChangedPermission_RegistersClassForCommit()
        {
            var classDefinition = _testHelper.CreateClassDefinition("SecurableClass");
            var acl             = _testHelper.CreateStatelessAcl(classDefinition);
            var ace             = _testHelper.CreateAceWithOwningUser();

            acl.AccessControlEntries.Add(ace);
            var accessType = _testHelper.AttachJournalizeAccessType(classDefinition);

            ace.AllowAccess(accessType);

            using (ClientTransaction.Current.CreateSubTransaction().EnterDiscardingScope())
            {
                bool commitOnClassWasCalled = false;
                classDefinition.Committing += (sender, e) =>
                {
                    commitOnClassWasCalled = true;
                    Assert.That(GetDataContainer((DomainObject)sender).HasBeenMarkedChanged, Is.True);
                };
                ace.GetPermissions()[0].RegisterForCommit();

                ClientTransaction.Current.Commit();

                Assert.That(commitOnClassWasCalled, Is.True);
            }
        }