From: Vincent Vanwaelscappel Date: Thu, 17 Aug 2023 12:53:51 +0000 (+0200) Subject: wait #6198 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=45e213087ed918c17e6b1e6e9e85f4534db659ac;p=cubedesigners_userdatabase.git wait #6198 @0.5 --- diff --git a/src/app/Models/User.php b/src/app/Models/User.php index ec0c020..e9ea5b4 100644 --- a/src/app/Models/User.php +++ b/src/app/Models/User.php @@ -180,6 +180,7 @@ class User extends CubistMagicAuthenticatable implements HasLocalePreference return $this->companyName; } $company = $this->companyName; + if (mb_strlen($company) > 30) { $company = '' . mb_substr($company, 0, 27) . '...'; } @@ -272,17 +273,23 @@ class User extends CubistMagicAuthenticatable implements HasLocalePreference public function isOwner($user) { + if ($user instanceof User) { + $company = $user->company; + $user = $user->id; + } else { + $company = Permissions::getCompanyByUser($user); + } if (null === $this->id) { return true; } if (null === $user) { return false; } - if ($user->company == 7 && !$this->can('loginascube')) { + if ($company == 7 && !$this->can('loginascube')) { return false; } /** @var $user self */ - return in_array($user->id, $this->getManagedUsers()); + return in_array($user, $this->getManagedUsers()); } public static function addOwnerClause(Builder $builder)