Determines if a user is active on this center

@param User $user
@param Center $center
@return bool
979885
public function userCanReachCenter(User $user, Center $center)
    {
        foreach ($user->getGroupCenters() as $groupCenter) {
            if ($center->getId() === $groupCenter->getCenter()->getId()) {
                
                return true;
            }
        }
        
        return false;
    }
822366
public static function isSuperAdmin(\Nette\Security\User $user)
    {
        $roles = $user->getIdentity()->getRoles();

        return in_array('superadmin', $roles);
    }
464150
public function isRegistered(User $user, Workspace $workspace)
    {
        $userRoles = $user->getRoles();
        $workspaceRoles = $workspace->getRoles();

        foreach ($userRoles as $userRole) {
            foreach ($workspaceRoles as $workspaceRole) {
                if ($workspaceRole->getName() === $userRole) {
                    return true;
                }
            }
        }

        return false;
    }
545871
public function hasAccess(array $url, array $user): bool
    {
        $result = parent::hasAccess($url, $user);

        if (!$result) {
            return $result;
        }

        if (!empty($user['is_supervisor']) && $user['is_supervisor']) {
            $users = Utils::getReportToUsers($user['id']);

            foreach ($users as $userRecord) {
                $result = (new AccessFactory())->hasAccess($url, $userRecord->toArray());

                if ($result) {
                    return $result;
                }
            }
        }

        return false;
    }
545920
public function getReachableCircles(User $user, Role $role, Center $center)
    {
        $scopes = array();
        
        foreach ($user->getGroupCenters() as $groupCenter){
            if ($center->getId() === $groupCenter->getCenter()->getId()) {
                //iterate on permissionGroup
                $permissionGroup = $groupCenter->getPermissionsGroup();
                //iterate on roleScopes
                foreach($permissionGroup->getRoleScopes() as $roleScope) {
                    //check that the role is in the reachable roles
                    if ($this->isRoleReached($role, 
                          new Role($roleScope->getRole()))) {

                        $scopes[] = $roleScope->getScope();
                    }
                }
            }
        }
        
        return $scopes;
    }
590359
private function userAttemptBruteForceLock(User $user)
    {
        if ($this->userAttemptBruteForceLockHasExceeded($user)) {
            return true;
        }
        
        $this->attempts = $user->login_attempt + 1;
        
        if ($this->attempts >= $this->allowedAttempts) {
            $user->updateAttributes(['login_attempt_lock_expiration' => time() + $this->lockoutTime]);
        }
        
        $user->updateAttributes(['login_attempt' => $this->attempts]);
    }
464456
public function isEntityLocked(User $user, LockableEntityInterface $entity)
    {
        /** @var LockableEntity $lockable */
        $lockable = $this->getLockableEntity($entity);

        if ($this->lockEnabled) {
            $this->removeExpiredLocks($lockable);
            $locks = $this->getEntityVersionLocksByLockableEntity($lockable, $user);

            if ($locks === null || !count($locks)) {
                $this->createEntityVersionLock($user, $lockable);

                $lockable->setUpdated(new \DateTime());
                $this->objectManager->flush();

                return false;
            }

            return true;
        }

        return false;
    }
726314
protected function voteForUser(UserInterface $subject, UserInterface $user)
    {
        foreach ($subject->getGroups() as $group) {
            if (!$group->isDeleted() && $this->canActOnSite($group->getSite()->getSiteId(), $user)) {
                return true;
            }
        }

        return false;
    }
247337
private function checkUser()
    {
        static $enabled;

        if (!isset($enabled)) {

            $token = $this->tokenStorage->getToken();

            if ($token) {

                $user = $token->getUser();

                if ($user instanceof \FOS\UserBundle\Model\User) {
                    if ($user->hasRole('ROLE_USER'))
                        $enabled = $token->isAuthenticated();
                }
            } else
                $enabled = false;
        }

        return $enabled;
    }
1079301
public function hasAccess(array $url, array $user): bool
    {
        $result = parent::hasAccess($url, $user);
        if (!$result) {
            return $result;
        }

        if (!empty($user['is_superuser']) && $user['is_superuser']) {
            return true;
        }

        return false;
    }
306880
def deactivate_user(self, user):
        
        if user.active:
            user.active = False
            return True
        return False
298897
public function activate(User $user)
    {
        $user->is_activated = ! $user->is_activated;
        $user->save();

        if ($user->is_activated) {
            return $this->notifySuccess('User ' . $user->name . ' activated!');
        } else {
            return $this->notifySuccess('User ' . $user->name . ' deactivated!');
        }
    }
742759
public function activate(User $user)
    {
        $this->authorize(UsersPolicy::PERMISSION_UPDATE);

        try {
            ($active = $user->isActive()) ? $user->deactivate() : $user->activate();

            $message = $this->transNotification(
                $active ? 'disabled' : 'enabled',
                ['name' => $user->full_name],
                $user->toArray()
            );

            return $this->jsonResponseSuccess(compact('message'));
        }
        catch (\Exception $e) {
            return $this->jsonResponseError(['message' => $e->getMessage()], 500);
        }
    }
1213324
public function hasUser( Model $user )
    {
        return $this->users()->where( $user->getKeyName(), "=", $user->getKey() )->first() ? true : false;
    }
930036
protected function getCallbackStatus(User $user): bool
    {
        $allCurrentNotificationFilter = $user->getBunqUser()->getNotificationFilters();

        /** @var NotificationFilter $filter */
        foreach ($allCurrentNotificationFilter as $filter) {
            if (
                self::NOTIFICATION_CATEGORY_MUTATION === $filter->getCategory()
                && self::NOTIFICATION_DELIVERY_METHOD_URL === $filter->getNotificationDeliveryMethod()
                && $filter->getNotificationTarget() === $this->getUrl()
            ) {
                return true;
            }
        }

        return false;
    }
876317
def activate_user(self, user):
        
        if not user.active:
            user.active = True
            return True
        return False
1015012
public function is_available(User $user)
    {
        return $this->app->getAclForUser($user)->has_right(\ACL::ORDER_MASTER);
    }