예제 #1
0
        public IEnumerable <string> AnonymousPermissions()
        {
            var result = new List <string>();
            var count  = 0;

            using (_databaseContextFactory.Create(_configuration.ProviderName, _configuration.ConnectionString))
            {
                count = _systemUserQuery.Count();
                result.AddRange(_systemRoleQuery.Permissions("Anonymous"));
            }

            if (count == 0)
            {
                result.Add(SystemPermissions.Manage.Users);
                result.Add(SystemPermissions.Register.UserRequired);
            }

            return(result);
        }
예제 #2
0
        public IEnumerable <string> AnonymousPermissions()
        {
            int count;
            var result = new List <string>();

            using (_databaseContextFactory.Create())
            {
                count = _systemUserQuery.Count();
            }

            result.AddRange(_systemRoleQuery.Permissions("Anonymous"));

            if (count == 0)
            {
                result.Add(SystemPermissions.States.UserRequired);
                result.Add(SystemPermissions.Register.User);
            }

            return(result);
        }
예제 #3
0
        public IActionResult PermissionStatus([FromBody] RolePermissionStatusModel model)
        {
            Guard.AgainstNull(model, nameof(model));

            List <string> permissions;

            using (_databaseContextFactory.Create())
            {
                permissions = _systemRoleQuery.Permissions(model.RoleId).ToList();
            }

            return(Ok(
                       new
            {
                Data = from permission in model.Permissions
                       select new
                {
                    Permission = permission,
                    Active = permissions.Find(item => item.Equals(permission)) != null
                }
            }));
        }