Example #1
0
 def get(self, id):
     id = str(id)
     org_key = ndb.Key('Organization', id)
     client_id = users.get_current_user().user_id()
     if client_id != id:
         user_key = ndb.Key('User', client_id)
         user = user_key.get()
         if user is None or org_key not in user.works_for_organizations:
             abort(401)
     query = Place.query_by_org(org_key)
     response = {'places': ndb_util.query_to_dict_list(query)}
     return response