{"action":"created","issue":{"url":"https://api.github.com/repos/inveniosoftware/flask-menu/issues/31","labels_url":"https://api.github.com/repos/inveniosoftware/flask-menu/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/inveniosoftware/flask-menu/issues/31/comments","events_url":"https://api.github.com/repos/inveniosoftware/flask-menu/issues/31/events","html_url":"https://github.com/inveniosoftware/flask-menu/issues/31","id":62763027,"number":31,"title":"Some doubts about usage","user":{"login":"fmerges","id":94341,"avatar_url":"https://avatars.githubusercontent.com/u/94341?v=3","gravatar_id":"","url":"https://api.github.com/users/fmerges","html_url":"https://github.com/fmerges","followers_url":"https://api.github.com/users/fmerges/followers","following_url":"https://api.github.com/users/fmerges/following{/other_user}","gists_url":"https://api.github.com/users/fmerges/gists{/gist_id}","starred_url":"https://api.github.com/users/fmerges/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fmerges/subscriptions","organizations_url":"https://api.github.com/users/fmerges/orgs","repos_url":"https://api.github.com/users/fmerges/repos","events_url":"https://api.github.com/users/fmerges/events{/privacy}","received_events_url":"https://api.github.com/users/fmerges/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/inveniosoftware/flask-menu/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":{"login":"jirikuncar","id":189798,"avatar_url":"https://avatars.githubusercontent.com/u/189798?v=3","gravatar_id":"","url":"https://api.github.com/users/jirikuncar","html_url":"https://github.com/jirikuncar","followers_url":"https://api.github.com/users/jirikuncar/followers","following_url":"https://api.github.com/users/jirikuncar/following{/other_user}","gists_url":"https://api.github.com/users/jirikuncar/gists{/gist_id}","starred_url":"https://api.github.com/users/jirikuncar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jirikuncar/subscriptions","organizations_url":"https://api.github.com/users/jirikuncar/orgs","repos_url":"https://api.github.com/users/jirikuncar/repos","events_url":"https://api.github.com/users/jirikuncar/events{/privacy}","received_events_url":"https://api.github.com/users/jirikuncar/received_events","type":"User","site_admin":false},"milestone":null,"comments":6,"created_at":"2015-03-18T18:10:28Z","updated_at":"2015-04-07T19:27:26Z","closed_at":null,"body":"Hello,\r\n\r\nI have several questions regarding using Flask-Breadcrumbs and Flask-Menu.\r\n\r\nFollowing the example of Flask-Breadcrumbs I get as the first menu entry a 'Menu item not initialised'.\r\n\r\nThen is there a way to define the menu hierarchy not based on the endpoint? because for instance I have a view with a path argument in order to catch with it a multitude of pages-subpages, so currently I'm using the dynamic_list_constructor option, but that doesn't register the menu entries so that later I can say: this view is going to be at 'grandparent.parent.here', because that would not be initialised...\r\n\r\nThanks,"},"comment":{"url":"https://api.github.com/repos/inveniosoftware/flask-menu/issues/comments/90706604","html_url":"https://github.com/inveniosoftware/flask-menu/issues/31#issuecomment-90706604","issue_url":"https://api.github.com/repos/inveniosoftware/flask-menu/issues/31","id":90706604,"user":{"login":"jirikuncar","id":189798,"avatar_url":"https://avatars.githubusercontent.com/u/189798?v=3","gravatar_id":"","url":"https://api.github.com/users/jirikuncar","html_url":"https://github.com/jirikuncar","followers_url":"https://api.github.com/users/jirikuncar/followers","following_url":"https://api.github.com/users/jirikuncar/following{/other_user}","gists_url":"https://api.github.com/users/jirikuncar/gists{/gist_id}","starred_url":"https://api.github.com/users/jirikuncar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jirikuncar/subscriptions","organizations_url":"https://api.github.com/users/jirikuncar/orgs","repos_url":"https://api.github.com/users/jirikuncar/repos","events_url":"https://api.github.com/users/jirikuncar/events{/privacy}","received_events_url":"https://api.github.com/users/jirikuncar/received_events","type":"User","site_admin":false},"created_at":"2015-04-07T19:27:26Z","updated_at":"2015-04-07T19:27:26Z","body":"In your case you need a function that returns a function (*function factory*).\r\n\r\n**Example:**\r\n```python\r\nfrom flask_login import current_user\r\n\r\ndef has_role(role_id):\r\n    def decider():\r\n        return role_id in current_user['roles']\r\n    return decider\r\n\r\n@menu.register_menu(app, '.providers', 'Provider Report', order=0, visible_when=has_role(1))\r\ndef list_providers():\r\n    # ....\r\n```"}}