public function setGlobalAccess($enable, $user = 'current')
    {
        $user = $this->getUser($user);
        if ($user === null) {
            throw new UserMessageException(t('Invalid user'));
        }
        if ($user->getUserID() === USER_SUPER_ID) {
            return;
        }
        $group = $this->groups->getGlobalAdministrators();
        if ($enable) {
            foreach ($this->app->make(LocaleRepository::class)->getApprovedLocales() as $locale) {
                $this->setLocaleAccess($locale, self::NONE, $user);
            }
            if (!$user->inGroup($group)) {
                $user->enterGroup($group);
            }
        } else {
            if ($user->inGroup($group)) {
                $user->exitGroup($group);
            }
        }
    }
public function setGlobalAccess($enable, $user = 'current')
    {
        $user = $this->getUser($user);
        if ($user === null) {
            throw new UserMessageException(t('Invalid user'));
        }
        if ($user->getUserID() === USER_SUPER_ID) {
            return;
        }
        $group = $this->groups->getGlobalAdministrators();
        if ($enable) {
            foreach ($this->app->make(LocaleRepository::class)->getApprovedLocales() as $locale) {
                $this->setLocaleAccess($locale, self::NONE, $user);
            }
            if (!$user->inGroup($group)) {
                $user->enterGroup($group);
            }
        } else {
            if ($user->inGroup($group)) {
                $user->exitGroup($group);
            }
        }
    }
public function setGlobalAccess ( $ enable , $ user = 'current' ) { $ user = $ this -> getUser ( $ user ) ; if ( $ user === null ) { throw new UserMessageException ( t ( 'Invalid user' ) ) ; } if ( $ user -> getUserID ( ) === USER_SUPER_ID ) { return ; } $ group = $ this -> groups -> getGlobalAdministrators ( ) ; if ( $ enable ) { foreach ( $ this -> app -> make ( LocaleRepository :: class ) -> getApprovedLocales ( ) as $ locale ) { $ this -> setLocaleAccess ( $ locale , self :: NONE , $ user ) ; } if ( ! $ user -> inGroup ( $ group ) ) { $ user -> enterGroup ( $ group ) ; } } else { if ( $ user -> inGroup ( $ group ) ) { $ user -> exitGroup ( $ group ) ; } } }
Set or unset global administration access.

@param bool $enable
@param UserService|int|'current' $user
Set or unset global administration access .