| @@ 51-65 (lines=15) @@ | ||
| 48 | return redirect(url_for('whitelists.new')) |
|
| 49 | ||
| 50 | ||
| 51 | @whitelists.route("/del/<string:wid>", methods=["GET"]) |
|
| 52 | def del_sid(wid): |
|
| 53 | _wlist = NaxsiWhitelist.query.filter(NaxsiWhitelist.id == wid).first() |
|
| 54 | if not _wlist: |
|
| 55 | return redirect(url_for('whitelists.index')) |
|
| 56 | ||
| 57 | db.session.delete(_wlist) |
|
| 58 | ||
| 59 | try: |
|
| 60 | db.session.commit() |
|
| 61 | flash("Successfully deleted %s" % wid, "success") |
|
| 62 | except SQLAlchemyError: |
|
| 63 | flash("Error while trying to update %s" % wid, "error") |
|
| 64 | ||
| 65 | return redirect(url_for('whitelists.index')) |
|
| 66 | ||
| 67 | ||
| 68 | @whitelists.route("/generate", methods=["GET", "POST"]) |
|
| @@ 161-174 (lines=14) @@ | ||
| 158 | return redirect("/rules/edit/%s" % sid) |
|
| 159 | ||
| 160 | ||
| 161 | @rules.route("/del/<int:sid>", methods=["GET"]) |
|
| 162 | def del_sid(sid=''): |
|
| 163 | nrule = NaxsiRules.query.filter(NaxsiRules.sid == sid).first() |
|
| 164 | if not nrule: |
|
| 165 | return redirect(url_for("rules.index")) |
|
| 166 | ||
| 167 | db.session.delete(nrule) |
|
| 168 | try: |
|
| 169 | db.session.commit() |
|
| 170 | flash("OK: deleted %s : %s" % (sid, nrule.msg), "success") |
|
| 171 | except SQLAlchemyError: |
|
| 172 | flash("Error while trying to update %s : %s" % (sid, nrule.msg), "error") |
|
| 173 | ||
| 174 | return redirect(url_for("rules.index")) |
|
| 175 | ||
| 176 | ||
| 177 | @rules.route("/deact/<int:sid>", methods=["GET"]) |
|
| @@ 57-68 (lines=12) @@ | ||
| 54 | return render_template("whitelistsets/index.html", whitelistsets=_wlset, selection=_selection) |
|
| 55 | ||
| 56 | ||
| 57 | @whitelistsets.route("/del/<int:wid>", methods=["POST"]) |
|
| 58 | def remove(wid): |
|
| 59 | _wlset = NaxsiWhitelistSets.query.filter(NaxsiWhitelistSets.id == wid).first() |
|
| 60 | if _wlset is None: |
|
| 61 | flash("The whitelist set %s doesn't exist." % wid, "error") |
|
| 62 | return redirect(url_for("whitelistsets.index")) |
|
| 63 | ||
| 64 | db.session.delete(_wlset) |
|
| 65 | db.session.commit() |
|
| 66 | ||
| 67 | flash("Successfully deleted %s " % _wlset.name, "success") |
|
| 68 | return redirect(url_for("whitelistsets.index")) |
|
| 69 | ||
| 70 | ||
| 71 | def __get_whitelist_for_whitelistset(whitelistset): |
|