private async Task <bool> HasPermission(string userId, string module, string controller, string action)
        {
            var userPermissions = await securityRepository.GetUserPermissions(userId).ConfigureAwait(false);

            if (!userPermissions.Any())
            {
                return(false);
            }

            if (module.IsNotNullOrEmpty())
            {
                //permission to full module
                var hasModulePermission = userPermissions.Any(p => p.Domain == module && p.Resource == $"{module}/*");

                if (hasModulePermission)
                {
                    return(true);
                }
            }

            //permission to full controller
            var hasControllerPermission = userPermissions.Any(p => p.Resource == $"{controller}/*");

            if (hasControllerPermission)
            {
                return(true);
            }


            //permission to specific action
            var hasActionPermission = userPermissions.Any(p => p.Resource == $"{controller}/{action}");

            return(hasActionPermission);
        }