Beispiel #1
0
        public async Task <ActionResult <GetResult> > Get()
        {
            if (!await _authManager.HasAppPermissionsAsync(Types.AppPermissions.SettingsUsersStyle))
            {
                return(Unauthorized());
            }

            var allAttributes = _userRepository.TableColumns.Select(x => x.AttributeName).ToList();

            var styles = new List <InputStyle>();

            foreach (var style in await _tableStyleRepository.GetUserStylesAsync())
            {
                styles.Add(new InputStyle
                {
                    Id            = style.Id,
                    AttributeName = style.AttributeName,
                    DisplayName   = style.DisplayName,
                    InputType     = style.InputType,
                    Rules         = TranslateUtils.JsonDeserialize <List <InputStyleRule> >(style.RuleValues),
                    Taxis         = style.Taxis,
                    IsSystem      = ListUtils.ContainsIgnoreCase(allAttributes, style.AttributeName)
                });
            }

            return(new GetResult
            {
                Styles = styles,
                TableName = _userRepository.TableName,
                RelatedIdentities = _tableStyleRepository.EmptyRelatedIdentities
            });
        }
Beispiel #2
0
        public async Task <ActionResult <GetResult> > Get()
        {
            if (!await _authManager.HasAppPermissionsAsync(Types.AppPermissions.SettingsConfigsHome))
            {
                return(Unauthorized());
            }

            var config = await _configRepository.GetAsync();

            return(new GetResult
            {
                Config = config,
                Styles = await _tableStyleRepository.GetUserStylesAsync()
            });
        }
Beispiel #3
0
        public async Task <ActionResult <GetResult> > Get([FromQuery] int userId)
        {
            if (!await _authManager.HasAppPermissionsAsync(Types.AppPermissions.SettingsUsers))
            {
                return(Unauthorized());
            }

            var user = await _userRepository.GetByUserIdAsync(userId);

            var userStyles = await _tableStyleRepository.GetUserStylesAsync();

            var styles = userStyles.Select(x => new InputStyle(x));

            return(new GetResult
            {
                User = user,
                Styles = styles
            });
        }