コード例 #1
0
def getAllUsers(current_user):
        if not current_user.UserType=='admin':
            return make_response('Only Admin can perform this Function !!!', 401, {'WWW-Authenticate': 'Basic realm="Only Admin can perform this Function !!!"'})
        else:
            users=CLS_CRUD()
            output=users.read()
            return output
コード例 #2
0
def getOneUser(current_user, nationalid):
        if not current_user.UserType=='admin':
            return make_response('Only Admin can perform this Function !!!', 401,
                                 {'WWW-Authenticate': 'Basic realm="Only Admin can perform this Function !!!"'})
        else:
            user=CLS_CRUD()
            user_data=user.readOne(nationalid)
            return jsonify({'user': user_data})
コード例 #3
0
def DeleteUser(current_user, nationalid):
        if not current_user.UserType=='admin':
            return make_response('Only Admin can perform this Function !!!', 401,
                                 {'WWW-Authenticate': 'Basic realm="Only Admin can perform this Function !!!"'})
        else:
            deleteuser=CLS_CRUD()
            us=deleteuser.delete(nationalid)
            return us
コード例 #4
0
def create_User():
        newUser=CLS_CRUD()
        data=newUser.create()
        return jsonify({'message': 'the new user added'+data['nationalid'] })