Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ REPORT_TIME_LIMIT=12000
API_THROTTLE_PER_MINUTE=120
CSV_ESCAPE_FORMULAS=true
LIVEWIRE_URL_PREFIX=null

MAX_UNPAGINATED=5000

# --------------------------------------------
# OPTIONAL: SAML SETTINGS
Expand Down
12 changes: 10 additions & 2 deletions app/Http/Controllers/GroupsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ public function create(Request $request) : View
return view('groups/edit', compact('permissions', 'selectedPermissions', 'groupPermissions'))
->with('group', $group)
->with('associated_users', [])
->with('unselected_users', $users);
->with('unselected_users', $users)
->with('all_users_count', $users->count())
;
}

/**
Expand Down Expand Up @@ -108,7 +110,13 @@ public function edit(Group $group) : View | RedirectResponse
// 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();

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);
}

/**
Expand Down
12 changes: 11 additions & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,5 +448,15 @@
*/

'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'),

];
1 change: 1 addition & 0 deletions resources/lang/en-US/admin/settings/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@
'redirect_url' => 'Redirect URL',
'client_secret' => 'Client Secret',
'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_format' => 'Username Format',
Expand Down
6 changes: 5 additions & 1 deletion resources/views/blade/form-legend-help.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
@props([
'icon' => null,
])

<!-- Form Legend Help Component -->
<p class="callout-subtext">
<x-icon type="tip" class="text-info" />
<x-icon type="{{ $icon ?? 'tip' }}" class="text-info" />
{!! $slot !!}
</p>
3 changes: 2 additions & 1 deletion resources/views/blade/form-legend.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@props([
'help_text' => null,
'icon' => null,
])
<!-- Form Legend Component -->
<legend class="callout callout-legend">
Expand All @@ -8,7 +9,7 @@
</h4>

@if ($help_text)
<x-form-legend-help>
<x-form-legend-help :icon="$icon">
{!! $help_text !!}
</x-form-legend-help>
@endif
Expand Down
10 changes: 8 additions & 2 deletions resources/views/groups/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,19 @@


<fieldset>
<x-form-legend help_text="{{ trans('general.add_users_to_group_help') }}">
{{ trans('general.add_users_to_group') }}
<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') }}
</x-form-legend>

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



<div class="form-group">
<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 -->
<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()) : '' }}"/>

Expand Down Expand Up @@ -95,9 +98,12 @@
</div>

</div>

</div>
</div>
</fieldset>
@endif


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