Exemple #1
0
def load_plugins():
    global loaded_with_language, dashboards, builtin_dashboards_transformed
    if loaded_with_language == current_language:
        return

    # Load plugins for dashboards. Currently these files
    # just may add custom dashboards by adding to builtin_dashboards.
    load_web_plugins("dashboard", globals())
    builtin_dashboards_transformed = False

    # This must be set after plugin loading to make broken plugins raise
    # exceptions all the time and not only the first time (when the plugins
    # are loaded).
    loaded_with_language = current_language

    # Clear this structure to prevent users accessing dashboard structures created
    # by other users, make them see these dashboards
    dashboards = {}

    # Declare permissions for all dashboards
    config.declare_permission_section("dashboard", _("Dashboards"), do_sort=True)
    for name, board in builtin_dashboards.items():
        config.declare_permission(
            "dashboard.%s" % name, board["title"], board.get("description", ""), config.builtin_role_ids
        )

    # Make sure that custom views also have permissions
    config.declare_dynamic_permissions(lambda: visuals.declare_custom_permissions("dashboards"))
Exemple #2
0
def declare_visual_permissions(what, what_plural):
    config.declare_permission("general.edit_" + what,
         _("Customize %s and use them") % what_plural,
         _("Allows to create own %s, customize builtin %s and use them.") % (what_plural, what_plural),
         [ "admin", "user" ])

    config.declare_permission("general.publish_" + what,
         _("Publish %s") % what_plural,
         _("Make %s visible and usable for other users.") % what_plural,
         [ "admin", "user" ])

    config.declare_permission("general.see_user_" + what,
         _("See user %s") % what_plural,
         _("Is needed for seeing %s that other users have created.") % what_plural,
         [ "admin", "user", "guest" ])

    config.declare_permission("general.force_" + what,
         _("Modify builtin %s") % what_plural,
         _("Make own published %s override builtin %s for all users.") % (what_plural, what_plural),
         [ "admin" ])

    config.declare_permission("general.delete_foreign_" + what,
         _("Delete foreign %s") % what_plural,
         _("Allows to delete %s created by other users.") % what_plural,
         [ "admin" ])
Exemple #3
0
def register_snapin(snapin_id, snapin):
    sidebar_snapins[snapin_id] = snapin

    config.declare_permission("sidesnap.%s" % snapin_id, snapin.title(),
                              snapin.description(), snapin.allowed_roles())

    modules.register_handlers(snapin.page_handlers())
Exemple #4
0
    def declare_overriding_permissions(self):
        config.declare_permission(
            "general.edit_" + self.type_name(),
            _("Customize %s and use them") % self.phrase("title_plural"),
            _("Allows to create own %s, customize builtin %s and use them.") %
            (self.phrase("title_plural"), self.phrase("title_plural")),
            ["admin", "user"])

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

        config.declare_permission(
            "general.see_user_" + self.type_name(),
            _("See user %s") % self.phrase("title_plural"),
            _("Is needed for seeing %s that other users have created.") %
            self.phrase("title_plural"), ["admin", "user", "guest"])

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

        config.declare_permission(
            "general.delete_foreign_" + self.type_name(),
            _("Delete foreign %s") % self.phrase("title_plural"),
            _("Allows to delete %s created by other users.") %
            self.phrase("title_plural"), ["admin"])
Exemple #5
0
def load_plugins():
    global loaded_with_language
    if loaded_with_language == current_language:
        return

    # Load plugins for dashboards. Currently these files
    # just may add custom dashboards by adding to builtin_dashboards.
    load_web_plugins("dashboard", globals())

    # This must be set after plugin loading to make broken plugins raise
    # exceptions all the time and not only the first time (when the plugins
    # are loaded).
    loaded_with_language = current_language

    # In future there will be user editable dashboards just like
    # views which will be loaded. Currently we only use the builtin
    # dashboads.
    global dashboards
    dashboards = builtin_dashboards

    # Declare permissions for all dashboards
    config.declare_permission_section("dashboard", _("Dashboards"))
    for name, dashboard in dashboards.items():
        config.declare_permission("dashboard.%s" % name,
                dashboard["title"],
                dashboard.get("description", ''),
                config.builtin_role_ids)
