Remove multi-domain support on admin user pages
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
refs #166
This commit is contained in:
parent
fcda3b9c8c
commit
8747ce4eb0
@ -4,8 +4,7 @@ class Admin::UsersController < Admin::BaseController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
ldap = LdapService.new
|
ldap = LdapService.new
|
||||||
@ou = params[:ou] || Setting.primary_domain
|
@ou = Setting.primary_domain
|
||||||
@orgs = ldap.fetch_organizations
|
|
||||||
@pagy, @users = pagy(User.where(ou: @ou).order(cn: :asc))
|
@pagy, @users = pagy(User.where(ou: @ou).order(cn: :asc))
|
||||||
|
|
||||||
@stats = {
|
@stats = {
|
||||||
@ -27,8 +26,8 @@ class Admin::UsersController < Admin::BaseController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def set_user
|
def set_user
|
||||||
address = params[:address].split("@")
|
@user = User.find_by(cn: params[:username], ou: Setting.primary_domain)
|
||||||
@user = User.where(cn: address.first, ou: address.last).first
|
http_status :not_found unless @user
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_current_section
|
def set_current_section
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<%= render HeaderComponent.new(title: "Users: #{@ou}") %>
|
<%= render HeaderComponent.new(title: "Users") %>
|
||||||
|
|
||||||
<%= render MainSimpleComponent.new do %>
|
<%= render MainSimpleComponent.new do %>
|
||||||
<section>
|
<section>
|
||||||
@ -16,19 +16,6 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<% if @orgs.length > 1 %>
|
|
||||||
<section>
|
|
||||||
<h3 class="hidden">Domains</h3>
|
|
||||||
<ul>
|
|
||||||
<% @orgs.each do |org| %>
|
|
||||||
<li class="inline-block">
|
|
||||||
<%= link_to org[:ou], admin_users_path(ou: org[:ou]), class: "ks-text-link" %>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
</section>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<table class="divided mb-8">
|
<table class="divided mb-8">
|
||||||
<thead>
|
<thead>
|
||||||
@ -36,13 +23,12 @@
|
|||||||
<th>UID</th>
|
<th>UID</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Roles</th>
|
<th>Roles</th>
|
||||||
<!-- <th>Password</th> -->
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @users.each do |user| %>
|
<% @users.each do |user| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= link_to(user.cn, admin_user_path(user.address), class: 'ks-text-link') %></td>
|
<td><%= link_to(user.cn, admin_user_path(user.cn), class: 'ks-text-link') %></td>
|
||||||
<td><%= user.confirmed_at.nil? ? badge("pending", :yellow) : "" %></td>
|
<td><%= user.confirmed_at.nil? ? badge("pending", :yellow) : "" %></td>
|
||||||
<td><%= user.is_admin? ? badge("admin", :red) : "" %></td>
|
<td><%= user.is_admin? ? badge("admin", :red) : "" %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<%= render HeaderComponent.new(title: "User: #{@user.address}") %>
|
<%= render HeaderComponent.new(title: "User: #{@user.cn}") %>
|
||||||
|
|
||||||
<%= render MainSimpleComponent.new do %>
|
<%= render MainSimpleComponent.new do %>
|
||||||
<div class="mb-12 sm:flex sm:flex-row sm:gap-x-8">
|
<div class="mb-12 sm:flex sm:flex-row sm:gap-x-8">
|
||||||
|
@ -73,9 +73,14 @@ Rails.application.routes.draw do
|
|||||||
namespace :admin do
|
namespace :admin do
|
||||||
root to: 'dashboard#index'
|
root to: 'dashboard#index'
|
||||||
|
|
||||||
resources 'users', param: 'address', only: ['index', 'show'], constraints: { address: /.*/ }
|
resources 'users', param: 'username', only: ['index', 'show'] do
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
get 'invitations', to: 'invitations#index'
|
get 'invitations', to: 'invitations#index'
|
||||||
|
|
||||||
resources :donations
|
resources :donations
|
||||||
|
|
||||||
get 'lightning', to: 'lightning#index'
|
get 'lightning', to: 'lightning#index'
|
||||||
|
|
||||||
namespace :app_catalog do
|
namespace :app_catalog do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user