219 lines
7.2 KiB
Plaintext
219 lines
7.2 KiB
Plaintext
<%= render HeaderComponent.new(title: "User: #{@user.cn}") %>
|
|
|
|
<%= render MainSimpleComponent.new do %>
|
|
<div class="mb-12 sm:flex sm:flex-row sm:gap-x-8">
|
|
<section class="sm:flex-1">
|
|
<h3>Account</h3>
|
|
<table class="divided">
|
|
<tbody>
|
|
<tr>
|
|
<th>ID</th>
|
|
<td><%= @user.id %></td>
|
|
</tr>
|
|
<tr>
|
|
<th>Created at</th>
|
|
<td><%= @user.created_at.strftime("%Y-%m-%d (%H:%M UTC)") %></td>
|
|
</tr>
|
|
<tr>
|
|
<th>Confirmed at</th>
|
|
<td>
|
|
<% if @user.confirmed_at %>
|
|
<%= @user.confirmed_at.strftime("%Y-%m-%d (%H:%M UTC)") %>
|
|
<% else %>
|
|
<%= badge "pending", :yellow %>
|
|
<% end %>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>Email</th>
|
|
<td><%= @user.email %></td>
|
|
</tr>
|
|
<tr>
|
|
<th>Roles</th>
|
|
<td><%= @user.is_admin? ? badge("admin", :red) : "—" %></td>
|
|
</tr>
|
|
<tr>
|
|
<th>Invited by</th>
|
|
<td>
|
|
<% if @user.inviter %>
|
|
<%= link_to @user.inviter.address, admin_user_path(@user.inviter.address), class: 'ks-text-link' %>
|
|
<% else %>—<% end %>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>Invitations available</th>
|
|
<td data-controller="modal" data-action="keydown.esc->modal#close">
|
|
<div class="flex justify-between">
|
|
<span>
|
|
<%= @user.invitations.count %>
|
|
</span>
|
|
<span>
|
|
<button id="add-invitations" data-action="click->modal#open">
|
|
<%= render partial: "icons/plus-circle", locals: {
|
|
custom_class: "text-green-600 hover:text-green-500 -mt-2 -mb-1 h-6 w-6 inline-block"
|
|
} %>
|
|
</button>
|
|
<% if @user.invitations.unused.count > 0 %>
|
|
<%= link_to invitations_admin_user_path(@user.cn),
|
|
id: "remove-invitations", data: {
|
|
turbo_method: :delete,
|
|
turbo_confirm: "Delete all of #{@user.cn}'s available invitations?"
|
|
} do %>
|
|
<%= render partial: "icons/x-circle", locals: {
|
|
custom_class: "text-red-600 hover:text-red-500 -mt-2 -mb-1 h-6 w-6 inline-block"
|
|
} %>
|
|
<% end %>
|
|
<% end %>
|
|
</span>
|
|
</div>
|
|
<%= render ModalComponent.new(show_close_button: false) do %>
|
|
<%= render partial: "admin/users/create_invitations",
|
|
locals: { user: @user } %>
|
|
<% end %>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th class="align-top">Invited users</th>
|
|
<td class="align-top">
|
|
<% if @user.invitees.length > 0 %>
|
|
<ul class="mb-0">
|
|
<% @user.invitees.order(cn: :asc).each do |invitee| %>
|
|
<li class="leading-none mb-2 last:mb-0"><%= link_to invitee.address, admin_user_path(invitee.address), class: 'ks-text-link' %></li>
|
|
<% end %>
|
|
</ul>
|
|
<% else %>—<% end %>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
|
|
<section class="sm:flex-1 sm:pt-0">
|
|
<% if @avatar.present? %>
|
|
<h3>LDAP<h3>
|
|
<p>
|
|
<img src="data:image/jpeg;base64,<%= @avatar %>" class="h-48 w-48" />
|
|
</p>
|
|
<% end %>
|
|
<!-- <h3>Actions</h3> -->
|
|
</section>
|
|
</div>
|
|
|
|
<section>
|
|
<h3>Services</h3>
|
|
<table class="divided">
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>Enabled</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% if Setting.discourse_enabled %>
|
|
<tr>
|
|
<td>Discourse</td>
|
|
<td>
|
|
<%= render FormElements::ToggleComponent.new(
|
|
enabled: @services_enabled.include?("discourse"),
|
|
input_enabled: false
|
|
) %>
|
|
</td>
|
|
<td class="text-right">
|
|
<%= link_to "Open profile", "#{Setting.discourse_public_url}/u/#{@user.cn}/summary", class: "btn-sm btn-gray" %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
<% if Setting.gitea_enabled %>
|
|
<tr>
|
|
<td>Gitea</td>
|
|
<td>
|
|
<%= render FormElements::ToggleComponent.new(
|
|
enabled: @services_enabled.include?("gitea"),
|
|
input_enabled: false
|
|
) %>
|
|
</td>
|
|
<td class="text-right">
|
|
<%= link_to "Open profile", "#{Setting.gitea_public_url}/#{@user.cn}", class: "btn-sm btn-gray" %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
<% if Setting.mastodon_enabled %>
|
|
<tr>
|
|
<td>Mastodon</td>
|
|
<td>
|
|
<%= render FormElements::ToggleComponent.new(
|
|
enabled: @services_enabled.include?("mastodon"),
|
|
input_enabled: false
|
|
) %>
|
|
</td>
|
|
<td class="text-right">
|
|
<%= link_to "Open profile", "#{Setting.mastodon_public_url}/@#{@user.cn}", class: "btn-sm btn-gray" %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
<% if Setting.mediawiki_enabled %>
|
|
<tr>
|
|
<td>MediaWiki</td>
|
|
<td>
|
|
<%= render FormElements::ToggleComponent.new(
|
|
enabled: @services_enabled.include?("mediawiki"),
|
|
input_enabled: false
|
|
) %>
|
|
</td>
|
|
<td class="text-right">
|
|
<%= link_to "Open profile", "#{Setting.mediawiki_public_url}/Special:Contributions/#{@user.cn}", class: "btn-sm btn-gray" %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
<% if Setting.ejabberd_enabled %>
|
|
<tr>
|
|
<td>XMPP (ejabberd)</td>
|
|
<td>
|
|
<%= render FormElements::ToggleComponent.new(
|
|
enabled: @services_enabled.include?("xmpp"),
|
|
input_enabled: false
|
|
) %>
|
|
</td>
|
|
<td class="text-right">
|
|
<% if Setting.ejabberd_admin_url.present? %>
|
|
<%= link_to "Open profile", "#{Setting.ejabberd_admin_url}/server/#{@user.ou}/user/#{@user.cn}/", class: "btn-sm btn-gray" %>
|
|
<% end %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
</section>
|
|
|
|
<% if Setting.lndhub_admin_enabled? && @user.confirmed? %>
|
|
<section>
|
|
<h3>LndHub</h3>
|
|
<% if @lndhub_user %>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Account</th>
|
|
<th>Balance</th>
|
|
<th>Incoming</th>
|
|
<th>Outgoing</th>
|
|
<th>Fees</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td><%= @user.ln_account %></td>
|
|
<td><%= number_with_delimiter @lndhub_user.balance %> sats</td>
|
|
<td><%= number_with_delimiter @lndhub_user.sum_incoming %> sats</td>
|
|
<td><%= number_with_delimiter @lndhub_user.sum_outgoing %> sats</td>
|
|
<td><%= number_with_delimiter @lndhub_user.sum_fees %> sats</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
<% else %>
|
|
<p>No LndHub user found for account <strong class="font-mono"><%= @user.ln_account %></strong>.
|
|
<% end %>
|
|
</section>
|
|
<% end %>
|
|
<% end %>
|