core: security limit in menus
This commit is contained in:
parent
d5b255e437
commit
aad6251058
1 changed files with 8 additions and 5 deletions
|
|
@ -893,7 +893,7 @@ class SAT(service.Service):
|
|||
/!\ 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 @@ class SAT(service.Service):
|
|||
|
||||
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 @@ class SAT(service.Service):
|
|||
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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue