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
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})
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
def create_User(): newUser=CLS_CRUD() data=newUser.create() return jsonify({'message': 'the new user added'+data['nationalid'] })