Exemple #6
0
def load_plugins():
    global loaded_with_language, dashboards, builtin_dashboards_transformed
    if loaded_with_language == current_language:
        return

    # Load plugins for dashboards. Currently these files
    # just may add custom dashboards by adding to builtin_dashboards.
    load_web_plugins("dashboard", globals())
    builtin_dashboards_transformed = False

    # This must be set after plugin loading to make broken plugins raise
    # exceptions all the time and not only the first time (when the plugins
    # are loaded).
    loaded_with_language = current_language

    # Clear this structure to prevent users accessing dashboard structures created
    # by other users, make them see these dashboards
    dashboards = {}

    # Declare permissions for all dashboards
    config.declare_permission_section("dashboard", _("Dashboards"), do_sort = True)
    for name, board in builtin_dashboards.items():
        config.declare_permission("dashboard.%s" % name,
                board["title"],
                board.get("description", ""),
                config.builtin_role_ids)

    # Make sure that custom views also have permissions
    config.declare_dynamic_permissions(lambda: visuals.declare_custom_permissions('dashboards'))
Exemple #7
0
def load_plugins(force):
    global loaded_with_language
    if loaded_with_language == current_language and not force:
        return

    # Load all files below local/share/check_mk/web/plugins/glpi into
    # the global context
    load_web_plugins('glpi', globals())

    # This must be set after plugin loading to make broken plugins raise
    # exceptions all the time and not only the first time (when the plugins
    # are loaded).
    loaded_with_language = current_language

    config.declare_permission('general.glpi_config', _('Change GLPI settings'),
                              _('Allows a user to change GLPI settings.'),
                              ['admin'])
Exemple #8
0
def load_plugins():
    global loaded_with_language
    if loaded_with_language == current_language:
        return

    load_web_plugins("webapi", globals())

    # This must be set after plugin loading to make broken plugins raise
    # exceptions all the time and not only the first time (when the plugins
    # are loaded).
    loaded_with_language = current_language

    config.declare_permission("wato.api_allowed", _("Access to Web-API"),
                                                  _("This permissions specifies if the role "\
                                                    "is able to use Web-API functions. It is only available "\
                                                    "for automation users."),
                              config.builtin_role_ids)
Exemple #9
0
def load_plugins(force):
    global loaded_with_language
    if loaded_with_language == current_language and not force:
        return

    load_web_plugins("webapi", globals())

    # This must be set after plugin loading to make broken plugins raise
    # exceptions all the time and not only the first time (when the plugins
    # are loaded).
    loaded_with_language = current_language

    config.declare_permission("wato.api_allowed", _("Access to Web-API"),
                                                  _("This permissions specifies if the role "\
                                                    "is able to use Web-API functions. It is only available "\
                                                    "for automation users."),
                              config.builtin_role_ids)
Exemple #10
0
def load_plugins(force):
    global loaded_with_language
    if loaded_with_language == current_language and not force:
        return

    config.declare_permission_section("notification_plugin",
                                      _("Notification plugins"),
                                      do_sort=True)

    for name, attrs in wato.load_notification_scripts().items():
        config.declare_permission("notification_plugin.%s" % name,
                                  _u(attrs["title"]), u"", ["admin", "user"])

    # This must be set after plugin loading to make broken plugins raise
    # exceptions all the time and not only the first time (when the plugins
    # are loaded).
    loaded_with_language = current_language
