|
|
@ -9,13 +9,13 @@ class UsersController < ApplicationController |
|
|
|
def index |
|
|
|
def index |
|
|
|
redirect_to users_organisation_path(current_user.organisation) unless current_user.support? |
|
|
|
redirect_to users_organisation_path(current_user.organisation) unless current_user.support? |
|
|
|
|
|
|
|
|
|
|
|
@pagy, @users = pagy(User.all.where(active: true)) |
|
|
|
@pagy, @users = pagy(User.all.where(active: true).includes(:organisation)) |
|
|
|
|
|
|
|
|
|
|
|
respond_to do |format| |
|
|
|
respond_to do |format| |
|
|
|
format.html |
|
|
|
format.html |
|
|
|
format.csv do |
|
|
|
format.csv do |
|
|
|
if current_user.support? |
|
|
|
if current_user.support? |
|
|
|
send_data User.all.where(active: true).to_csv, filename: "users-#{Time.zone.now}.csv" |
|
|
|
send_data User.all.where(active: true).includes(:organisation).to_csv, filename: "users-#{Time.zone.now}.csv" |
|
|
|
else |
|
|
|
else |
|
|
|
head :unauthorized |
|
|
|
head :unauthorized |
|
|
|
end |
|
|
|
end |
|
|
|