Mercurial > libervia-backend
diff src/core/sat_main.py @ 809:743b757777d3
core: security limit in menus
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 04 Feb 2014 18:32:39 +0100 |
parents | be4c5e24dab9 |
children | 1fe00f0c9a91 |
line wrap: on
line diff
--- a/src/core/sat_main.py Tue Feb 04 18:32:33 2014 +0100 +++ b/src/core/sat_main.py Tue Feb 04 18:32:39 2014 +0100 @@ -893,7 +893,7 @@ /!\ use D_() instead of _() for translations (e.g. (D_("File"), D_("Open"))) @param callback: method to be called when menuitem is selected, callable or a callback id (string) as returned by [registerCallback] @param security_limit: %(doc_security_limit)s - /!\ security_limit MUST be added to data in launchCallback if used + /!\ security_limit MUST be added to data in launchCallback if used #TODO @param help_string: string used to indicate what the menu do (can be show as a tooltip). /!\ use D_() instead of _() for translations @param type: one of: @@ -932,7 +932,7 @@ return callback_id - def getMenus(self, language='', security_limit = NO_SECURITY_LIMIT): + def getMenus(self, language='', security_limit=NO_SECURITY_LIMIT): """Return all menus registered @param language: language used for translation, or empty string for default @param security_limit: %(doc_security_limit)s @@ -947,6 +947,9 @@ for menu_id, menu_data in self._menus.iteritems(): type_ = menu_data['type'] path = menu_data['path'] + menu_security_limit = menu_data['security_limit'] + if security_limit!=NO_SECURITY_LIMIT and (menu_security_limit==NO_SECURITY_LIMIT or menu_security_limit>security_limit): + continue languageSwitch(language) path_i18n = [_(elt) for elt in path] languageSwitch()