Пример #1
0
        public async Task <IEventPushResponse> PushCompanyWideEffectiveAuthorizationGrantedAsync(string targetCompanyId, ExternalId user, Permission permission, DateTime effectiveDate)
        {
            var effectiveAuthorization = new EffectiveAuthorization(targetCompanyId, user, permission);

            effectiveAuthorization.AddTargetCompany(targetCompanyId);

            return(await PushEffectiveAuthorizationGrantedAsync(effectiveAuthorization, effectiveDate));
        }
Пример #2
0
        public IEventPushResponse PushCompanyWideEffectiveAuthorizationRevoked(string targetCompanyId, ExternalId user, Permission permission, DateTime effectiveDate)
        {
            var effectiveAuthorization = new EffectiveAuthorization(targetCompanyId, user, permission);

            effectiveAuthorization.AddTargetCompany(targetCompanyId);

            return(PushEffectiveAuthorizationRevoked(effectiveAuthorization, effectiveDate));
        }
        public void ExtensionMethod_AddTargetCompany_Adds_Target_With_Right_Company_Data()
        {
            //Arrange
            var user          = new ExternalId(_defaultContext, _defaultUserId1);
            var permission    = new Permission(_defaultIdentifier, _defaultApplication);
            var authorization = new EffectiveAuthorization(_defaultTenant, user, permission);

            //Assert
            authorization.AddTargetCompany(_defaultTenant);

            Assert.IsNotNull(authorization.Target);
            Assert.AreEqual(_companyContext, authorization.Target.Context);
            Assert.AreEqual(_defaultTenant, authorization.Target.Id);
        }