Exemplo n.º 1
0
 def _add_group(self, group_type, request):
     self._check_customer(request)
     watolib.add_group(
         request.get("groupname"),
         group_type,
         self._get_group_extra_info(group_type, request),
     )
Exemplo n.º 2
0
    def action(self) -> ActionResult:
        if not html.check_transaction():
            return "%s_groups" % self.type_name

        alias = html.request.get_unicode_input_mandatory("alias").strip()
        self.group = {"alias": alias}

        self._determine_additional_group_data()

        if self._new:
            self._name = html.request.get_ascii_input_mandatory("name").strip()
            watolib.add_group(self._name, self.type_name, self.group)
        else:
            watolib.edit_group(self._name, self.type_name, self.group)

        return "%s_groups" % self.type_name
Exemplo n.º 3
0
    def action(self) -> ActionResult:
        if not transactions.check_transaction():
            return redirect(mode_url("%s_groups" % self.type_name))

        alias = request.get_unicode_input_mandatory("alias").strip()
        self.group = {"alias": alias}

        self._determine_additional_group_data()

        if self._new:
            self._name = request.get_ascii_input_mandatory("name").strip()
            watolib.add_group(self._name, self.type_name, self.group)
        else:
            assert self._name is not None
            watolib.edit_group(self._name, self.type_name, self.group)

        return redirect(mode_url("%s_groups" % self.type_name))
Exemplo n.º 4
0
    def action(self):
        if not html.check_transaction():
            return "%s_groups" % self.type_name

        alias = html.get_unicode_input("alias").strip()
        if not alias:
            raise MKUserError("alias", _("Please specify an alias name."))

        self.group = {"alias": alias}

        self._determine_additional_group_data()

        if self._new:
            self._name = html.request.var("name").strip()
            watolib.add_group(self._name, self.type_name, self.group)
        else:
            watolib.edit_group(self._name, self.type_name, self.group)

        return "%s_groups" % self.type_name
Exemplo n.º 5
0
def with_groups(request_context, with_admin_login, suppress_automation_calls):
    watolib.add_group("windows", "host", {"alias": "windows"})
    watolib.add_group("routers", "service", {"alias": "routers"})
    watolib.add_group("admins", "contact", {"alias": "admins"})
    yield
    watolib.delete_group("windows", "host")
    watolib.delete_group("routers", "service")
    watolib.delete_group("admins", "contact")
Exemplo n.º 6
0
def with_groups(module_wide_request_context, with_user_login,
                suppress_automation_calls):
    watolib.add_group('windows', 'host', {'alias': 'windows'})
    watolib.add_group('routers', 'service', {'alias': 'routers'})
    watolib.add_group('admins', 'contact', {'alias': 'admins'})
    yield
    watolib.delete_group('windows', 'host')
    watolib.delete_group('routers', 'service')
    watolib.delete_group('admins', 'contact')