diff --git a/app/controllers/console_redirect_controller.rb b/app/controllers/console_redirect_controller.rb
index 84fc0c89..d37cf08b 100644
--- a/app/controllers/console_redirect_controller.rb
+++ b/app/controllers/console_redirect_controller.rb
@@ -9,6 +9,8 @@ class ConsoleRedirectController < ApplicationController
params[:redir] = Docuseal.multitenant? ? "#{Docuseal::CONSOLE_URL}/plans" : "#{Docuseal::CONSOLE_URL}/on_premise"
end
+ params[:redir] = "#{Docuseal::CONSOLE_URL}/manage" if request.path == '/manage'
+
return redirect_to(new_user_session_path({ redir: params[:redir] }.compact)) if true_user.blank?
auth = JsonWebToken.encode(uuid: true_user.uuid,
diff --git a/app/views/users/_extra_buttons.html.erb b/app/views/users/_extra_buttons.html.erb
new file mode 100644
index 00000000..e69de29b
diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb
index 06e13425..7b441a64 100644
--- a/app/views/users/index.html.erb
+++ b/app/views/users/index.html.erb
@@ -5,9 +5,16 @@
<%= params[:status].to_s.titleize %> Users
<% if can?(:create, User.new(account: current_account)) %>
- <%= link_to new_user_path, class: 'btn btn-primary btn-md gap-2', data: { turbo_frame: 'modal' } do %>
- <%= svg_icon('plus', class: 'w-6 h-6') %>
- New User
+ <% if Docuseal.multitenant? %>
+ <%= render 'users/extra_buttons' %>
+ <% end %>
+ <% if content_for(:add_user_button) %>
+ <%= content_for(:add_user_button) %>
+ <% else %>
+ <%= link_to new_user_path, class: "btn btn-primary btn-md gap-2", data: { turbo_frame: 'modal' } do %>
+ <%= svg_icon('plus', class: 'w-6 h-6') %>
+ New User
+ <% end %>
<% end %>
<% end %>
diff --git a/config/routes.rb b/config/routes.rb
index 1b5be80d..454f93e8 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -55,6 +55,7 @@ Rails.application.routes.draw do
resources :submissions, only: %i[show destroy]
resources :console_redirect, only: %i[index]
resources :upgrade, only: %i[index], controller: 'console_redirect'
+ resources :manage, only: %i[index], controller: 'console_redirect'
resource :testing_account, only: %i[show destroy]
resources :testing_api_settings, only: %i[index]
resources :submitters_autocomplete, only: %i[index]
diff --git a/lib/accounts.rb b/lib/accounts.rb
index b9943688..93d4cc61 100644
--- a/lib/accounts.rb
+++ b/lib/accounts.rb
@@ -31,6 +31,17 @@ module Accounts
new_account
end
+ def users_count(account)
+ rel = User.where(account_id: account.id).or(
+ User.where(account_id: account.account_linked_accounts
+ .where.not(account_type: :testing)
+ .select(:linked_account_id))
+ )
+
+ rel.where.not(account: account.linked_accounts.where.not(archived_at: nil))
+ .where.not(role: :integration).active.count
+ end
+
def find_or_create_testing_user(account)
user = User.where(role: :admin).order(:id).find_by(account: account.testing_accounts)