Exemple #11
0
def load_plugins(force):
    global loaded_with_language
    if loaded_with_language == current_language and not force:
        return

    # Load all files below local/share/check_mk/web/plugins/glpi into
    # the global context
    load_web_plugins('glpi', globals())

    # This must be set after plugin loading to make broken plugins raise
    # exceptions all the time and not only the first time (when the plugins
    # are loaded).
    loaded_with_language = current_language

    config.declare_permission(
        'general.glpi_config',
        _('Change GLPI settings'),
        _('Allows a user to change GLPI settings.'),
        [ 'admin' ])
Exemple #12
0
def load_plugins():
    global loaded_with_language
    if loaded_with_language == current_language:
        return

    # Load all snapins
    global sidebar_snapins
    sidebar_snapins = {}
    load_web_plugins("sidebar", globals())

    # This must be set after plugin loading to make broken plugins raise
    # exceptions all the time and not only the first time (when the plugins
    # are loaded).
    loaded_with_language = current_language

    # Declare permissions: each snapin creates one permission
    config.declare_permission_section("sidesnap", _("Sidebar snapins"))
    for name, snapin in sidebar_snapins.items():
        config.declare_permission("sidesnap.%s" % name, snapin["title"],
                                  snapin["description"], snapin["allowed"])
Exemple #13
0
def load_plugins():
    global loaded_with_language
    if loaded_with_language == current_language:
        return

    load_web_plugins("webapi", globals())

    # This must be set after plugin loading to make broken plugins raise
    # exceptions all the time and not only the first time (when the plugins
    # are loaded).
    loaded_with_language = current_language

    config.declare_permission("webapi.api_allowed", _("API accessible"),
                                                    _("This permissions specifies if the role "\
                                                      "is able to use web API functions at all"),
                              config.builtin_role_ids)

    # Declare permissions for all api actions
    config.declare_permission_section("webapi", _("Web API"), do_sort = True)
    for name, settings in api_actions.items():
        full_description  = "%s<br>API function <tt>{site}/check_mk/webapi.py?action=%s</tt>" % (settings.get("description",""), name)
        example_request = settings.get("example_request")
        if example_request:
            full_description += "<br>"
            if example_request[0]:
                full_description += "<br>Optional GET parameters<br><table>"
                for entry in example_request[0]:
                    full_description += "<tr><td><tt>%s</tt></td><td>%s</td></tr>" % entry
                full_description += "</table>"
            if example_request[1]:
                full_description +=  "<br>Example request ( Json formatted POST parameter <tt>request=</tt> ):<br>"
                try:
                    import json
                    full_description += "<pre>%s</pre>" % json.dumps(example_request[1], sort_keys = True, indent = 2)
                except:
                    full_description += "<pre>%s</pre>" % pprint.pformat(example_request[1])

        config.declare_permission("webapi.%s" % name,
                settings["title"],
                full_description,
                config.builtin_role_ids)
Exemple #14
0
def load_plugins(force):
    global loaded_with_language
    if loaded_with_language == current_language and not force:
        return

    # Load all snapins
    global sidebar_snapins
    sidebar_snapins = {}
    global search_plugins
    search_plugins = []
    load_web_plugins("sidebar", globals())

    # This must be set after plugin loading to make broken plugins raise
    # exceptions all the time and not only the first time (when the plugins
    # are loaded).
    loaded_with_language = current_language

    # Declare permissions: each snapin creates one permission
    config.declare_permission_section("sidesnap", _("Sidebar snapins"), do_sort=True)
    for name, snapin in sidebar_snapins.items():
        config.declare_permission("sidesnap.%s" % name, snapin["title"], snapin["description"], snapin["allowed"])
