From 52c48853359a4f2826e296c2e855416b8abfc3d4 Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 24 Jun 2024 14:02:17 +0100 Subject: [PATCH] Added method for checking if the user can edit their own profile Signed-off-by: snipe --- app/Models/User.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/Models/User.php b/app/Models/User.php index 22291cd9cd..30e32061ed 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -204,6 +204,23 @@ class User extends SnipeModel implements AuthenticatableContract, AuthorizableCo return $this->checkPermissionSection('superuser'); } + + /** + * Checks if the can edit their own profile + * + * @author A. Gianotto + * @since [v6.3.4] + * @return bool + */ + public function canEditProfile() : bool { + + $setting = Setting::getSettings(); + if ($setting->profile_edit == 1) { + return true; + } + return false; + } + /** * Checks if the user is deletable *