mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 16:57:09 +00:00
Allow users to hand out admin rights.
This commit is contained in:
@@ -106,6 +106,8 @@ class UserController extends Controller
|
||||
|
||||
$subTitle = (string) trans('firefly.edit_user', ['email' => $user->email]);
|
||||
$subTitleIcon = 'fa-user-o';
|
||||
$currentUser = auth()->user();
|
||||
$isAdmin = $this->repository->hasRole($user, 'owner');
|
||||
$codes = [
|
||||
'' => (string) trans('firefly.no_block_code'),
|
||||
'bounced' => (string) trans('firefly.block_code_bounced'),
|
||||
@@ -113,7 +115,7 @@ class UserController extends Controller
|
||||
'email_changed' => (string) trans('firefly.block_code_email_changed'),
|
||||
];
|
||||
|
||||
return view('admin.users.edit', compact('user', 'subTitle', 'subTitleIcon', 'codes'));
|
||||
return view('admin.users.edit', compact('user', 'subTitle', 'subTitleIcon', 'codes', 'currentUser','isAdmin'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,6 +185,13 @@ class UserController extends Controller
|
||||
if ('' !== $data['password']) {
|
||||
$this->repository->changePassword($user, $data['password']);
|
||||
}
|
||||
if (true === $data['is_owner']) {
|
||||
$this->repository->attachRole($user, 'owner');
|
||||
session()->flash('info', trans('firefly.give_admin_careful'));
|
||||
}
|
||||
if (false === $data['is_owner']) {
|
||||
$this->repository->removeRole($user, 'owner');
|
||||
}
|
||||
|
||||
$this->repository->changeStatus($user, $data['blocked'], $data['blocked_code']);
|
||||
$this->repository->updateEmail($user, $data['email']);
|
||||
|
Reference in New Issue
Block a user