Difference between revisions of "Role Based Menus"

From OpenEMR Project Wiki
(Add description of where these menus appear)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
:Starting in OpenEMR 5.0.1, there is support for role based menus. There are several standard menus and there is a mechanism to support unlimited number of custom menus.
:Starting in OpenEMR 5.0.1, there is support for role based menus. There are several standard menus and there is a mechanism to support unlimited number of custom menus.
:*Main Menu
 
::*Select menu for a user in Administration->Users ('Main Menu Role' setting)
==Main Menu==
:::*Can select a standardized options (Standard, Answering Service, Front Office)
Allows customisation of OpenEMR's main menu.
:::*Can select custom options which are stored at: sites/<site>/documents/custom_menus/
:*Select menu for a user in Administration->Users ('Main Menu Role' setting)
::::*An example of this is the Custom option (note that any .json menu file stored in above location can be selected)
::*Can select a standardized options (Standard, Answering Service, Front Office)
:*Patient Summary Menu
::*Can select custom options which are stored at: sites/<site>/documents/custom_menus/
::*Select menu for a user in Administration->Users ('Patient Menu Role' setting)
:::*An example of this is the Custom option (note that any .json menu file stored in above location can be selected)
:::*Can select a standardized option
 
:::*Can select custom options which are stored at: sites/<site>/documents/custom_menus/patient_menus/
==Patient Summary Menu==
::::*An example of this is the Custom option (note that any .json menu file stored in above location can be selected)
Allows customisation of the sub-menu in the Medical Record Dashboard.
:*Select menu for a user in Administration->Users ('Patient Menu Role' setting)
::*Can select a standardized option
::*Can select custom options which are stored at: sites/<site>/documents/custom_menus/patient_menus/
:::*An example of this is the Custom option (note that any .json menu file stored in above location can be selected)
 
==Custom Menu Development Explanation==
 
When developing a custom menu each menu item has the following fields
{| class='table-striped table'
!Property
!Explanation
|-
|label
|The English human readable label that will be displayed to the user.  This value will be translated to other languages.
|-
|menu_id
|The unique string identifier that represents this menu item and can be used / referenced in code and module extensions
|-
|target
|The tab/screen that you want this menu to open or update.  If an existing tab with this target is already open, clicking on this menu will replace that tab/screen's contents.  Otherwise it will open a new tab/screen inside OpenEMR.
|-
|url
|The unique URL that will be opened when a user clicks this menu item.
|-
|children
|A JSON array of custom menu items (that follow the same format as described in this table) that will show underneath this menu item when it is hovered over
|-
|requirement
|A integer value between 0-5 that represents data that must be loaded and available from inside the OpenEMR interface.
:0 - No additional data requirements
:1 - The menu item will only display if a patient is being viewed or selected inside OpenEMR
:2,3 - The menu item will only display if an encounter is being viewed or has been selected inside OpenEMR
:4 - The menu item will only display if a Therapy Group has been selected (note Therapy Groups must be enabled in globals for this feature to be available)
:5 - The menu item will only display if a Therapy Group and an encounter is being viewed or has been selected.
|-
|acl_req
|The Access Control List (ACL) to use for restricting access to this menu item.  A single ACL can be provided with an ACL array of [section, value], or multiple ACLS can used with an array of [ACL, ACL,...].  If multiple ACLs are provided, the menu is displayed if the currently logged in user has access to any ACL.
|-
|global_req
|The menu item will display if the specified OpenEMR global setting exists and is truthy.  You can negate this by putting an '''!''' in front of the global setting name.  An array of global settings can be passed into this property.  If any setting is truthy, it will display the menu item.
|-
|global_req_strict
|The menu item will display only if ALL of the global settings exist and are truthy (or not Truthy if negated via '''!''') 
|}
 
An example menu item is below
<pre>
    {
        "label": "Portal Dashboard",
        "menu_id": "por2",
        "target": "por",
        "url": "/portal/patient/provider",
        "children": [],
        "requirement": 0,
        "global_req_strict": "portal_onsite_two_enable",
        "acl_req": [
          "patientportal",
          "portal"
        ]
      }
</pre>

Latest revision as of 12:13, 24 August 2022

Starting in OpenEMR 5.0.1, there is support for role based menus. There are several standard menus and there is a mechanism to support unlimited number of custom menus.

Main Menu

Allows customisation of OpenEMR's main menu.

  • Select menu for a user in Administration->Users ('Main Menu Role' setting)
  • Can select a standardized options (Standard, Answering Service, Front Office)
  • Can select custom options which are stored at: sites/<site>/documents/custom_menus/
  • An example of this is the Custom option (note that any .json menu file stored in above location can be selected)

Patient Summary Menu

Allows customisation of the sub-menu in the Medical Record Dashboard.

  • Select menu for a user in Administration->Users ('Patient Menu Role' setting)
  • Can select a standardized option
  • Can select custom options which are stored at: sites/<site>/documents/custom_menus/patient_menus/
  • An example of this is the Custom option (note that any .json menu file stored in above location can be selected)

Custom Menu Development Explanation

When developing a custom menu each menu item has the following fields

Property Explanation
label The English human readable label that will be displayed to the user. This value will be translated to other languages.
menu_id The unique string identifier that represents this menu item and can be used / referenced in code and module extensions
target The tab/screen that you want this menu to open or update. If an existing tab with this target is already open, clicking on this menu will replace that tab/screen's contents. Otherwise it will open a new tab/screen inside OpenEMR.
url The unique URL that will be opened when a user clicks this menu item.
children A JSON array of custom menu items (that follow the same format as described in this table) that will show underneath this menu item when it is hovered over
requirement A integer value between 0-5 that represents data that must be loaded and available from inside the OpenEMR interface.
0 - No additional data requirements
1 - The menu item will only display if a patient is being viewed or selected inside OpenEMR
2,3 - The menu item will only display if an encounter is being viewed or has been selected inside OpenEMR
4 - The menu item will only display if a Therapy Group has been selected (note Therapy Groups must be enabled in globals for this feature to be available)
5 - The menu item will only display if a Therapy Group and an encounter is being viewed or has been selected.
acl_req The Access Control List (ACL) to use for restricting access to this menu item. A single ACL can be provided with an ACL array of [section, value], or multiple ACLS can used with an array of [ACL, ACL,...]. If multiple ACLs are provided, the menu is displayed if the currently logged in user has access to any ACL.
global_req The menu item will display if the specified OpenEMR global setting exists and is truthy. You can negate this by putting an ! in front of the global setting name. An array of global settings can be passed into this property. If any setting is truthy, it will display the menu item.
global_req_strict The menu item will display only if ALL of the global settings exist and are truthy (or not Truthy if negated via !)

An example menu item is below

     {
        "label": "Portal Dashboard",
        "menu_id": "por2",
        "target": "por",
        "url": "/portal/patient/provider",
        "children": [],
        "requirement": 0,
        "global_req_strict": "portal_onsite_two_enable",
        "acl_req": [
          "patientportal",
          "portal"
        ]
      }