public string GetAuthorizationScript() { var allPermission = _permissionManager.GetAllPermissions().Select(p => p.Name).ToList(); var grantedPermissions = AbpSession.UserId.HasValue ? _permissionManager.GetGrantedPermissions(AbpSession.UserId.Value).Select(p => p.Name).ToArray() : new string[0]; var script = new StringBuilder(); script.AppendLine("(function(){"); script.AppendLine(); script.AppendLine(" abp.auth = abp.auth || {};"); script.AppendLine(); AppendPermissionList(script, "allPermissions", allPermission); script.AppendLine(); AppendPermissionList(script, "grantedPermissions", grantedPermissions); script.AppendLine(); script.Append("})();"); return(script.ToString()); }