Exemplo n.º 1
0
        public void GetSecurityStrategy_SameTwice()
        {
            OrganizationalStructureTestHelper testHelper = new OrganizationalStructureTestHelper();

            using (testHelper.Transaction.EnterNonDiscardingScope())
            {
                ISecurableObject position = testHelper.CreatePosition("PositionName");

                Assert.That(position.GetSecurityStrategy(), Is.SameAs(position.GetSecurityStrategy()));
            }
        }
Exemplo n.º 2
0
        public void GetSecurityStrategy()
        {
            ISecurableObject tenant = TestHelper.CreateTenant("Tenant", "UID: Tenant");

            IObjectSecurityStrategy objectSecurityStrategy = tenant.GetSecurityStrategy();

            Assert.That(objectSecurityStrategy, Is.Not.Null);
            Assert.IsInstanceOf(typeof(DomainObjectSecurityStrategyDecorator), objectSecurityStrategy);
            DomainObjectSecurityStrategyDecorator domainObjectSecurityStrategyDecorator = (DomainObjectSecurityStrategyDecorator)objectSecurityStrategy;

            Assert.That(domainObjectSecurityStrategyDecorator.RequiredSecurityForStates, Is.EqualTo(RequiredSecurityForStates.None));
        }
Exemplo n.º 3
0
        public void GetSecurityStrategy()
        {
            ISecurableObject group = CreateGroup();

            IObjectSecurityStrategy objectSecurityStrategy = group.GetSecurityStrategy();

            Assert.That(objectSecurityStrategy, Is.Not.Null);
            Assert.IsInstanceOf(typeof(DomainObjectSecurityStrategyDecorator), objectSecurityStrategy);
            DomainObjectSecurityStrategyDecorator domainObjectSecurityStrategyDecorator = (DomainObjectSecurityStrategyDecorator)objectSecurityStrategy;

            Assert.That(domainObjectSecurityStrategyDecorator.RequiredSecurityForStates, Is.EqualTo(RequiredSecurityForStates.None));
        }
Exemplo n.º 4
0
        public void GetSecurityStrategy()
        {
            OrganizationalStructureTestHelper testHelper = new OrganizationalStructureTestHelper();

            using (testHelper.Transaction.EnterNonDiscardingScope())
            {
                ISecurableObject position = testHelper.CreatePosition("PositionName");

                IObjectSecurityStrategy objectSecurityStrategy = position.GetSecurityStrategy();
                Assert.That(objectSecurityStrategy, Is.Not.Null);
                Assert.IsInstanceOf(typeof(DomainObjectSecurityStrategyDecorator), objectSecurityStrategy);
                DomainObjectSecurityStrategyDecorator domainObjectSecurityStrategyDecorator = (DomainObjectSecurityStrategyDecorator)objectSecurityStrategy;
                Assert.That(domainObjectSecurityStrategyDecorator.RequiredSecurityForStates, Is.EqualTo(RequiredSecurityForStates.None));
            }
        }
Exemplo n.º 5
0
        public virtual bool HasAccess(ISecurableObject securableObject, ISecurityPrincipal principal, IReadOnlyList <AccessType> requiredAccessTypes)
        {
            ArgumentUtility.CheckNotNull("securableObject", securableObject);
            ArgumentUtility.CheckNotNull("principal", principal);
            ArgumentUtility.CheckNotNull("requiredAccessTypes", requiredAccessTypes);

            if (SecurityFreeSection.IsActive)
            {
                return(true);
            }

            var objectSecurityStrategy = securableObject.GetSecurityStrategy();

            Assertion.DebugIsNotNull(objectSecurityStrategy, "The securableObject did not return an IObjectSecurityStrategy.");

            return(objectSecurityStrategy.HasAccess(_securityProvider, principal, requiredAccessTypes));
        }
Exemplo n.º 6
0
        public void GetSecurityStrategy_SameTwice()
        {
            ISecurableObject tenant = TestHelper.CreateTenant("Tenant", "UID: Tenant");

            Assert.That(tenant.GetSecurityStrategy(), Is.SameAs(tenant.GetSecurityStrategy()));
        }
Exemplo n.º 7
0
        public void GetSecurityStrategy_SameTwice()
        {
            ISecurableObject user = CreateUser();

            Assert.That(user.GetSecurityStrategy(), Is.SameAs(user.GetSecurityStrategy()));
        }