def get(self): """Get information about logged user.""" user_id = self.request.validated['user_id'] if user_id != self.request.authenticated_userid.user_id: raise AuthenticationError() user = User.get(user_id) return ReturnUser.build(user).serialize()
def _validate_authentication_credentials(params): """ Check the user credentials and returns the associated user object. @param dict params the sanitized parameters for authentication @return user """ try: user = User.authenticate(params['username'], params['password']) user = ReturnUser.build(user).serialize() except ValidationError, e: raise ValidationError(e.messages)
def get(self): user_id = self.request.matchdict.get('user_id') if user_id != self.request.authenticated_userid.user_id: raise HTTPUnauthorized() user = User.get(user_id) return ReturnUser.build(user).serialize()
def get(self): """Get information about logged user.""" user_id = self.request.authenticated_userid.user_id user = User.get(user_id) return ReturnUser.build(user).serialize()