コード例 #1
0
ファイル: permissions.py プロジェクト: arnike/Wenix
# -*- 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": ""}}
コード例 #2
0
ファイル: permissions.py プロジェクト: arnike/Wenix
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext as _
from utils.permission import title, checkbox, radio


"""
It's mandatory to sort priviliges in the permission maps by their strength
"""

MAP = title(_("Wenix Tools"),
            {"misc": checkbox(_("Browser statistics"), "useragents",
                                     _("Web-console logs"), "system_logs",
                                     _("Dashboard"), "system_mon"
                                     )
            })
コード例 #3
0
ファイル: permissions.py プロジェクト: arnike/Wenix
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext as _
from utils.permission import title, checkbox, radio

MAP = title(_("FTP service"),
            {"proftpd": checkbox(_("dashboard access"), "dashboard",
                                 _("FTP client"),
                                {"ftp_client": (title(_("Directory access scope"),
                                                      {"access":  radio(_("self only"), "self",
                                                                        _("group only"), "group",
                                                                        _("any directory"), "global")},
                                                      _("Directory access type"),
                                                      {"type": radio(_("read only"), "read",
                                                                     _("read&write"),
                                                                     {"write": checkbox(_("Can change folder permissions"), "access_change")}
                                                                     )}),
                                                )},
                                _("has access to statistics"),
                                {"statistics": radio(_("user's only"), "self",
                                                     _("group's only"), "group",
                                                     _("everybody"), "global")},
                                _("can control daemon"), "daemon",
                                _("can view log files"), "log",
                                _("can monitor service's status"), "status")}
)

#MAX_PERM = {"proftpd": {"ftp_client": {"access_change": "global"}, "statistics": "global", "daemon": "", "log": "", "status": ""}}
### Example ###
# user_perm = {"proftpd": {"ftp_client": ""}, "statistics": "global", "log": "", "status": ""}
コード例 #4
0
ファイル: permissions.py プロジェクト: arnike/Wenix
from django.utils.translation import ugettext as _
from utils.permission import title, checkbox, radio

MAP = title(_("VmWare Management Console"),
            {"vmware": checkbox(_("can view VMware hosts"),
                                    {"hosts": radio(_("view only"), "view",
                                                    _("view and edit"), "edit")},
                                _("VMware VMs management"),
                                    {"vmlist": checkbox(
                                                    _("can view VM status"), "status",
                                                    _("can view VM information"), "info",
                                                    _("can start/stop/restart VMs"), "control")
                                    }
                                )
             }
)
コード例 #5
0
ファイル: permissions.py プロジェクト: arnike/Wenix
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext as _
from utils.permission import title, checkbox, radio


"""
It's mandatory to sort priviliges in the permission maps by their strength
"""


MAP = title(_("Administration"),
            {"accounts": checkbox(_("User management"),
                                  {"actions": (checkbox(_("can create"), "add",
                                                        _("can delete"), "delete",
                                                        _("can_edit"), "edit"),
                                               title(_("Application scope"),
                                                     {"mode": radio(_("Group members only"), "group",
                                                                    _("Everybody"), "global")})
                                              )
                                   
                                   })
            }
)
コード例 #6
0
ファイル: permissions.py プロジェクト: arnike/Wenix
from django.utils.translation import ugettext as _
from utils.permission import title, checkbox, radio

MAP = title(_("Resources"),
            {"external": checkbox(_("dashboard"), "dashboard",
                                  _("can view resources"), "view",
                                  _("can edit resources"), "edit"
                              )
             }
)
コード例 #7
0
ファイル: permissions.py プロジェクト: arnike/Wenix
from django.utils.translation import ugettext as _
from utils.permission import title, checkbox, radio

MAP = title(_("Duply Backup Service"),
            {"duply": checkbox(_("can view services"), "view",
                               _("can manage the backup"), "edit"
                              )
             }
)
コード例 #8
0
ファイル: permissions.py プロジェクト: arnike/Wenix
from django.utils.translation import ugettext as _
from utils.permission import title, checkbox, radio

MAP = title(_("Dashboard"), {"dashboard": checkbox(_("has access to dashboard"), "view")})