Standards, best practices and how-tos for developing OutSystems applications
Following ADR 3 Core Services must be secured we will always check the authentication and authorization in server side logic.
Each server action must include the following checks
We can easily implement this by using the Check<name>Role(UserId:) function. As a consequence we need an authentication method for system tasks such as timers and processes because there is no user there. For this we will use a “Service Account” to login before performing logic in Timers, BPT etc.
For uniform and easy implementation you must use the TemplateRoleCheck logic from the CoreServicesStencil_Pat module:
Checks if the user has the Template role and throws a not registered exception if False

TemplateRoleCheck to the security moduleTemplateRoleCheck to <YourRoleName>RoleCheck and replace the CheckTemplateRole action by
Check<YourRoleName>RoleExample Action to login the ServiceAccount
Example how to use a system account in Timers, BPT, etc.
