Set a limit on number of users for group user loading
This commit is contained in:
@@ -197,7 +197,7 @@ REPORT_TIME_LIMIT=12000
|
|||||||
API_THROTTLE_PER_MINUTE=120
|
API_THROTTLE_PER_MINUTE=120
|
||||||
CSV_ESCAPE_FORMULAS=true
|
CSV_ESCAPE_FORMULAS=true
|
||||||
LIVEWIRE_URL_PREFIX=null
|
LIVEWIRE_URL_PREFIX=null
|
||||||
|
MAX_UNPAGINATED=5000
|
||||||
|
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
# OPTIONAL: SAML SETTINGS
|
# OPTIONAL: SAML SETTINGS
|
||||||
|
|||||||
@@ -48,7 +48,9 @@ class GroupsController extends Controller
|
|||||||
return view('groups/edit', compact('permissions', 'selectedPermissions', 'groupPermissions'))
|
return view('groups/edit', compact('permissions', 'selectedPermissions', 'groupPermissions'))
|
||||||
->with('group', $group)
|
->with('group', $group)
|
||||||
->with('associated_users', [])
|
->with('associated_users', [])
|
||||||
->with('unselected_users', $users);
|
->with('unselected_users', $users)
|
||||||
|
->with('all_users_count', $users->count())
|
||||||
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -108,7 +110,13 @@ class GroupsController extends Controller
|
|||||||
// Get the unselected users
|
// Get the unselected users
|
||||||
$unselected_users = \App\Models\User::whereNotIn('id', $associated_users->pluck('id')->toArray())->orderBy('first_name', 'asc')->orderBy('last_name', 'asc')->get();
|
$unselected_users = \App\Models\User::whereNotIn('id', $associated_users->pluck('id')->toArray())->orderBy('first_name', 'asc')->orderBy('last_name', 'asc')->get();
|
||||||
|
|
||||||
return view('groups.edit', compact('group', 'permissions', 'selected_array', 'groupPermissions'))->with('associated_users', $associated_users)->with('unselected_users', $unselected_users);
|
// We need the total to see whether or not we should show the user selection box :(
|
||||||
|
$all_users_count = $associated_users->count() + $unselected_users->count();
|
||||||
|
|
||||||
|
return view('groups.edit', compact('group', 'permissions', 'selected_array', 'groupPermissions'))
|
||||||
|
->with('associated_users', $associated_users)
|
||||||
|
->with('unselected_users', $unselected_users)
|
||||||
|
->with('all_users_count', $all_users_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -449,4 +449,14 @@ return [
|
|||||||
|
|
||||||
'escape_formulas' => env('CSV_ESCAPE_FORMULAS', true),
|
'escape_formulas' => env('CSV_ESCAPE_FORMULAS', true),
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Max Unpaginated Records
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| This sets the maximum number of records that can be exported or
|
||||||
|
| viewed without pagination. This is to prevent server timeouts.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'max_unpaginated_records' => env('MAX_UNPAGINATED', '5000'),
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -423,6 +423,7 @@ return [
|
|||||||
'redirect_url' => 'Redirect URL',
|
'redirect_url' => 'Redirect URL',
|
||||||
'client_secret' => 'Client Secret',
|
'client_secret' => 'Client Secret',
|
||||||
'client_id' => 'Client ID',
|
'client_id' => 'Client ID',
|
||||||
|
'too_many_users_to_show' => 'The number of users (:count) is larger than the unpaginated record limit (:max). Use the bulk user edit tool to manage group memberships.',
|
||||||
|
|
||||||
'username_formats' => [
|
'username_formats' => [
|
||||||
'username_format' => 'Username Format',
|
'username_format' => 'Username Format',
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
|
@props([
|
||||||
|
'icon' => null,
|
||||||
|
])
|
||||||
|
|
||||||
<!-- Form Legend Help Component -->
|
<!-- Form Legend Help Component -->
|
||||||
<p class="callout-subtext">
|
<p class="callout-subtext">
|
||||||
<x-icon type="tip" class="text-info" />
|
<x-icon type="{{ $icon ?? 'tip' }}" class="text-info" />
|
||||||
{!! $slot !!}
|
{!! $slot !!}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
@props([
|
@props([
|
||||||
'help_text' => null,
|
'help_text' => null,
|
||||||
|
'icon' => null,
|
||||||
])
|
])
|
||||||
<!-- Form Legend Component -->
|
<!-- Form Legend Component -->
|
||||||
<legend class="callout callout-legend">
|
<legend class="callout callout-legend">
|
||||||
@@ -8,7 +9,7 @@
|
|||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
@if ($help_text)
|
@if ($help_text)
|
||||||
<x-form-legend-help>
|
<x-form-legend-help :icon="$icon">
|
||||||
{!! $help_text !!}
|
{!! $help_text !!}
|
||||||
</x-form-legend-help>
|
</x-form-legend-help>
|
||||||
@endif
|
@endif
|
||||||
|
|||||||
@@ -41,16 +41,19 @@
|
|||||||
|
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<x-form-legend help_text="{{ trans('general.add_users_to_group_help') }}">
|
<x-form-legend icon="warning" help_text="{{ (isset($all_users_count) && ($all_users_count < config('app.max_unpaginated_records'))) ? trans('general.add_users_to_group_help') : trans('admin/settings/general.too_many_users_to_show', ['count'=> $all_users_count, 'max' => config('app.max_unpaginated_records')]) }}">
|
||||||
{{ trans('general.add_users_to_group') }}
|
{{ trans('general.add_users_to_group') }}
|
||||||
</x-form-legend>
|
</x-form-legend>
|
||||||
|
|
||||||
<!-- this is a temp fix for the select2 not working inside modals -->
|
<!-- this is a temp fix for the select2 not working inside modals -->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
|
|
||||||
|
@if(($all_users_count ) && ($all_users_count < config('app.max_unpaginated_records')))
|
||||||
|
|
||||||
<!-- This hidden input will store the selected user IDs as a comma-separated string to avoid max_input_vars and max_multipart_body_parts php.ini issues -->
|
<!-- This hidden input will store the selected user IDs as a comma-separated string to avoid max_input_vars and max_multipart_body_parts php.ini issues -->
|
||||||
<input type="hidden" name="users_to_sync" id="hidden_ids_box" class="form-control" value="{{ ($associated_users && is_array($associated_users)) ? implode(",", $associated_users->pluck('id')->toArray()) : '' }}"/>
|
<input type="hidden" name="users_to_sync" id="hidden_ids_box" class="form-control" value="{{ ($associated_users && is_array($associated_users)) ? implode(",", $associated_users->pluck('id')->toArray()) : '' }}"/>
|
||||||
|
|
||||||
@@ -95,9 +98,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
@endif
|
||||||
|
|
||||||
|
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
@include ('partials.forms.edit.permissions-base', ['use_inherit' => false])
|
@include ('partials.forms.edit.permissions-base', ['use_inherit' => false])
|
||||||
|
|||||||
Reference in New Issue
Block a user