Exemple #15
0
    def declare_overriding_permissions(self):
        config.declare_permission(
            "general.edit_" + self.type_name(),
            _("Customize %s and use them") % self.phrase("title_plural"),
            _("Allows to create own %s, customize builtin %s and use them.")
            % (self.phrase("title_plural"), self.phrase("title_plural")),
            ["admin", "user"],
        )

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

        config.declare_permission(
            "general.see_user_" + self.type_name(),
            _("See user %s") % self.phrase("title_plural"),
            _("Is needed for seeing %s that other users have created.") % self.phrase("title_plural"),
            ["admin", "user", "guest"],
        )

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

        config.declare_permission(
            "general.delete_foreign_" + self.type_name(),
            _("Delete foreign %s") % self.phrase("title_plural"),
            _("Allows to delete %s created by other users.") % self.phrase("title_plural"),
            ["admin"],
        )
def load():
    global loaded_with_language
    if loaded_with_language == current_language:
        return

    config.declare_permission_section("general", _('General Permissions'), 10)

    config.declare_permission(
        "general.use", _("Use Multisite at all"),
        _("Users without this permission are not let in at all"),
        ["admin", "user", "guest"])

    config.declare_permission(
        "general.see_all", _("See all Nagios objects"),
        _("See all objects regardless of contacts and contact groups. "
          "If combined with 'perform commands' then commands may be done on all objects."
          ), ["admin", "guest"])

    config.declare_permission(
        "general.edit_views", _("Customize views and use them"),
        _("Allows to create own views, customize builtin views and use them."),
        ["admin", "user"])

    config.declare_permission(
        "general.publish_views", _("Publish views"),
        _("Make views visible and usable for other users"), ["admin", "user"])

    config.declare_permission(
        "general.see_user_views", _("See user views"),
        _("Is needed for seeing views that other users have created."),
        ["admin", "user", "guest"])

    config.declare_permission(
        "general.force_views", _("Modify builtin views"),
        _("Make own published views override builtin views for all users"),
        ["admin"])

    config.declare_permission(
        "general.view_option_columns", _("Change view display columns"),
        _("Interactively change the number of columns being displayed by a view (does not edit or customize the view)"
          ), ["admin", "user", "guest"])

    config.declare_permission(
        "general.view_option_refresh", _("Change view display refresh"),
        _("Interactively change the automatic browser reload of a view being displayed (does not edit or customize the view)"
          ), ["admin", "user"])

    config.declare_permission(
        "general.painter_options", _("Change column display options"),
        _("Some of the display columns offer options for customizing their output. "
          "For example time stamp columns can be displayed absolute, relative or "
          "in a mixed style. This permission allows the user to modify display options"
          ), ["admin", "user", "guest"])

    config.declare_permission(
        "general.act", _("Perform commands"),
        _("Allows users to perform Nagios commands. If no further permissions "
          "are granted, actions can only be done on objects one is a contact for"
          ), ["admin", "user"])

    config.declare_permission(
        "general.see_sidebar", _("Use Check_MK sidebar"),
        _("Without this permission the Check_MK sidebar will be invisible"),
        ["admin", "user", "guest"])

    config.declare_permission(
        "general.configure_sidebar", _("Configure sidebar"),
        _("This allows the user to add, move and remove sidebar snapins."),
        ["admin", "user"])

    config.declare_permission(
        'general.edit_profile', _('Edit the user profile'),
        _('Permits the user to change the user profile settings.'),
        ['admin', 'user'])

    config.declare_permission(
        'general.edit_notifications', _('Edit personal notification settings'),
        _('This allows a user to edit his personal notification settings. You also need the permission '
          '<i>Edit the user profile</i> in order to do this.'),
        ['admin', 'user'])

    config.declare_permission(
        'general.edit_user_attributes', _('Edit personal user attributes'),
        _('This allows a user to edit his personal user attributes. You also need the permission '
          '<i>Edit the user profile</i> in order to do this.'),
        ['admin', 'user'])

    config.declare_permission('general.change_password',
                              _('Edit the user password'),
                              _('Permits the user to change the password.'),
                              ['admin', 'user'])

    config.declare_permission('general.logout', _('Logout'),
                              _('Permits the user to logout.'),
                              ['admin', 'user', 'guest'])

    config.declare_permission(
        "general.ignore_soft_limit", _("Ignore soft query limit"),
        _("Allows to ignore the soft query limit imposed upon the number of datasets returned by a query"
          ), ["admin", "user"])

    config.declare_permission(
        "general.ignore_hard_limit", _("Ignore hard query limit"),
        _("Allows to ignore the hard query limit imposed upon the number of datasets returned by a query"
          ), ["admin"])

    loaded_with_language = current_language
