1 from unfold.plugin import Plugin
3 class ValidateButton (Plugin):
5 """This plugin is designed to work together with topmenu.
7 It will check to see if user has PI rights at least on one authority,
8 and if so will enable corresponding button in topmenu.
10 A realistic example would have incoming query as
12 Query.get('ple:user').filter_by('user_hrn', '==', '$user_hrn').select('pi_authorities')
16 def __init__ (self, query=None, button_domid=None, **settings):
17 Plugin.__init__ (self, **settings)
20 query = Query.get('ple:user').filter_by('user_hrn', '==', '$user_hrn').select('pi_authorities')
21 if button_domid is None: button_domid="topmenu-validate"
23 self.button_domid=button_domid
25 # this does not have any materialization
26 def render_content (self, request):
29 def requirements (self):
30 return { 'js_files': [ 'js/validatebutton.js', 'js/manifold-query.js', ], }
32 def json_settings_list (self):
33 return [ 'query_uuid', 'button_domid', ]