Skip to content

Commit

Permalink
Update Helper.php
Browse files Browse the repository at this point in the history
add extend method
  • Loading branch information
priscillay-toast authored Oct 30, 2023
1 parent df879ad commit 8bb496c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Helpers/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,18 @@ class Helper
{
static function isSuperAdmin()
{
if ($defaultUser = Environment::getEnv('SS_DEFAULT_ADMIN_USERNAME')) {
if ($defaultUser = Environment::getEnv('SS_DEFAULT_ADMIN_USERNAME')) {
if ($currentUser = Security::getCurrentUser()) {
$allowed = false;
// all toast email owner is a superadmin
return $currentUser->Email == $defaultUser || strstr($currentUser->Email, '@toast.co.nz');
if($currentUser->Email == $defaultUser || strstr($currentUser->Email, '@toast.co.nz')){
$allowed = true;
}

// extend this method
$currentUser->extend('updateSuperAdmin', $allowed);

return $allowed;
}
}
return false;
Expand Down

0 comments on commit 8bb496c

Please sign in to comment.