Exemple #17
0
 def declare_permission(self, page):
     permname = "%s.%s" % (self.type_name(), page.name())
     if page.is_public() and not config.permission_exists(permname):
         config.declare_permission(permname, page.title(), page.description(), ["admin", "user", "guest"])
Exemple #18
0
from lib import *


# Python 2.3 does not have 'set' in normal namespace.
# But it can be imported from 'sets'
try:
    set()
except NameError:
    from sets import Set as set


config.declare_permission_section("bi", "BI - Check_MK Business Intelligence")
config.declare_permission("bi.see_all",
        "See all hosts and services",
        "With this permission set, the BI aggregation rules are applied to all "
        "hosts and services - not only those the user is a contact for. If you "
        "remove this permissions then the user will see incomplete aggregation "
        "trees with status based only on those items.",
        [ "admin", "guest" ])

#      ____                _              _
#     / ___|___  _ __  ___| |_ __ _ _ __ | |_ ___
#    | |   / _ \| '_ \/ __| __/ _` | '_ \| __/ __|
#    | |__| (_) | | | \__ \ || (_| | | | | |_\__ \
#     \____\___/|_| |_|___/\__\__,_|_| |_|\__|___/
#

# type of rule parameters
SINGLE = 'single'
MULTIPLE = 'multi'
Exemple #19
0
def load_plugins():
    global loaded_with_language
    if loaded_with_language == current_language:
        return

    config.declare_permission_section("general", _('General Permissions'), 10)

    config.declare_permission("general.use",
         _("Use Multisite at all"),
         _("Users without this permission are not let in at all"),
         [ "admin", "user", "guest" ])

    config.declare_permission("general.see_all",
         _("See all Nagios objects"),
         _("See all objects regardless of contacts and contact groups. "
           "If combined with 'perform commands' then commands may be done on all objects."),
         [ "admin", "guest" ])

    declare_visual_permissions('views', _("views"))
    declare_visual_permissions('dashboards', _("dashboards"))

    config.declare_permission("general.view_option_columns",
         _("Change view display columns"),
         _("Interactively change the number of columns being displayed by a view (does not edit or customize the view)"),
         [ "admin", "user", "guest" ])

    config.declare_permission("general.view_option_refresh",
         _("Change view display refresh"),
         _("Interactively change the automatic browser reload of a view being displayed (does not edit or customize the view)"),
         [ "admin", "user" ])

    config.declare_permission("general.painter_options",
         _("Change column display options"),
         _("Some of the display columns offer options for customizing their output. "
         "For example time stamp columns can be displayed absolute, relative or "
         "in a mixed style. This permission allows the user to modify display options"),
         [ "admin", "user", "guest" ])

    config.declare_permission("general.act",
         _("Perform commands"),
         _("Allows users to perform Nagios commands. If no further permissions "
           "are granted, actions can only be done on objects one is a contact for"),
         [ "admin", "user" ])

    config.declare_permission("general.see_sidebar",
         _("Use Check_MK sidebar"),
         _("Without this permission the Check_MK sidebar will be invisible"),
         [ "admin", "user", "guest" ])

    config.declare_permission("general.configure_sidebar",
         _("Configure sidebar"),
         _("This allows the user to add, move and remove sidebar snapins."),
         [ "admin", "user" ])

    config.declare_permission('general.edit_profile',
        _('Edit the user profile'),
        _('Permits the user to change the user profile settings.'),
        [ 'admin', 'user' ]
    )

    config.declare_permission('general.edit_notifications',
        _('Edit personal notification settings'),
        _('This allows a user to edit his personal notification settings. You also need the permission '
          '<i>Edit the user profile</i> in order to do this.'),
        [ 'admin', 'user' ]
    )

    config.declare_permission('general.disable_notifications',
        _('Disable all personal notifications'),
        _('This permissions provides a checkbox in the personal settings of the user that '
          'allows him to completely disable all of his notifications. Use with caution.'),
        [ 'admin', ]
    )

    config.declare_permission('general.edit_user_attributes',
        _('Edit personal user attributes'),
        _('This allows a user to edit his personal user attributes. You also need the permission '
          '<i>Edit the user profile</i> in order to do this.'),
        [ 'admin', 'user' ]
    )

    config.declare_permission('general.change_password',
        _('Edit the user password'),
        _('Permits the user to change the password.'),
        [ 'admin', 'user' ]
    )

    config.declare_permission('general.logout',
        _('Logout'),
        _('Permits the user to logout.'),
        [ 'admin', 'user', 'guest' ]
    )

    config.declare_permission("general.ignore_soft_limit",
         _("Ignore soft query limit"),
         _("Allows to ignore the soft query limit imposed upon the number of datasets returned by a query"),
         [ "admin", "user" ])

    config.declare_permission("general.ignore_hard_limit",
         _("Ignore hard query limit"),
         _("Allows to ignore the hard query limit imposed upon the number of datasets returned by a query"),
         [ "admin" ])

    config.declare_permission("general.acknowledge_werks",
         _("Acknowledge Incompatible Werks"),
         _("In the change log of the Check_MK software version the administrator can manage change log entries "
           "(Werks) that requrire user interaction. These <i>incompatible Werks</i> can be acknowledged only "
           "if the user has this permission."),
         [ "admin" ])


    loaded_with_language = current_language
