Exemplo n.º 1
0
        public async Task SaveAsync(SsoConfig config, Organization organization)
        {
            var now = DateTime.UtcNow;

            config.RevisionDate = now;
            if (config.Id == default)
            {
                config.CreationDate = now;
            }

            var useKeyConnector = config.GetData().KeyConnectorEnabled;

            if (useKeyConnector)
            {
                await VerifyDependenciesAsync(config, organization);
            }

            var oldConfig = await _ssoConfigRepository.GetByOrganizationIdAsync(config.OrganizationId);

            var disabledKeyConnector = oldConfig?.GetData()?.KeyConnectorEnabled == true && !useKeyConnector;

            if (disabledKeyConnector && await AnyOrgUserHasKeyConnectorEnabledAsync(config.OrganizationId))
            {
                throw new BadRequestException("Key Connector cannot be disabled at this moment.");
            }

            await LogEventsAsync(config, oldConfig);

            await _ssoConfigRepository.UpsertAsync(config);
        }
Exemplo n.º 2
0
        public async Task SaveAsync(SsoConfig config)
        {
            var now = DateTime.UtcNow;

            config.RevisionDate = now;
            if (config.Id == default)
            {
                config.CreationDate = now;
            }
            await _ssoConfigRepository.UpsertAsync(config);
        }