Esempio n. 1
0
 def self(self, request):
     person = self.store.get_person(request.current_user())
     result = Result()
     result.data = [
         Person(**person.get_properties())
     ]
     return result
Esempio n. 2
0
    def balance(self, request):
        person = self.store.get_person(request.current_user())

        result = Result()
        result.data = [
            Person(**person.get_balance())
        ]

        return result
Esempio n. 3
0
    def attributes(self, request, person_id, app=None, key=None):
        person = self.store.get_person(person_id)

        result = Result()

        data = person.get_xattr(app, key)
        if data:
            result.data = [
                Attribute(person.get_xattr(app, key))
            ]

        return result
Esempio n. 4
0
    def data(self, request, person_id):
        person = self.store.get_person(person_id)
        if not person:
            return Result(False, 101, 'unknown user id')

        if not person.viewable_by(request.current_user()):
            return Result(False, 102, 'user is private')

        result = Result()
        result.data = [
            Person(**person.get_properties())
        ]

        return result
Esempio n. 5
0
    def check(self, request):
        """
            accepts IRequest
        """
        login = request.get('login', None)
        login = request.get('login', None)
        password = request.get('password', None)

        if login is None:
            return Result(False, 101,
                'please specify all mandatory fields ')
 
        credentials = {
            'login': login,
            'password': password
        }

        if not self.store.authenticate(credentials):
            return Result(False, 102, 'login not valid')

        result = Result()

        result.data = [Person(personid=login)]
        return result