Skip to main content

Privileges

Overview

The purpose of this tutorial is to implement a new POS function that is protected by priliveges. The tutorial will simulate a new POS function, first checking that the user is allowed to run the function and a second that the user is authorised to run the function. If the currently logged in user is not authorised, then this tutorial will show how to ask a different user to login temporarily in order to authorise the function. This is the general flow Enactor POS function is following.

What You Will Learn

  • How to create new privileges and register them
  • How to validate whether the current user has a given privilege
  • How to trigger authorisation from a different user

Pre-requisites

  • You need to be familiar with creating Application Process and using them as Application Process Extension.
  • How privileges are configured in Enactor

Instructions

Create a Process Extension

  • Create an empty application process named PosFunctionWithPrivilege and register it in the Packages. The process should be located in Pos/Training folder.
  • Register the new process in the Packages.xml as a HandleFunctionExtension extension.
    • Name: PosFunctionWithPrivilegeExtension
    • Extension Point: HandleFunctionExtension
    • Extension URL: Pos/Training/PosFunctionWithPrivilege The Packages.xml should contain the following Package Extension:
<core:packageExtension>
<core:extensionId>PosFunctionWithPrivilegeExtension</core:extensionId>
<core:extensionPoint>HandleFunctionExtension</core:extensionPoint>
<core:applyBeforePackages/>
<core:extensionOverrides/>
<core:extensionType></core:extensionType>
<core:extensionUrl>Pos/Training/PosFunctionWithPrivilege</core:extensionUrl>
</core:packageExtension>
  • Add a new button to the Sales menu with the event WithPrivilegeEvent
  • Open the newly created Pos/Training/PosFunctionWithPrivilege application process
    • Add a starting State and add the StateEntered event
    • Drop the com.enactor.coreUI.actions.CheckEventAction from the Resource Library
    • Add the WithPrivilegeEvent and Unknown event to the outcome of the action. And name it CheckEvent
    • Add an Unknown outcome
    • Unknown Event from the should then be linked to an outcome of Unknown
    • Drag the CurrentEvent input of the CheckEventAction action onto the Inputs of the Process. When a POS function is triggered from the Sales menu, the extension will be called with the CurrentEvent set to the event configured in the menu. CopyCurrentEventToProcessInput.png
  • Use com.enactor.coreUI.actions.CallProcessWithPrivilegesAction
  • Use Pos/SignOn/CheckAuthorisation with com.enactor.coreUI.actions.CallProcessWithPrivilegesAction action.

Add the Privilege to Message Resource

Enable the Privilege for a specific role

Screenshots

[ Should include screenshots of Eclipse but also of the result (e.g. POS screenshots). ]

Exercises

[ To apply the lessons learned. It should be very similar to the training task itself. ]

Extensions

[ Any extensions to the training task (important when doing group training where one or more of the attendees are progressing faster). ]

Answers

[ Should give the answer to the exercise. Should also provide the solution of the tutorial, i.e. a zip file containing the final project. ]

See Also

[ Links to Other Training Tasks, How To Guides (related to Dev Training but also other Application and configuration). ]