Skip to content

Commit d3c9963

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents bc5da25 + 92a3bdf commit d3c9963

File tree

7 files changed

+38
-8
lines changed

7 files changed

+38
-8
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ REPORT_TIME_LIMIT=12000
197197
API_THROTTLE_PER_MINUTE=120
198198
CSV_ESCAPE_FORMULAS=true
199199
LIVEWIRE_URL_PREFIX=null
200-
200+
MAX_UNPAGINATED=5000
201201

202202
# --------------------------------------------
203203
# OPTIONAL: SAML SETTINGS

app/Http/Controllers/GroupsController.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ public function create(Request $request) : View
4848
return view('groups/edit', compact('permissions', 'selectedPermissions', 'groupPermissions'))
4949
->with('group', $group)
5050
->with('associated_users', [])
51-
->with('unselected_users', $users);
51+
->with('unselected_users', $users)
52+
->with('all_users_count', $users->count())
53+
;
5254
}
5355

5456
/**
@@ -108,7 +110,13 @@ public function edit(Group $group) : View | RedirectResponse
108110
// Get the unselected users
109111
$unselected_users = \App\Models\User::whereNotIn('id', $associated_users->pluck('id')->toArray())->orderBy('first_name', 'asc')->orderBy('last_name', 'asc')->get();
110112

111-
return view('groups.edit', compact('group', 'permissions', 'selected_array', 'groupPermissions'))->with('associated_users', $associated_users)->with('unselected_users', $unselected_users);
113+
// We need the total to see whether or not we should show the user selection box :(
114+
$all_users_count = $associated_users->count() + $unselected_users->count();
115+
116+
return view('groups.edit', compact('group', 'permissions', 'selected_array', 'groupPermissions'))
117+
->with('associated_users', $associated_users)
118+
->with('unselected_users', $unselected_users)
119+
->with('all_users_count', $all_users_count);
112120
}
113121

114122
/**

config/app.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,5 +448,15 @@
448448
*/
449449

450450
'escape_formulas' => env('CSV_ESCAPE_FORMULAS', true),
451-
451+
452+
/*
453+
|--------------------------------------------------------------------------
454+
| Max Unpaginated Records
455+
|--------------------------------------------------------------------------
456+
| This sets the maximum number of records that can be exported or
457+
| viewed without pagination. This is to prevent server timeouts.
458+
*/
459+
460+
'max_unpaginated_records' => env('MAX_UNPAGINATED', '5000'),
461+
452462
];

resources/lang/en-US/admin/settings/general.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@
423423
'redirect_url' => 'Redirect URL',
424424
'client_secret' => 'Client Secret',
425425
'client_id' => 'Client ID',
426+
'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.',
426427

427428
'username_formats' => [
428429
'username_format' => 'Username Format',
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
@props([
2+
'icon' => null,
3+
])
4+
15
<!-- Form Legend Help Component -->
26
<p class="callout-subtext">
3-
<x-icon type="tip" class="text-info" />
7+
<x-icon type="{{ $icon ?? 'tip' }}" class="text-info" />
48
{!! $slot !!}
59
</p>

resources/views/blade/form-legend.blade.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@props([
22
'help_text' => null,
3+
'icon' => null,
34
])
45
<!-- Form Legend Component -->
56
<legend class="callout callout-legend">
@@ -8,7 +9,7 @@
89
</h4>
910

1011
@if ($help_text)
11-
<x-form-legend-help>
12+
<x-form-legend-help :icon="$icon">
1213
{!! $help_text !!}
1314
</x-form-legend-help>
1415
@endif

resources/views/groups/edit.blade.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,19 @@
4141

4242

4343
<fieldset>
44-
<x-form-legend help_text="{{ trans('general.add_users_to_group_help') }}">
45-
{{ trans('general.add_users_to_group') }}
44+
<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')]) }}">
45+
{{ trans('general.add_users_to_group') }}
4646
</x-form-legend>
4747

4848
<!-- this is a temp fix for the select2 not working inside modals -->
4949

5050

51+
5152
<div class="form-group">
5253
<div class="col-md-12">
5354

55+
@if(($all_users_count ) && ($all_users_count < config('app.max_unpaginated_records')))
56+
5457
<!-- 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 -->
5558
<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()) : '' }}"/>
5659

@@ -95,9 +98,12 @@
9598
</div>
9699

97100
</div>
101+
98102
</div>
99103
</div>
100104
</fieldset>
105+
@endif
106+
101107

102108
<div class="col-md-12">
103109
@include ('partials.forms.edit.permissions-base', ['use_inherit' => false])

0 commit comments

Comments
 (0)