def load():
    global loaded_with_language
    if loaded_with_language == current_language:
        return

    config.declare_permission_section("general", _('General Permissions'), 10)

    config.declare_permission("general.use",
         _("Use Multisite at all"),
         _("Users without this permission are not let in at all"),
         [ "admin", "user", "guest" ])

    config.declare_permission("general.see_all",
         _("See all Nagios objects"),
         _("See all objects regardless of contacts and contact groups. "
           "If combined with 'perform commands' then commands may be done on all objects."),
         [ "admin", "guest" ])

    config.declare_permission("general.edit_views",
         _("Customize views and use them"),
         _("Allows to create own views, customize builtin views and use them."),
         [ "admin", "user" ])

    config.declare_permission("general.publish_views",
         _("Publish views"),
         _("Make views visible and usable for other users"),
         [ "admin", "user" ])

    config.declare_permission("general.force_views",
         _("Modify builtin views"),
         _("Make own published views override builtin views for all users"),
         [ "admin" ])

    config.declare_permission("general.view_option_columns",
         _("Change view display columns"),
         _("Interactively change the number of columns being displayed by a view (does not edit or customize the view)"),
         [ "admin", "user", "guest" ])

    config.declare_permission("general.view_option_refresh",
         _("Change view display refresh"),
         _("Interactively change the automatic browser reload of a view being displayed (does not edit or customize the view)"),
         [ "admin", "user" ])

    config.declare_permission("general.painter_options",
         _("Change column display options"),
         _("Some of the display columns offer options for customizing their output. "
         "For example time stamp columns can be displayed absolute, relative or "
         "in a mixed style. This permission allows the user to modify display options"),
         [ "admin", "user", "guest" ])

    config.declare_permission("general.act",
         _("Perform commands"),
         _("Allows users to perform Nagios commands. If no further permissions "
           "are granted, actions can only be done on objects one is a contact for"),
         [ "admin", "user" ])

    config.declare_permission("general.see_sidebar",
         _("Use Check_MK sidebar"),
         _("Without this permission the Check_MK sidebar will be invisible"),
         [ "admin", "user", "guest" ])

    config.declare_permission("general.configure_sidebar",
         _("Configure sidebar"),
         _("This allows the user to add, move and remove sidebar snapins."),
         [ "admin", "user" ])

    config.declare_permission('general.edit_profile',
        _('Edit the user profile'),
        _('Permits the user to change the user profile settings.'),
        [ 'admin', 'user' ]
    )

    config.declare_permission('general.edit_notifications',
        _('Edit personal notification settings'),
        _('This allows a user to edit his personal notification settings. You also need the permission '
          '<i>Edit the user profile</i> in order to do this.'),
        [ 'admin', 'user' ]
    )

    config.declare_permission('general.edit_user_attributes',
        _('Edit personal user attributes'),
        _('This allows a user to edit his personal user attributes. You also need the permission '
          '<i>Edit the user profile</i> in order to do this.'),
        [ 'admin', 'user' ]
    )

    config.declare_permission('general.change_password',
        _('Edit the user password'),
        _('Permits the user to change the password.'),
        [ 'admin', 'user' ]
    )

    config.declare_permission('general.logout',
        _('Logout'),
        _('Permits the user to logout.'),
        [ 'admin', 'user', 'guest' ]
    )

    config.declare_permission("general.ignore_soft_limit",
         _("Ignore soft query limit"),
         _("Allows to ignore the soft query limit imposed upon the number of datasets returned by a query"),
         [ "admin", "user" ])

    config.declare_permission("general.ignore_hard_limit",
         _("Ignore hard query limit"),
         _("Allows to ignore the hard query limit imposed upon the number of datasets returned by a query"),
         [ "admin" ])

    loaded_with_language = current_language
