Beispiel #1
0
def load_plugins(force):
    for name, attrs in watolib.load_notification_scripts().items():
        if name[0] == ".":
            continue

        declare_permission("notification_plugin.%s" % name, _u(attrs["title"]), u"",
                           ["admin", "user"])
Beispiel #2
0
 def registration_hook(self, instance):
     ident = self.plugin_name(instance)
     declare_permission(
         "icons_and_actions.%s" % ident,
         ident,
         _("Allow to see the icon %s in the host and service views") % ident,
         builtin_role_ids,
     )
Beispiel #3
0
def declare_notification_plugin_permissions() -> None:
    for name, attrs in load_notification_scripts().items():
        if name[0] == ".":
            continue

        declare_permission(
            "notification_plugin.%s" % name, _u(attrs["title"]), "", ["admin", "user"]
        )
Beispiel #4
0
    def registration_hook(self, instance: Type[SidebarSnapin]) -> None:
        declare_permission(
            "sidesnap.%s" % self.plugin_name(instance),
            instance.title(),
            instance.description(),
            instance.allowed_roles(),
        )

        for path, page_func in instance().page_handlers().items():
            cmk.gui.pages.register_page_handler(path, page_func)
Beispiel #5
0
    def registration_hook(self, plugin_class):
        declare_permission(
            "sidesnap.%s" % self.plugin_name(plugin_class),
            plugin_class.title(),
            plugin_class.description(),
            plugin_class.allowed_roles(),
        )

        for path, page_func in plugin_class().page_handlers().items():
            cmk.gui.pages.register_page_handler(path, page_func)
Beispiel #6
0
 def declare_permission(cls, page):
     permname = "%s.%s" % (cls.type_name(), page.name())
     if page.is_public() and permname not in permission_registry:
         declare_permission(permname, page.title(), page.description(),
                            ['admin', 'user', 'guest'])
Beispiel #7
0
    def declare_overriding_permissions(cls):
        declare_permission_section(cls.type_name(), cls.phrase("title_plural"), do_sort=True)

        declare_permission(
            "general.edit_" + cls.type_name(),
            _("Customize %s and use them") % cls.phrase("title_plural"),
            _("Allows to create own %s, customize builtin %s and use them.") %
            (cls.phrase("title_plural"), cls.phrase("title_plural")),
            ["admin", "user"],
        )

        declare_permission(
            "general.publish_" + cls.type_name(),
            _("Publish %s") % cls.phrase("title_plural"),
            _("Make %s visible and usable for other users.") % cls.phrase("title_plural"),
            ["admin", "user"],
        )

        config.declare_permission(
            "general.publish_to_foreign_groups_" + cls.type_name(),
            _("Publish %s to foreign contact groups") % cls.phrase("title_plural"),
            _("Make %s visible and usable for users of contact groups the publishing user is not a member of."
             ) % cls.phrase("title_plural"),
            ["admin"],
        )

        # TODO: Bug: This permission does not seem to be used
        declare_permission(
            "general.see_user_" + cls.type_name(),
            _("See user %s") % cls.phrase("title_plural"),
            _("Is needed for seeing %s that other users have created.") %
            cls.phrase("title_plural"),
            ["admin", "user", "guest"],
        )

        declare_permission(
            "general.force_" + cls.type_name(),
            _("Modify builtin %s") % cls.phrase("title_plural"),
            _("Make own published %s override builtin %s for all users.") %
            (cls.phrase("title_plural"), cls.phrase("title_plural")),
            ["admin"],
        )

        declare_permission(
            "general.edit_foreign_" + cls.type_name(),
            _("Edit foreign %s") % cls.phrase("title_plural"),
            _("Allows to edit %s created by other users.") % cls.phrase("title_plural"),
            ["admin"],
        )

        declare_permission(
            "general.delete_foreign_" + cls.type_name(),
            _("Delete foreign %s") % cls.phrase("title_plural"),
            _("Allows to delete %s created by other users.") % cls.phrase("title_plural"),
            ["admin"],
        )