Mercurial Hosting > hghosting
diff src/private/tools/all_users.html.luan @ 4:028e74c8889d
add all_users
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 12 May 2022 16:54:11 -0600 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/private/tools/all_users.html.luan Thu May 12 16:54:11 2022 -0600 @@ -0,0 +1,52 @@ +local Luan = require "luan:Luan.luan" +local error = Luan.error +local pairs = Luan.pairs or error() +local ipairs = Luan.ipairs or error() +local Io = require "luan:Io.luan" +local Http = require "luan:http/Http.luan" +local Shared = require "site:/lib/Shared.luan" +local head = Shared.head or error() +local header = Shared.private_header or error() +local config = Shared.config or error() +local user_repos = Shared.user_repos or error() + + +return function() + Io.stdout = Http.response.text_writer() +%> +<!doctype html> +<html> + <head> +<% head() %> + <title>Mercurial All Users</title> + <script> + function deleteUser(name) { + if( confirm('Are you sure that you want to delete user "'+name+'"?') ) + location = "delete_user.html?user="+name; + } + </script> + </head> + <body> +<% header() %> + <div content> + <h1>All Users</h1> +<% for user in pairs(config.users) do %> + <p> + <%=user%> +<% local repos = user_repos[user] + if repos == nil then %> + [] <a href="javascript:deleteUser('<%=user%>')">delete user</a> +<% else %> + [ +<% for _, repo in ipairs(repos) do %> + <a href="/repo/<%=repo.name%>/"><%=repo.name%></a> +<% end %> + ] +<% end %> + </p> +<% end %> + </div> + </body> +</html> +<% +end