예제 #1
0
 def post(self):
     data = User.parser.parse_args()
     username = data['username']
     password = data['password']
     user = UserModel()
     user = user.create_user(username, password)
     return (user)
예제 #2
0
    def post(self):

        parser = reqparse.RequestParser()
        parser.add_argument('username',
                            type=str,
                            required=True,
                            help='This field cannot be left blank')
        parser.add_argument('password',
                            type=str,
                            required=True,
                            help='This field cannot be left blank')

        data = User.parser.parse_args()
        username = data['username']
        password = data['password']
        auth = request.authorization
        user = UserModel()
        '''result = user.login(auth)'''
        result = user.login(username, password)
        return (result)
예제 #3
0
 def get(self):
     user = UserModel()
     result = user.get_all()
     return ({'users': result}), 200
예제 #4
0
 def delete(self):
     '''if not (current_user['admin']):
         return({"message":"cannot delete patient"}),401'''
     user = UserModel()
     result = user.delete_user_table()
     return (result), 200
예제 #5
0
 def put(self, userid):
     '''if not (current_user['admin']):
         return({"message":"cannot update patient"}),401'''
     user = UserModel()
     result = user.promote_user_admin(userid)
     return (result), 200
예제 #6
0
 def get(self, userid):
     '''if not (current_user['admin'] or current_user['isdoctor']):
         return({"message":"cannot get the specified user"}),401'''
     user = UserModel()
     result = user.get_one('userid', userid)
     return (result), 200