Exemple #21
0
def load_plugins():
    global loaded_with_language
    if loaded_with_language == current_language:
        return

    global g_message_path
    g_message_path = config.user_confdir + '/messages.mk'

    global notify_methods
    notify_methods = {
        'gui_popup': {
            'title':  _('Popup Message in the GUI (shows up alert window)'),
            'handler': notify_gui_msg,
        },
        'gui_hint': {
            'title':  _('Send hint to message inbox (bottom of sidebar)'),
            'handler': notify_gui_msg,
        },
        'mail': {
            'title':  _('Send an E-Mail'),
            'handler': notify_mail,
        },
    }

    dest_choices = [
        ('broadcast', _('Everybody (Broadcast)')),
        ('list', _('A list of specific users'), DualListChoice(
            choices = [ (uid, u.get('alias', uid)) for uid, u in config.multisite_users.items() ],
            allow_empty = False,
        )),
        #('contactgroup', _('All members of a contact group')),
    ]

    if config.save_user_access_times:
        dest_choices.append(('online', _('All online users')))

    global vs_notify
    vs_notify = [
        ('text', TextAreaUnicode(
            title = _('Text'),
            help = _('Insert the text to be sent to all reciepents.'),
            cols = 50,
            rows = 10
        )),
        ('dest', CascadingDropdown(
            title = _('Send notification to'),
            help = _('You can send the notification to a list of multiple users, which '
                     'can be choosen out of these predefined filters.'),
            choices = dest_choices,
        )),
        ('methods', ListChoice(
            title = _('How to notify'),
            choices = [ (k, v['title']) for k, v in notify_methods.items() ],
            default_value = ['popup'],
        )),
        ('valid_till', Optional(
            AbsoluteDate(
                include_time = True,
            ),
            title = _('Automatically invalidate notification'),
            label = _('Enable automatic invalidation at'),
            help = _('It is possible to automatically delete messages when the '
                     'configured time is reached. This makes it possible to inform '
                     'users about a scheduled event but suppress the notification '
                     'after the event has happened.'),
        )),
    ]

    config.declare_permission("general.notify",
         _("Notify Users"),
         _("This permissions allows users to send notifications to the users of "
           "the monitoring system using the web interface."),
         [ "admin" ])
