def self(self, request): person = self.store.get_person(request.current_user()) result = Result() result.data = [ Person(**person.get_properties()) ] return result
def balance(self, request): person = self.store.get_person(request.current_user()) result = Result() result.data = [ Person(**person.get_balance()) ] return result
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
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
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