src/User/Controller/UserController.php
public function checkLoggedInAction() 
    {
    	$data = array('logged' => 0, 'data' => null);
    	
    	if(!$this->zfcUserAuthentication()->hasIdentity()) {
    		return new JsonModel($data);
    	}
    	
    	$identity = $this->zfcUserAuthentication()->getIdentity();
    	$data['logged'] = 1;
    	$userModel = $this->getServiceLocator()->get('user.model.user');
    	$data['data'] = $userModel->init($identity, $this->getServiceLocator());
    	
		return  new JsonModel($data);
    }
public function checkLoggedInAction() 
    {
    	$data = array('logged' => 0, 'data' => null);
    	
    	if(!$this->zfcUserAuthentication()->hasIdentity()) {
    		return new JsonModel($data);
    	}
    	
    	$identity = $this->zfcUserAuthentication()->getIdentity();
    	$data['logged'] = 1;
    	$userModel = $this->getServiceLocator()->get('user.model.user');
    	$data['data'] = $userModel->init($identity, $this->getServiceLocator());
    	
		return  new JsonModel($data);
    }
WS to check if user is logged in