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 | ||||
|     ldap   = LdapService.new | ||||
|     @ou    = params[:ou] || Setting.primary_domain | ||||
|     @orgs  = ldap.fetch_organizations | ||||
|     @ou    = Setting.primary_domain | ||||
|     @pagy, @users = pagy(User.where(ou: @ou).order(cn: :asc)) | ||||
| 
 | ||||
|     @stats = { | ||||
| @ -27,8 +26,8 @@ class Admin::UsersController < Admin::BaseController | ||||
|   private | ||||
| 
 | ||||
|   def set_user | ||||
|     address = params[:address].split("@") | ||||
|     @user = User.where(cn: address.first, ou: address.last).first | ||||
|     @user = User.find_by(cn: params[:username], ou: Setting.primary_domain) | ||||
|     http_status :not_found unless @user | ||||
|   end | ||||
| 
 | ||||
|   def set_current_section | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| <%= render HeaderComponent.new(title: "Users: #{@ou}") %> | ||||
| <%= render HeaderComponent.new(title: "Users") %> | ||||
| 
 | ||||
| <%= render MainSimpleComponent.new do %> | ||||
|   <section> | ||||
| @ -16,19 +16,6 @@ | ||||
|     <% end %> | ||||
|   </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> | ||||
|     <table class="divided mb-8"> | ||||
|       <thead> | ||||
| @ -36,13 +23,12 @@ | ||||
|           <th>UID</th> | ||||
|           <th>Status</th> | ||||
|           <th>Roles</th> | ||||
|           <!-- <th>Password</th> --> | ||||
|         </tr> | ||||
|       </thead> | ||||
|       <tbody> | ||||
|         <% @users.each do |user| %> | ||||
|         <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.is_admin? ? badge("admin", :red) : "" %></td> | ||||
|         </tr> | ||||
|  | ||||
| @ -1,4 +1,4 @@ | ||||
| <%= render HeaderComponent.new(title: "User: #{@user.address}") %> | ||||
| <%= render HeaderComponent.new(title: "User: #{@user.cn}") %> | ||||
| 
 | ||||
| <%= render MainSimpleComponent.new do %> | ||||
|   <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 | ||||
|     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' | ||||
| 
 | ||||
|     resources :donations | ||||
| 
 | ||||
|     get 'lightning', to: 'lightning#index' | ||||
| 
 | ||||
|     namespace :app_catalog do | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user