def run(self, params={}):
        """Run action"""
        self.logger.info("Creating user %s", params)
        user = pypd.User.create(data=params, from_email=params['from_email'])

        if user:
            user = normalize_user(user.json)
        else:
            user = None

        self.logger.debug('Returned: %s', user)

        return {'success': not not user, 'user': user or empty_user}
Beispiel #2
0
    def run(self, params={}):
        """Get a user by email"""

        if not params['email']:
            raise Exception('Email required')

        user = pypd.User.find_one(email=params['email'])
        if user:
            user = normalize_user(user.json)
        else:
            user = None

        self.logger.debug('Returned: %s', user)
        return {'found': bool(user), 'user': user or empty_user}
    def run(self, params={}):
        """Get a user by ID"""

        if not params['id']:
            raise Exception('id required')

        user = pypd.User.find_one(id=params['id'])
        if user:
            user = normalize_user(user.json)
        else:
            user = None

        self.logger.debug('Returned: %s', user)
        return {'found': not not user, 'user': user or empty_user}
Beispiel #4
0
    def run(self, params={}):
        """Get a user by email"""

        if not params["email"]:
            raise Exception("Email required")

        user = pypd.User.find_one(email=params["email"])
        if user:
            user = normalize_user(user.json)
        else:
            user = None

        self.logger.debug("Returned: %s", user)
        return {"found": bool(user), "user": user or empty_user}
    def run(self, params={}):
        """Delete user"""

        if not params['id']:
            raise Exception('id not provided')

        user = pypd.User.find_one(id=params['id'])
        if not user:
            return {
                'success': False,
                'user': {},
            }

        self.logger.debug('Returned: %s', user)

        success = user.remove()
        user = normalize_user(user.json)

        return {'success': success, 'user': user or empty_user}
Beispiel #6
0
    def run(self, params={}):
        """Delete user"""

        if not params["id"]:
            raise Exception("id not provided")

        user = pypd.User.find_one(id=params["id"])
        if not user:
            return {
                "success": False,
                "user": {},
            }

        self.logger.debug("Returned: %s", user)

        success = user.remove()
        user = normalize_user(user.json)

        return {"success": success, "user": user or empty_user}