Restrict a UI element

Code must be added whenever a new restriction is needed:

  1. Add a suggestion to lib/settings/
    1. Follow a URL-like pattern, for example agent/accountsReceivable/makePayment
    2. optgroup is a readable category, for example Agent Accounts Receivable
  2. Check the new permission path in the get block of the page in which you are working, for example (“${check_permissions(‘agent/policies/accountsReceivable/makePayment’)}” == ‘True’)
    1. check_permissions defaults to requiring the read permission and may need to be imported into the page template
  3. Add Javascript/HTML to control the visibility of the new element
    1. New KO pages
      1. Use <element data-bind=”visible: get.permissionVar”> OR
      2. Use the get.permissionVar in a computed function
    2. Legacy pages
      1. Track down the relevant build or draw function
      2. Use get.permissionVar and $$(‘el-selector’).show() or hide()
  4. Once the code is in place, build the rule as you would when restricting a module or page