Exemplo n.º 1
0
        public DomainObjectSecurityStrategyDecorator(
            IObjectSecurityStrategy innerStrategy,
            IDomainObjectSecurityContextFactory securityContextFactory,
            RequiredSecurityForStates requiredSecurityForStates)
        {
            ArgumentUtility.CheckNotNull("innerStrategy", innerStrategy);
            ArgumentUtility.CheckNotNull("securityContextFactory", securityContextFactory);

            _innerStrategy             = innerStrategy;
            _securityContextFactory    = securityContextFactory;
            _requiredSecurityForStates = requiredSecurityForStates;
        }
Exemplo n.º 2
0
        public void DomainObjectSecurityContextFactoryImplementation()
        {
            Tenant tenant = TestHelper.CreateTenant("Tenant", "UID: Tenant");
            IDomainObjectSecurityContextFactory factory = tenant;

            Assert.That(factory.IsInvalid, Is.False);
            Assert.That(factory.IsNew, Is.True);
            Assert.That(factory.IsDeleted, Is.False);

            tenant.Delete();

            Assert.That(factory.IsInvalid, Is.True);
        }
Exemplo n.º 3
0
        public override void SetUp()
        {
            base.SetUp();

            _mocks = new MockRepository();
            _mockObjectSecurityStrategy = _mocks.StrictMock <IObjectSecurityStrategy>();
            _stubSecurityProvider       = _mocks.StrictMock <ISecurityProvider>();
            _stubContextFactory         = _mocks.StrictMock <IDomainObjectSecurityContextFactory>();

            _stubUser = _mocks.Stub <ISecurityPrincipal>();
            SetupResult.For(_stubUser.User).Return("user");
            _accessTypeResult = new[] { AccessType.Get(GeneralAccessTypes.Read), AccessType.Get(GeneralAccessTypes.Edit) };
        }
Exemplo n.º 4
0
        public void DomainObjectSecurityContextFactoryImplementation()
        {
            Group group = CreateGroup();
            IDomainObjectSecurityContextFactory factory = group;

            Assert.That(factory.IsInvalid, Is.False);
            Assert.That(factory.IsNew, Is.True);
            Assert.That(factory.IsDeleted, Is.False);

            group.Delete();

            Assert.That(factory.IsInvalid, Is.True);
        }
Exemplo n.º 5
0
        public void DomainObjectSecurityContextFactoryImplementation()
        {
            User user = CreateUser();
            IDomainObjectSecurityContextFactory factory = user;

            Assert.That(factory.IsInvalid, Is.False);
            Assert.That(factory.IsNew, Is.True);
            Assert.That(factory.IsDeleted, Is.False);

            user.Delete();

            Assert.That(factory.IsInvalid, Is.True);
        }
Exemplo n.º 6
0
        public void DomainObjectSecurityContextFactoryImplementation()
        {
            OrganizationalStructureTestHelper testHelper = new OrganizationalStructureTestHelper();

            using (testHelper.Transaction.EnterNonDiscardingScope())
            {
                Position position = testHelper.CreatePosition("PositionName");
                IDomainObjectSecurityContextFactory factory = position;

                Assert.That(factory.IsInvalid, Is.False);
                Assert.That(factory.IsNew, Is.True);
                Assert.That(factory.IsDeleted, Is.False);

                position.Delete();

                Assert.That(factory.IsInvalid, Is.True);
            }
        }
Exemplo n.º 7
0
 private DomainObjectSecurityStrategy(
     RequiredSecurityForStates requiredSecurityForStates,
     IDomainObjectSecurityContextFactory securityContextFactory)
 {
 }