Remove expired shadow login data.

@param Entity\Users $userEntity

@return Entity\Users
344132
protected function updateUserShadowLogin(Entity\Users $userEntity)
    {
        if (Carbon::now() > $userEntity->getShadowvalidity()) {
            $userEntity->setShadowpassword(null);
            $userEntity->setShadowtoken(null);
            $userEntity->setShadowvalidity(null);
        }

        return $userEntity;
    }
291344
protected function getUserEntity() : ?User
    {
        if (!$this->userEntity && $this->userId)
        {
            $this->userEntity = $this->userRepository->findOneById($this->userId);
        }

        return $this->userEntity;
    }
1135462
public function update(User $user, User $entity)
    {
        if ($entity->id === $user->id) {
            return true;
        }
        return $user->hasPermission('user-update');
    }
483271
public function removeUsers(User ...$users)
    {
        foreach ($users as $user) {
            $this->getUsers()->removeElement($user);
        }

        return $this;
    }
1146799
public function getUserEntityByUserCredentials(
        $username,
        $password,
        $grantType,
        ClientEntityInterface $clientEntity
    ): ?UserEntityInterface {
        $builder = $this->connection->createQueryBuilder();
        $user = $builder->select(['user.id', 'user.password'])
            ->from('user')
            ->where('username = :username')
            ->setParameter('username', $username)
            ->execute()
            ->fetch();

        if (!$user) {
            return null;
        }

        if (!password_verify($password, $user['password'])) {
            return null;
        }

        return new User(Uuid::fromBytesToHex($user['id']));
    }
669538
public function getUserLogin(UserServiceInterface $userService)
    {
        $user = $this->getAndLogUserByCookie($userService);
        return $user ? $user->getLogin() : null;
    }
33352
public function delete(User $user, User $entity)
    {
        if ($entity->id === $user->id) {
            return true;
        }
        return $user->hasPermission('user-delete');
    }
258340
public static function createFromEntity(Entity\Users $entity)
    {
        $user = new self();
        $user->id = $entity->getId();
        $user->userName = $entity->getUserName();
        $user->password = $entity->getPassword();
        $user->email = $entity->getEmail();
        $user->displayName = $entity->getDisplayname();
        $user->lastSeen = $entity->getLastSeen();
        $user->lastIp = $entity->getLastIp();
        $user->stack = $entity->getStack();
        $user->enabled = $entity->getEnabled();
        $user->roles = $entity->getRoles();

        return $user;
    }
418030
protected void saveRememberMeKeyToCookie(USER_ENTITY userEntity, USER_BEAN userBean) {
        final int expireDays = getRememberMeAccessTokenExpireDays();
        getCookieRememberMeKey().ifPresent(cookieKey -> {
            doSaveRememberMeCookie(userEntity, userBean, expireDays, cookieKey);
        });
    }
658517
protected function getUser4Id($userId)
    {
        /** @var \PServerCore\Entity\Repository\User $userRepository */
        $userRepository = $this->entityManager->getRepository($this->collectionOptions->getEntityOptions()->getUser());

        return $userRepository->getUser4Id($userId);
    }
206648
public function getUsersWithEntityVersionLock(LockableEntityInterface $entity, User $userToExclude = null)
    {
        /** @var LockableEntity $lockable */
        $lockable = $this->getLockableEntity($entity);

        return  array_reduce(
            $this->getEntityVersionLocksByLockableEntity($lockable, $userToExclude),
            function ($return, EntityVersionLock $item) {
                $return[] = $item->getOwner();

                return $return;
            },
            []
        );
    }
891716
public function deleteUserTypeEntityIfExists($entityId, $fieldName) {
        $item = $this->getUserTypeEntity($entityId, $fieldName);
        if (empty($item)) {
            return false;
        }

        $entity = new \CUserTypeEntity();
        if ($entity->Delete($item['ID'])) {
            return true;
        }

        $this->throwException(__METHOD__, 'UserType not deleted');
    }
981600
public static function getWardForUser($userId)
    {
        $entityManager = (object) DoctrineBootstrap::getEntityManager();
        $user = $entityManager->getRepository('Hospitalplugin\Entities\User')->findOneById($userId);
        return $user->getWard();
    }
843686
public function getNewToken(ClientEntityInterface $clientEntity, array $scopes, $userIdentifier = null)
    {
        $token = new AccessToken();

        $token->setUserIdentifier($userIdentifier);

        return $token;
    }
1186257
public function getUserEntityRepository() 
    {
    	if(isset($this->er['User'])) {
    		return $this->er['User'];
    	}
    	$entityRepository = $this->getEntityManager()->getRepository('Neobazaar\Entity\User');
    	$entityRepository->setServiceLocator($this->getServiceManager());
    	$this->er['User'] = $entityRepository;
    	
    	return $this->er['User'];
    }
98571
protected function createResourceFromUser(UserEntity $user)
    {
        $resource = new Resource(
            $this->generateReadUrl($user->getUsernameCanonical()),
            array(
                 'username'   => $user->getUsernameCanonical(),
                 'email'      => $user->getEmail(),
                 'last_login' => $user->getLastLogin() ? $user->getLastLogin()->format('c') : null,
            )
        );

        return $resource;
    }
332025
public Response updateUser(UserEntity userEntity) {
		return restClient.put("users/" + userEntity.getUsername(), userEntity, new HashMap<String, String>());
	}