private function getUserEntity($id = null)
    {
        if (empty($id)) {
            return new Entity\Users();
        } elseif (!$userEntity = $this->getUser($id)) {
            $this->flashes()->error(Trans::__('general.phrase.user-not-exist'));

            return false;
        }

        $currentUser = $this->getUser();
        if (!$this->app['permissions']->isAllowedToManipulate($userEntity->toArray(), $currentUser->toArray())) {
            // Verify the current user has access to edit this user
            $this->flashes()->error(Trans::__('general.phrase.access-denied-privilege-edit-user'));

            return false;
        }

        return $userEntity;
    }
private function getUserEntity($id = null)
    {
        if (empty($id)) {
            return new Entity\Users();
        } elseif (!$userEntity = $this->getUser($id)) {
            $this->flashes()->error(Trans::__('general.phrase.user-not-exist'));

            return false;
        }

        $currentUser = $this->getUser();
        if (!$this->app['permissions']->isAllowedToManipulate($userEntity->toArray(), $currentUser->toArray())) {
            // Verify the current user has access to edit this user
            $this->flashes()->error(Trans::__('general.phrase.access-denied-privilege-edit-user'));

            return false;
        }

        return $userEntity;
    }
private function getUserEntity ( $ id = null ) { if ( empty ( $ id ) ) { return new Entity \ Users ( ) ; } elseif ( ! $ userEntity = $ this -> getUser ( $ id ) ) { $ this -> flashes ( ) -> error ( Trans :: __ ( 'general.phrase.user-not-exist' ) ) ; return false ; } $ currentUser = $ this -> getUser ( ) ; if ( ! $ this -> app [ 'permissions' ] -> isAllowedToManipulate ( $ userEntity -> toArray ( ) , $ currentUser -> toArray ( ) ) ) { // Verify the current user has access to edit this user $ this -> flashes ( ) -> error ( Trans :: __ ( 'general.phrase.access-denied-privilege-edit-user' ) ) ; return false ; } return $ userEntity ; }
Get the user we want to edit, or a new entity object if null.

@param int $id

@return Entity\Users|false
Get the user we want to edit or a new entity object if null .