Exemple #22
0
 def declare_permission(self, page):
     permname = "%s.%s" % (self.type_name(), page.name())
     if page.is_public() and not config.permission_exists(permname):
         config.declare_permission(permname, page.title(),
                                   page.description(),
                                   ['admin', 'user', 'guest'])
Exemple #23
0
def load_plugins(force):
    global loaded_with_language
    if loaded_with_language == current_language and not force:
        return

    global notify_methods
    notify_methods = {
        'gui_popup': {
            'title': _('Popup Message in the GUI (shows up alert window)'),
            'handler': notify_gui_msg,
        },
        'gui_hint': {
            'title': _('Send hint to message inbox (bottom of sidebar)'),
            'handler': notify_gui_msg,
        },
        'mail': {
            'title': _('Send an E-Mail'),
            'handler': notify_mail,
        },
        'dashlet': {
            'title': _('Send hint to dashlet'),
            'handler': notify_gui_msg,
        },
    }

    dest_choices = [
        ('broadcast', _('Everybody (Broadcast)')),
        ('list', _('A list of specific users'),
         DualListChoice(
             choices=[(uid, u.get('alias', uid))
                      for uid, u in config.multisite_users.items()],
             allow_empty=False,
         )),
        #('contactgroup', _('All members of a contact group')),
    ]

    if config.save_user_access_times:
        dest_choices.append(('online', _('All online users')))

    global vs_notify
    vs_notify = [
        ('text',
         TextAreaUnicode(
             title=_('Text'),
             help=_('Insert the text to be sent to all reciepents.'),
             cols=50,
             rows=10)),
        ('dest',
         CascadingDropdown(
             title=_('Send notification to'),
             help=_(
                 'You can send the notification to a list of multiple users, which '
                 'can be choosen out of these predefined filters.'),
             choices=dest_choices,
         )),
        ('methods',
         ListChoice(
             title=_('How to notify'),
             choices=[(k, v['title']) for k, v in notify_methods.items()],
             default_value=['popup'],
         )),
        ('valid_till',
         Optional(
             AbsoluteDate(include_time=True, ),
             title=_('Automatically invalidate notification'),
             label=_('Enable automatic invalidation at'),
             help=_(
                 'It is possible to automatically delete messages when the '
                 'configured time is reached. This makes it possible to inform '
                 'users about a scheduled event but suppress the notification '
                 'after the event has happened.'),
         )),
    ]

    config.declare_permission(
        "general.notify", _("Notify Users"),
        _("This permissions allows users to send notifications to the users of "
          "the monitoring system using the web interface."), ["admin"])
Exemple #24
0
import config, re, pprint, time
import weblib
from lib import *

# Python 2.3 does not have 'set' in normal namespace.
# But it can be imported from 'sets'
try:
    set()
except NameError:
    from sets import Set as set

config.declare_permission_section("bi", "BI - Check_MK Business Intelligence")
config.declare_permission(
    "bi.see_all", "See all hosts and services",
    "With this permission set, the BI aggregation rules are applied to all "
    "hosts and services - not only those the user is a contact for. If you "
    "remove this permissions then the user will see incomplete aggregation "
    "trees with status based only on those items.", ["admin", "guest"])

#      ____                _              _
#     / ___|___  _ __  ___| |_ __ _ _ __ | |_ ___
#    | |   / _ \| '_ \/ __| __/ _` | '_ \| __/ __|
#    | |__| (_) | | | \__ \ || (_| | | | | |_\__ \
#     \____\___/|_| |_|___/\__\__,_|_| |_|\__|___/
#

# type of rule parameters
SINGLE = 'single'
MULTIPLE = 'multi'

# possible aggregated states