X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/380f0f2042cc9efb824e19ce16912135a77d541f..refs/pull/665/head:/app/User.php diff --git a/app/User.php b/app/User.php index afcd9af70..fd6879ba0 100644 --- a/app/User.php +++ b/app/User.php @@ -81,7 +81,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon */ public function hasSystemRole($role) { - return $this->roles->pluck('system_name')->contains('admin'); + return $this->roles->pluck('system_name')->contains($role); } /** @@ -165,7 +165,7 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon if ($imageId === 0 || $imageId === '0' || $imageId === null) return $default; try { - $avatar = baseUrl($this->avatar->getThumb($size, $size, false)); + $avatar = $this->avatar ? baseUrl($this->avatar->getThumb($size, $size, false)) : $default; } catch (\Exception $err) { $avatar = $default; }