Check whether the given user has superuser access.

@param string $theUser A username.
@return bool
@api
519808
public static function hasTheUserSuperUserAccess($theUser)
    {
        if (empty($theUser)) {
            return false;
        }

        if (Piwik::getCurrentUserLogin() === $theUser && Piwik::hasUserSuperUserAccess()) {
            return true;
        }

        try {
            $superUsers = APIUsersManager::getInstance()->getUsersHavingSuperUserAccess();
        } catch (\Exception $e) {
            return false;
        }

        foreach ($superUsers as $superUser) {
            if ($theUser === $superUser['login']) {
                return true;
            }
        }

        return false;
    }
1113709
protected function _checkAccess(array $url, array $user): bool
    {
        $accessFactory = new AccessFactory();

        return $accessFactory->hasAccess($url, $user);
    }
24480
public function isEqualTo(UserInterface $user)
    {
        if ($user->getRoles() !== $this->getRoles()) {
            return false;
        }

        if ($this->username !== $user->getUsername()) {
            return false;
        }

        if ($this->id !== $user->getId()) {
            return false;
        }

        return true;
    }
518582
public function isAuthorised()
    {

        if (is_array($this->user) === true
            && isset($this->user['error']) === false
        ) {

            return true;
        }

        return $this->getUser();
    }
822366
public static function isSuperAdmin(\Nette\Security\User $user)
    {
        $roles = $user->getIdentity()->getRoles();

        return in_array('superadmin', $roles);
    }
1002548
public static function isAdmin(UserInterface $user = null): bool
    {
        $user = $user ?? self::user();

        return $user->getPreference('canadmin') === '1';
    }
139716
public function isAuthorized($user)
    {
        $this->Authorizer->action('*', function ($auth) {
            $auth->allowRole(1);
        });

        // setting up an event for the index
        $_event = new Event('Controller.PostTypes.isAuthorized.' . $this->_type, $this, [
        ]);
        $this->eventManager()->dispatch($_event);

        return $this->Authorizer->authorize();
    }
186909
public function isAuthorized($user = null) {
        if (!$user) {
            throw new ForbiddenException(__d('admin', 'Invalid User'));
        }

        $aro = Admin::introspectModel('Admin.RequestObject');

        if ($aro->isAdmin($user['id'])) {
            if (!$this->Session->read('Admin.crud')) {
                $this->Session->write('Admin.crud', $aro->getCrudPermissions($user['id']));
            }

            return true;
        }

        throw new UnauthorizedException(__d('admin', 'Insufficient Access Permissions'));
    }
914801
public function user($user = null)
    {
        if ($user !== null) {
            $this->user = $user;
        }

        return $this->user;
    }
1261745
public function isUserAllowedAccess()
    {
        $requestedRoles = $this->getRequestedRoles();

        // we allow access if there are no requested roles that the user must have
        if (count($requestedRoles) < 1) {
            return true;
        }

        return $this->getAccessDecision($requestedRoles);
    }
292076
public function isOwner( $user = NULL )
	{
		$user	= $user ? $user : get_current_user();
		if( !function_exists( 'posix_getpwuid' ) )
			return TRUE;
		$uid	= fileowner( $this->fileName );
		if( !$uid )
			return TRUE;
		$owner	= posix_getpwuid( $uid );
		if( !$owner )
			return TRUE;
		print_m( $owner );
		return $user == $owner['name'];
	}
245006
public function setUser($user)
    {
        if ($user instanceof User) {
            $this->_user = $user;
            return true;
        }
        $this->_user = null;
        return false;
    }
1213324
public function hasUser( Model $user )
    {
        return $this->users()->where( $user->getKeyName(), "=", $user->getKey() )->first() ? true : false;
    }
729722
public function isAdmitted(UserInterface $user = null)
    {
        if (is_null($user)) {
            return !$this->currentUser() instanceof GuestUser;
        }

        return $user->getIdentifier() === $this->currentUser()->getIdentifier();
    }
905009
private function hasPermission(AuthenticatedUserInterface $user, string $uri) {

        // Collect permissions
        $permissions = $this->getParameterByKey("permissions");

        // Iterate over permission
        foreach ($permissions as $permissionPath => $acceptableRoles) {
            if($permissionPath[0] !== "/") {
                $permissionPath = "/".$permissionPath;
            }
            if(substr($permissionPath,-1) !== "/") {
                $permissionPath = $permissionPath."/";
            }
            $match = preg_match($permissionPath,$uri);
            if ($match == 1) {
                if(in_array(Role::ANON_USER,$acceptableRoles)) return true;
                foreach ($acceptableRoles as $permissionRole) {
                    if(in_array($permissionRole,$user->getRoles())) return true;
                }
                return false;
            }
        }
        return false;
    }
1126530
public function canAccess(array $user) {
        $can = false;
        foreach ($user["roles"] as $userRole) {
            foreach ($userRole["permissions"] as $permission) {
                if (in_array($permission, $this->permissions)) {
                    $can = true;
                    break;
                }
            }
        }
        return $can;
    }
311896
public function hasAccess($url)
    {
        if ($this->isGuestAction($url)) {
            return true;
        }

        $path = $this->getPathFromUrl($url);

        $groupId = $this->Auth->user('group_id');

        if ($groupId === null) {
            return false;
        }

        if (!is_array($groupId)) {
            $groupId = [$groupId];
        }

        if (in_array(1, $groupId)) {
            return true;
        }

        $user = Wasabi::user();
        if (empty($user->permissions)) {
            Wasabi::user()->permissions = $this->_getGroupPermissions()->findAllForGroup($groupId);
        }

        if (array_key_exists($path, Wasabi::user()->permissions)) {
            return true;
        }

        return false;
    }