def find_one(role_id): """ Get All roles with pagination. :return: roles, has_next, has_prev, current_page """ role = roles.get_or_404(role_id) return {'role': role}
def remove_role(user_id): """ Remove role to user. :return: """ role = roles.get_or_404(int(request.values.get('role_id', None))) user = users.get_or_404(user_id) if not users.remove_role_from_user(user, role): return {}, 500 return {}
def remove_role(user_id): """ Remove role to user. :return: """ role = roles.get_or_404(int(request.values.get("role_id", None))) user = users.get_or_404(user_id) if not users.remove_role_from_user(user, role): return {}, 500 return {}
def destroy(role_id): """ Delete role. @login_required :param role_id: :return: """ role = roles.get_or_404(role_id) if not roles.delete_role(role): return {}, 500 return {}
def update(role_id): """ Update role information. @login_required :param role_id: :return: role, password_incorrect, status """ if request.form: form = RoleForm(MultiDict(request.form)) else: form = RoleForm() role = roles.get_or_404(role_id) if form.validate_on_submit(): roles.update_role(role, **request.form) else: return {}, 500 return {'role': role}