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

            Assert.That(acl.Class, Is.SameAs(classDefinition));
        }
Exemplo n.º 2
0
        public SecurableClassDefinition CreateAndCommitSecurableClassDefinitionWithAccessControlLists(int accessControlLists, ClientTransaction transaction)
        {
            CreateEmptyDomain();

            using (transaction.EnterNonDiscardingScope())
            {
                SecurableClassDefinition   classDefinition            = CreateOrderSecurableClassDefinition();
                StatelessAccessControlList statelessAccessControlList = StatelessAccessControlList.NewObject();
                classDefinition.StatelessAccessControlList = statelessAccessControlList;

                var stateProperty = StatePropertyDefinition.NewObject(Guid.NewGuid(), "Property");
                classDefinition.AddStateProperty(stateProperty);

                for (int i = 1; i < accessControlLists; i++)
                {
                    StatefulAccessControlList statefulAccessControlList = StatefulAccessControlList.NewObject();
                    classDefinition.StatefulAccessControlLists.Add(statefulAccessControlList);
                    statefulAccessControlList.CreateAccessControlEntry();
                    CreateStateCombination(statefulAccessControlList, stateProperty, StateDefinition.NewObject(string.Format("Value {0}", i), i));
                }

                ClientTransactionScope.CurrentTransaction.Commit();

                return(classDefinition);
            }
        }
Exemplo n.º 3
0
        private AccessControlEntry CreateAceForStateless()
        {
            var ace = AccessControlEntry.NewObject();

            ace.AccessControlList = StatelessAccessControlList.NewObject();

            return(ace);
        }
Exemplo n.º 4
0
 public StatelessAccessControlList CreateStatelessAcl(SecurableClassDefinition classDefinition, ClientTransaction transaction)
 {
     using (transaction.EnterNonDiscardingScope())
     {
         var acl = StatelessAccessControlList.NewObject();
         classDefinition.StatelessAccessControlList = acl;
         return(acl);
     }
 }
Exemplo n.º 5
0
        public StatelessAccessControlList CreateStatelessAccessControlList()
        {
            if (StatelessAccessControlList != null)
            {
                throw new InvalidOperationException("A SecurableClassDefinition only supports a single StatelessAccessControlList at a time.");
            }

            var accessControlList = StatelessAccessControlList.NewObject();

            StatelessAccessControlList = accessControlList;
            accessControlList.CreateAccessControlEntry();

            return(accessControlList);
        }
Exemplo n.º 6
0
        public void CreateStatelessAccessControlList()
        {
            using (ClientTransaction.CreateRootTransaction().EnterNonDiscardingScope())
            {
                SecurableClassDefinition classDefinition = SecurableClassDefinition.NewObject();
                using (ClientTransaction.Current.CreateSubTransaction().EnterDiscardingScope())
                {
                    classDefinition.EnsureDataAvailable();
                    Assert.That(classDefinition.State, Is.EqualTo(StateType.Unchanged));

                    StatelessAccessControlList accessControlList = classDefinition.CreateStatelessAccessControlList();

                    Assert.That(accessControlList.Class, Is.SameAs(classDefinition));
                    Assert.IsNotEmpty(accessControlList.AccessControlEntries);
                    Assert.That(classDefinition.State, Is.EqualTo(StateType.Changed));
                }
            }
        }
Exemplo n.º 7
0
        public void CreateAccessControlEntry_BeforeClassIsSet_WithStatelessAccessControlList()
        {
            AccessControlList acl = StatelessAccessControlList.NewObject();

            acl.CreateAccessControlEntry();
        }