def dashboard(request, mode): user = request.user bind_daemon = Bind() zones = bind_daemon.get_zones() zones = filter(lambda key: not key in BANNED_ZONES, zones) zones = [{"zone": zone, "type": bind_daemon.get_zone(zone)["type"]} for zone in zones] return render_to_response("bind/dashboard.django.html", {"zones": zones}, context_instance=RequestContext(request))
# -*- coding: utf-8 -*- from django.utils.translation import ugettext as _ from utils.permission import title, checkbox, radio from settings import BANNED_ZONES from bind.daemon import Bind MAP = title(_("DNS-service"), {"bind": checkbox(_("can control daemon"), "daemon", _("dashboard access"), "dashboard")} ) daemon = Bind() zones = daemon.get_zones() for zone in zones: if not zone in BANNED_ZONES: if daemon.config['zone "%s"' % zone]['type'] == "master": MAP["bind"].update(checkbox(_("Zone %(zone)s") % {"zone": zone}, {"_%s_" % zone: checkbox(_("can add new records"), "add", _("can delete records"), "delete", _("can change records"), "edit")})) elif daemon.config['zone "%s"' % zone]['type'] in ("forward", "hint"): MAP["bind"].update(checkbox(_("Zone %(zone)s") % {"zone": zone}, {"_%s_" % zone: checkbox(_("can add new records"), "add", _("can delete records"), "delete", _("can change type"), "type")})) else: # type = "slave", "hint" MAP["bind"].update(checkbox(_("Zone %(zone)s") % {"zone": zone}, "_%s_" % zone)) # Example 77# # user_perm = {"bind": {"ro77.control.ru": ["edit"], "77.10.in-addr.arpa": ["edit"], "daemon": ""}}