Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: show first 20 users only in admin view

Andras Bacsaib6d129a5c196
diff --git a/app/Livewire/Team/AdminView.php b/app/Livewire/Team/AdminView.php
index 12546ff1b5..97bc6c04fa 100644
--- a/app/Livewire/Team/AdminView.php
+++ b/app/Livewire/Team/AdminView.php
@@ -10,6 +10,8 @@ class AdminView extends Component
{
public $users;
public ?string $search = "";
+ public bool $lots_of_users = false;
+ private $number_of_users_to_show = 20;
public function mount()
{
if (!isInstanceAdmin()) {
@@ -32,8 +34,14 @@ class AdminView extends Component
}
public function getUsers()
{
- $this->users = User::where('id', '!=', auth()->id())->get();
- // $this->users = User::all();
+ $users = User::where('id', '!=', auth()->id())->get();
+ if ($users->count() > $this->number_of_users_to_show) {
+ $this->lots_of_users = true;
+ $this->users = $users->take($this->number_of_users_to_show);
+ } else {
+ $this->lots_of_users = false;
+ $this->users = $users;
+ }
}
private function finalizeDeletion(User $user, Team $team)
{
@@ -59,6 +67,9 @@ class AdminView extends Component
}
public function delete($id)
{
+ if (!auth()->user()->isInstanceAdmin()) {
+ return $this->dispatch('error', 'You are not authorized to delete users');
+ }
$user = User::find($id);
$teams = $user->teams;
foreach ($teams as $team) {
diff --git a/resources/views/livewire/team/admin-view.blade.php b/resources/views/livewire/team/admin-view.blade.php
index ae9258603e..7960483941 100644
--- a/resources/views/livewire/team/admin-view.blade.php
+++ b/resources/views/livewire/team/admin-view.blade.php
@@ -25,5 +25,8 @@
@empty
<div>No users found other than the root.</div>
@endforelse
+ @if ($lots_of_users)
+ <div>There are more users than shown. Please use the search bar to find the user you are looking for.</div>
+ @endif
</div>
</div>