def groupremove(id, group): if ("admin" not in current_user.get_authgroups()) and ("admin-%s" % group not in current_user.get_authgroups()): flash("You do not have the right to do that.", "danger") return redirect("/groups/admin") id = str(id) group = str(group) ldaptools.modgroup(id, MOD_DELETE, group) flash("Membership of %s removed for %s" % (group, id), "success") return redirect("/groups/list/"+group)
def groupmkadmin(id, group): if ("admin" not in current_user.get_authgroups()) and ("admin-%s" % group not in current_user.get_authgroups()): flash("You do not have the right to do that.", "danger") return redirect("/groups/admin") id = str(id) group = str(group) try: ldaptools.modgroup(id, MOD_ADD, "admin-%s" % group) flash("Membership of admin-%s added for %s" % (group, id), "success") except: flash("That user is already in that group.", "danger") return redirect("/groups/list/"+group)
def groupdeny(id, group): if ("admin" not in current_user.get_authgroups()) and ("admin-%s" % group not in current_user.get_authgroups()): flash("You do not have the right to do that.", "danger") return redirect("/groups/admin") try: id = str(id) group = str(group) ldaptools.modgroup(id, MOD_DELETE, group+"-pending") flash("Membership of %s denied for %s" % (group, id), "success") return redirect("/groups/admin") except: flash("Membership application not found", "danger") return redirect("/groups/admin")
def ping_send_group(): if ("ping" not in current_user.get_authgroups()) and ("ping-%s" % request.form["group"] not in current_user.get_authgroups()): flash("You do not have the right to do that.", "danger") return redirect("/ping") count = pingbot.groupbroadcast(current_user.get_name(), "(|(authGroup={0}))".format(request.form["group"]), request.form["message"], request.form["group"]) flash("Broadcast sent to %d members in %s" % (count, request.form["group"]), "success") return redirect("/ping")
def groups(): yourgroups = current_user.get_authgroups() + current_user.get_pending_authgroups() notyours = lambda x: x not in yourgroups if "Ineligible" in current_user.accountStatus: return render_template("groups.html", closed_groups=filter(notyours, []), open_groups=filter(notyours, app.config["groups"]["publicgroups"])) else: return render_template("groups.html", closed_groups=filter(notyours, app.config["groups"]["closedgroups"]), open_groups=filter(notyours, app.config["groups"]["opengroups"]))
def groups(): yourgroups = current_user.get_authgroups() + current_user.get_pending_authgroups() notyours = lambda x: x not in yourgroups return render_template("groups.html", closed_groups=filter(notyours, app.config["groups"]["closedgroups"]), open_groups=filter(notyours, app.config["groups"]["opengroups"]))