예제 #1
0
def create_admins():
    users = User.query()

    for user in users:
        admin = Admin(id=user.key.id(), admin_id=user.key.id())

        admin.put()
    return "Admin Created"
예제 #2
0
 def find_user(self,username,password):
     if not username or not self.usernameregex.match(username) or not password or not self.passwordregex.match(password):
         return None
     query_result = User.query(User.username == username).fetch(1)
     if len(query_result)==0:
         return None
     user = query_result[0]
     password_input = hashlib.sha256(password).hexdigest()
     if not user.hashed_password == password_input:
         return None
     return user.key.id()
예제 #3
0
파일: api.py 프로젝트: veritas44/arcanum
 def post(self):
     self.response.headers['Content-Type'] = 'application/json; charset=utf-8'
     
     counter = 0
     userlist = json.loads(self.request.body, object_hook=as_user)        
     
     self.response.write('[')
     for u in userlist:
         for p in u.phones:
             usr = User.query(User.hash == p).get()
             if usr is not None:
                 if counter > 0:
                     self.response.write(',')
                 self.response.write(print_user(u.lookup_key, usr))
                 counter += 1
     
     self.response.write(']')
예제 #4
0
파일: api.py 프로젝트: veritas44/arcanum
 def get(self, phoneHash):
     self.response.write('Requested phone hash is :\"'+ escape(phoneHash) +'\"\n')
     user = User.query(User.hash == escape(phoneHash)).get()
     
     self.response.headers['Content-Type'] = 'application/json; charset=utf-8'
     self.response.write(user.to_json())