Skip to content

A free open source IT asset/license management system

Allow super admins to override company

snipe1f0737cfb777
diff --git a/app/Models/Company.php b/app/Models/Company.php
index 570a1b85b5..28610767c9 100644
--- a/app/Models/Company.php
+++ b/app/Models/Company.php
@@ -86,11 +86,17 @@ final class Company extends Model
} else {
$current_user = Auth::user();
- if ($current_user->company_id != null) {
- return $current_user->company_id;
- } else {
+ // Super users should be able to set a company to whatever they need
+ if ($current_user->isSuperUser()) {
return static::getIdFromInput($unescaped_input);
+ } else {
+ if ($current_user->company_id != null) {
+ return $current_user->company_id;
+ } else {
+ return static::getIdFromInput($unescaped_input);
+ }
}
+
}
}