Creating a workflow for an admin panel with distinct roles for requesting and approving actions involves defining a series of steps and permissions. Below is a basic outline of the workflow, along with the roles and their respective responsibilities. Keep in mind that the actual implementation may vary depending on your specific requirements and the technology stack you are using.
Requester Role:
Can initiate actions or requests.
Submits necessary information for the requested action.
Limited permissions, primarily focused on initiating requests.
Approver Role:
Request Initiation:
The Requester logs into the admin panel.
Navigate to the section for initiating actions or requests.
Fills out a request form, providing all necessary details.
Submit the request.
Request Review:
The system logs the request and notifies the Approver role.
The Approver logs into the admin panel.
Navigate to the pending requests section.
Review the details of the request.
Approval Process:
The Approver has the option to approve or reject the request.
If approved, the system proceeds with the requested action.
If rejected, the system notifies the Requester with a reason for rejection.
Action Execution:
If the request is approved, the system executes the requested action.
This may involve database updates, changes in configurations, or other relevant operations.
Status Updates:
Notification:
Both the Requester and Approver receive notifications on the status of the request.
Notifications may be in-app alerts, emails, or any other preferred communication method.
Customize this basic outline according to your specific requirements, and consider involving stakeholders and end-users in the design process to ensure the workflow meets their needs effectively.
New Workflow:
Component: Web Component Selection
Assignee User:
Selection of the person to whom the task will be assigned by choosing a task solution in the Workspace - openTasks section. Only this user will see the creation of the task.
Assignee Role:
Only users with the selected role will be assigned to choose a solution for a task in the Workspace - openTasks section.
Assignee Permission:
Only users with selected access will be assigned to select a solution for a task in the Workspace -openTasks section.
Params Key:
Specify the key in which the data will be displayed when selecting a decision for the open task. By default, it is initialData
Outport N:
A solution to the given task that will progress to the next node in the chain.
Name: The name of the solution
Primary: The button will be painted in the basic color of the platform (oriented towards a positive decision)
Danger: The button will be painted in red (oriented towards request rejection)
+ Add Out Port: Adding additional options for solving the problem
In: This signifies the connection of the previous node and the transfer of data regarding the task.
Out Port: This port serves as the departure point for the request to move to the next connected node or exit. Multiple ports may exist, depending on the options created for problem resolution.
actionCall [Call any action of any service]
Action: A functionality accessible within the GraphQL endpoint of the project, which can be invoked with the provided parameters.
Params Key: The key containing the data passed to the function call. Default is initialData.
Result Key: A key containing data from the function — standard result.
In: Connects the previous node and transfers data.
Success: Connects to the next node upon successful execution of the function.
Error: Connects to the next node when execution fails.
CheckPermissions [Check permissions]
Params Key: Specifies the key containing the employee's permissions whose access needs to be checked. The default is initialMeta.permissions
Permissions: Selection of permissions that will determine the transition to the true port.
In: Connects the previous node and transfers data.
True: Connects to the next node if the selected accesses match the selected employee's access.
False: Connects to the next node if the selected accesses do not match the selected employee's access.
checkRoles [Check roles]
Params Key: Specifies the key containing the ID of the employee whose roles need to be checked. The default is initialMeta.user.id
Roles: The selection of roles will determine the transition to the true port.
In: Connects the previous node and transfers data.
True: Connects to the next node if the selected roles match the role of the selected user.
False: Connects to the next node if the selected roles do not match the selected user's role.
copy [Copy data]
From: The key containing the data to be copied.
To: The key where the data to be copied will be located.
+Add Copy action: Creates additional keys whose data will be copied to other keys.
In: Connects the previous node and transfers data.
Out: Connects to the next node and transmits data.
delete [Delete values]
Delete Item: A key with a value that will be deleted and passed on without this data.
Add Delete action: Adds fields where the key for deleting data will be specified.
In: Connects the previous node and transfers data.
Out: Connects to the next node and transmits data.
if [If condition]
Condition: Description of the condition under which the connection of the next node will be directed through the true output. For example, wallets.length > 0.
In: Connects the previous node and transfers data.
True: Connects to the next node and transfers data when the specified condition is met.
False: Connects to the next node and transfers data if the specified condition is not fulfilled.
set [Set values]
Key: The identifier where the transferred data in the Value field will be stored.
Type: The data type to be saved:
String
Number
Boolean
Expression
When selecting ‘Expression’, - concatenate strings with values to return a string type. For example, "Create a new currency: " + initialData.id, where initialData.id represents the ID of the new currency. The resulting value might be, for instance, "Create a new currency: USDT".
Value: The data to be saved.
Add Set action: Adds another block for setting data.
In: Connects the previous node and transfers data.
Out: Connects to the next node and transmits data.
startNode [Starting point of any workflow]
Out: Establishes the connection to the next node and facilitates the transfer of data.
endNode [End point of workflow]
In: Connects the previous node and completes the Workflow execution.
In this guide, we'll explore the process of constructing a workflow system that incorporates both requester and approver employees, task creation, decision-making, and seamless workflow operation without requiring approval configuration from a super-admin. Additionally, we'll delve into the management of permissions for employee roles, auditing logs, and tracking runtimes during and after the approver's decision.
To manage workflows effectively, an employee needs permission to editWorkflow and viewWorkflows for their role, including the ability to edit workflows and view existing workflows.
The next step is to assign the appropriate role to the employee.
So, now an employee with the email qa@tunex.io has the role ‘superadmin’ with permissions ‘editWorkflow’ and ‘viewWorkflows’
Login to Puppeteer with the credentials qa@tunex.io and navigate to the Configurations page. Once there, locate the "Workflows" sub-menu. Click on it to access the workflows section. Now, press the "+" button to initiate the creation of a new workflow. Let's embark on the journey of creating a process specifically designed for updating existing Currency configurations.
Give the workflow a unique name such as "updateCurrency." Next, select the initial component that should be used in the workflow.
After successfully creating the workflow, there will automatically be a start node and an end node.
In the following workflow, the first step is to check employee permissions. To determine the possibility of editing currency configurations or making requests for edits, the employee's role should have permission to viewCurrencies and editCurrency. Therefore, it makes sense to add a 'check permission' node where these permissions are verified. In the event that the employee lacks such permissions, the workflow will proceed to the 'end' node.
If the workflow is simple enough and there is no need to check anything else except permissions, the next step is to add an action call that launches the expected result.
As observed in the following workflow: if the employee passes through the permissions check, the subsequent step will involve an action with currencies.updateCurrency. Afterward, the success and error flows will lead to the end node.
As an admin with permissions to edit employee and role configurations, add the viewCurrencies and editCurrency permissions for the employee role. This will simplify configurations for updating currency configurations related to Currency.
Login to Puppeteer with the credentials businessanalyst@marionette.dev and navigate to the Configurations page. Once there, locate the "Currencies" sub-menu.
For example, an employee with these permissions can update currency position, precision, and name
The audit logs for such workflow will be the following:
Full Audit logs code for Workflow
{
"initialData": {
"name": "ETHEREUM",
"id": "ETH",
"precision": 8,
"position": 2,
"lightBgColor1": "#4c6fc2",
"lightBgColor2": "#7ca5eb",
"lightTextColor": "#ffffff",
"darkBgColor1": "#4c6fc2",
"darkBgColor2": "#19409c",
"darkTextColor": "#ffffff",
"userBalanceEnable": true,
"enabled": true,
"hide": false,
"trading_commission_enabled": true,
"payout_fee": 1,
"min_payout_fee": 0.001,
"max_payout_fee": 1
},
"initialMeta": {
"userIP": "176.120.105.193",
"userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0",
"method": "POST",
"path": "api/v2/",
"decodedUser": {
"exp": 1715503657,
"sub": "session",
"iss": "marionette",
"aud": [
"marionette"
],
"jti": "b0ebeba5-79b1-4e28-b22e-ba0ed1c3635d",
"uid": "872a9c32db4545e8ac731551fb61c227",
"email": "businessanalyst@marionette.dev",
"role": "admin",
"level": 3,
"state": "active",
"referral_id": null
},
"user": {
"id": "872a9c32db4545e8ac731551fb61c227",
"email": "businessanalyst@marionette.dev",
"password": "sha256$4be643c4$1$95c93926a1850e210d379a4922c03cc7f397828e090c0cd9fac794af4447d065",
"username": null,
"role": "ADMIN",
"state": "active",
"referralId": null,
"referralGroupId": null,
"locale": null,
"email_verified": false,
"phone_verified": false,
"profile_verified": false,
"isPhone": null,
"data": null,
"otp": false,
"enabled2fa": false,
"secret2fa": "",
"googleIdentity": false,
"softban": false,
"createdAt": "2024-02-13T18:50:17.000Z",
"updatedAt": "2024-04-12T08:44:05.000Z"
},
"permissions": [
"editCurrency",
"viewCurrencies"
],
"token": "eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE3MTU1MDM2NTcsInN1YiI6InNlc3Npb24iLCJpc3MiOiJtYXJpb25ldHRlIiwiYXVkIjpbIm1hcmlvbmV0dGUiXSwianRpIjoiYjBlYmViYTUtNzliMS00ZTI4LWIyMmUtYmEwZWQxYzM2MzVkIiwidWlkIjoiODcyYTljMzJkYjQ1NDVlOGFjNzMxNTUxZmI2MWMyMjciLCJlbWFpbCI6ImJ1c2luZXNzYW5hbHlzdEBtYXJpb25ldHRlLmRldiIsInJvbGUiOiJhZG1pbiIsImxldmVsIjozLCJzdGF0ZSI6ImFjdGl2ZSIsInJlZmVycmFsX2lkIjpudWxsfQ.2meEWB_-1J1veu86q201--x5NduugDMRHWX_vwActqsyz_62RhkXICU41J9g8A6TzxoaYPncxdEypvnzIFunz6Xvx70JM-03cCPsJ74Lz6LGNt2KApkNkuJ_vdMVzqtpVp-RxNnylnqgwtHISjShEtBs8cCVvXWTfGJYh_FvC6AWccZt8hI6sHNzP3yVhz13BPJlejOYF4OYyh3iNPXlj3PkT9lfm7szyuWrBCD4gLKtABhzj2W8VWJOuhTmv8M4yw5teCH5rxobL9838r8qEcOsm6SM6fSmyVtpbxcdI8K0b1UJWcxhY5D0SYKWCLSd4n4GBA9ubvJVHIGFZcurqg",
"isApiKey": false
}
}
Full Audit logs for Action call
{
"params": {
"name": "ETHEREUM",
"id": "ETH",
"precision": 8,
"position": 2,
"lightBgColor1": "#4c6fc2",
"lightBgColor2": "#7ca5eb",
"lightTextColor": "#ffffff",
"darkBgColor1": "#4c6fc2",
"darkBgColor2": "#19409c",
"darkTextColor": "#ffffff",
"userBalanceEnable": true,
"enabled": true,
"hide": false,
"trading_commission_enabled": true,
"payout_fee": 1,
"min_payout_fee": 0.001,
"max_payout_fee": 1
},
"result": {
"id": "ETH",
"name": "ETHEREUM",
"userBalanceEnable": true,
"lightBgColor1": "#4c6fc2",
"lightBgColor2": "#7ca5eb",
"darkBgColor1": "#4c6fc2",
"darkBgColor2": "#19409c",
"lightTextColor": "#ffffff",
"darkTextColor": "#ffffff",
"icon_url": "https://devtunexio.sfo2.digitaloceanspaces.com/e3f46f79-a95f-40d5-bb19-3560b86de532.svg",
"precision": 8,
"enabled": true,
"position": 2,
"trading_commission_enabled": true,
"hide": false,
"staking_enabled": false,
"staking_period": "*/10 * * * *",
"staking_apr": 150,
"last_staking_calc": 1703838600000,
"min_staking_amount": 0.01,
"instant_unstaking": true,
"payout_fee": 1,
"min_payout_fee": 0.001,
"max_payout_fee": 1,
"createdAt": "2023-05-10T06:21:09.000Z",
"updatedAt": "2024-04-12T08:55:35.436Z"
}
}
The runtimes for such workflow will be the following:
Runtime details
{
"initialData": {
"name": "ETHEREUM",
"id": "ETH",
"precision": 8,
"position": 2,
"lightBgColor1": "#4c6fc2",
"lightBgColor2": "#7ca5eb",
"lightTextColor": "#ffffff",
"darkBgColor1": "#4c6fc2",
"darkBgColor2": "#19409c",
"darkTextColor": "#ffffff",
"userBalanceEnable": true,
"enabled": true,
"hide": false,
"trading_commission_enabled": true,
"payout_fee": 1,
"min_payout_fee": 0.001,
"max_payout_fee": 1
},
"initialMeta": {
"userIP": "176.120.105.193",
"userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0",
"method": "POST",
"path": "api/v2/",
"decodedUser": {
"exp": 1715503657,
"sub": "session",
"iss": "marionette",
"aud": [
"marionette"
],
"jti": "b0ebeba5-79b1-4e28-b22e-ba0ed1c3635d",
"uid": "872a9c32db4545e8ac731551fb61c227",
"email": "businessanalyst@marionette.dev",
"role": "admin",
"level": 3,
"state": "active",
"referral_id": null
},
"user": {
"id": "872a9c32db4545e8ac731551fb61c227",
"email": "businessanalyst@marionette.dev",
"password": "sha256$4be643c4$1$95c93926a1850e210d379a4922c03cc7f397828e090c0cd9fac794af4447d065",
"username": null,
"role": "ADMIN",
"state": "active",
"referralId": null,
"referralGroupId": null,
"locale": null,
"email_verified": false,
"phone_verified": false,
"profile_verified": false,
"isPhone": null,
"data": null,
"otp": false,
"enabled2fa": false,
"secret2fa": "",
"googleIdentity": false,
"softban": false,
"createdAt": "2024-02-13T18:50:17.000Z",
"updatedAt": "2024-04-12T08:44:05.000Z"
},
"permissions": [
"editCurrency",
"viewCurrencies"
],
"token": "eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE3MTU1MDM2NTcsInN1YiI6InNlc3Npb24iLCJpc3MiOiJtYXJpb25ldHRlIiwiYXVkIjpbIm1hcmlvbmV0dGUiXSwianRpIjoiYjBlYmViYTUtNzliMS00ZTI4LWIyMmUtYmEwZWQxYzM2MzVkIiwidWlkIjoiODcyYTljMzJkYjQ1NDVlOGFjNzMxNTUxZmI2MWMyMjciLCJlbWFpbCI6ImJ1c2luZXNzYW5hbHlzdEBtYXJpb25ldHRlLmRldiIsInJvbGUiOiJhZG1pbiIsImxldmVsIjozLCJzdGF0ZSI6ImFjdGl2ZSIsInJlZmVycmFsX2lkIjpudWxsfQ.2meEWB_-1J1veu86q201--x5NduugDMRHWX_vwActqsyz_62RhkXICU41J9g8A6TzxoaYPncxdEypvnzIFunz6Xvx70JM-03cCPsJ74Lz6LGNt2KApkNkuJ_vdMVzqtpVp-RxNnylnqgwtHISjShEtBs8cCVvXWTfGJYh_FvC6AWccZt8hI6sHNzP3yVhz13BPJlejOYF4OYyh3iNPXlj3PkT9lfm7szyuWrBCD4gLKtABhzj2W8VWJOuhTmv8M4yw5teCH5rxobL9838r8qEcOsm6SM6fSmyVtpbxcdI8K0b1UJWcxhY5D0SYKWCLSd4n4GBA9ubvJVHIGFZcurqg",
"isApiKey": false
},
"result": {
"id": "ETH",
"name": "ETHEREUM",
"userBalanceEnable": true,
"lightBgColor1": "#4c6fc2",
"lightBgColor2": "#7ca5eb",
"darkBgColor1": "#4c6fc2",
"darkBgColor2": "#19409c",
"lightTextColor": "#ffffff",
"darkTextColor": "#ffffff",
"icon_url": "https://devtunexio.sfo2.digitaloceanspaces.com/e3f46f79-a95f-40d5-bb19-3560b86de532.svg",
"precision": 8,
"enabled": true,
"position": 2,
"trading_commission_enabled": true,
"hide": false,
"staking_enabled": false,
"staking_period": "*/10 * * * *",
"staking_apr": 150,
"last_staking_calc": 1703838600000,
"min_staking_amount": 0.01,
"instant_unstaking": true,
"payout_fee": 1,
"min_payout_fee": 0.001,
"max_payout_fee": 1,
"createdAt": "2023-05-10T06:21:09.000Z",
"updatedAt": "2024-04-12T08:55:35.436Z"
}
}
There is the possibility to add a Role check node. If an employee has permission to update currency but their role is unexpected for such a workflow, it would end the workflow. However, if the role of the employee is correct, the workflow will proceed with an Action call to currencies.updateCurrency.
Login to Puppeteer with the credentials businessanalyst@marionette.dev and navigate to the Configurations page. Once there, locate the "Currencies" sub-menu.
For example, if an employee does not have the 'superadmin' role (as indicated by the role check node), they attempt to update currency user balance enabled, hidden, and trading commission enabled.
The audit logs for such workflow will be the following:
Full Audit logs code for Workflow
{
"initialData": {
"name": "ETHEREUM",
"id": "ETH",
"precision": 8,
"position": 2,
"lightBgColor1": "#4c6fc2",
"lightBgColor2": "#7ca5eb",
"lightTextColor": "#ffffff",
"darkBgColor1": "#4c6fc2",
"darkBgColor2": "#19409c",
"darkTextColor": "#ffffff",
"userBalanceEnable": false,
"enabled": true,
"hide": true,
"trading_commission_enabled": false,
"payout_fee": 1,
"min_payout_fee": 0.001,
"max_payout_fee": 1
},
"initialMeta": {
"userIP": "176.120.105.193",
"userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0",
"method": "POST",
"path": "api/v2/",
"decodedUser": {
"exp": 1715503657,
"sub": "session",
"iss": "marionette",
"aud": [
"marionette"
],
"jti": "b0ebeba5-79b1-4e28-b22e-ba0ed1c3635d",
"uid": "872a9c32db4545e8ac731551fb61c227",
"email": "businessanalyst@marionette.dev",
"role": "admin",
"level": 3,
"state": "active",
"referral_id": null
},
"user": {
"id": "872a9c32db4545e8ac731551fb61c227",
"email": "businessanalyst@marionette.dev",
"password": "sha256$4be643c4$1$95c93926a1850e210d379a4922c03cc7f397828e090c0cd9fac794af4447d065",
"username": null,
"role": "ADMIN",
"state": "active",
"referralId": null,
"referralGroupId": null,
"locale": null,
"email_verified": false,
"phone_verified": false,
"profile_verified": false,
"isPhone": null,
"data": null,
"otp": false,
"enabled2fa": false,
"secret2fa": "",
"googleIdentity": false,
"softban": false,
"createdAt": "2024-02-13T18:50:17.000Z",
"updatedAt": "2024-04-12T08:44:05.000Z"
},
"permissions": [
"editCurrency",
"viewCurrencies"
],
"token": "eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE3MTU1MDM2NTcsInN1YiI6InNlc3Npb24iLCJpc3MiOiJtYXJpb25ldHRlIiwiYXVkIjpbIm1hcmlvbmV0dGUiXSwianRpIjoiYjBlYmViYTUtNzliMS00ZTI4LWIyMmUtYmEwZWQxYzM2MzVkIiwidWlkIjoiODcyYTljMzJkYjQ1NDVlOGFjNzMxNTUxZmI2MWMyMjciLCJlbWFpbCI6ImJ1c2luZXNzYW5hbHlzdEBtYXJpb25ldHRlLmRldiIsInJvbGUiOiJhZG1pbiIsImxldmVsIjozLCJzdGF0ZSI6ImFjdGl2ZSIsInJlZmVycmFsX2lkIjpudWxsfQ.2meEWB_-1J1veu86q201--x5NduugDMRHWX_vwActqsyz_62RhkXICU41J9g8A6TzxoaYPncxdEypvnzIFunz6Xvx70JM-03cCPsJ74Lz6LGNt2KApkNkuJ_vdMVzqtpVp-RxNnylnqgwtHISjShEtBs8cCVvXWTfGJYh_FvC6AWccZt8hI6sHNzP3yVhz13BPJlejOYF4OYyh3iNPXlj3PkT9lfm7szyuWrBCD4gLKtABhzj2W8VWJOuhTmv8M4yw5teCH5rxobL9838r8qEcOsm6SM6fSmyVtpbxcdI8K0b1UJWcxhY5D0SYKWCLSd4n4GBA9ubvJVHIGFZcurqg",
"isApiKey": false
}
}
The runtimes for such workflow will be the following:
Runtime details
{
"initialData": {
"name": "ETHEREUM",
"id": "ETH",
"precision": 8,
"position": 2,
"lightBgColor1": "#4c6fc2",
"lightBgColor2": "#7ca5eb",
"lightTextColor": "#ffffff",
"darkBgColor1": "#4c6fc2",
"darkBgColor2": "#19409c",
"darkTextColor": "#ffffff",
"userBalanceEnable": false,
"enabled": true,
"hide": true,
"trading_commission_enabled": false,
"payout_fee": 1,
"min_payout_fee": 0.001,
"max_payout_fee": 1
},
"initialMeta": {
"userIP": "176.120.105.193",
"userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0",
"method": "POST",
"path": "api/v2/",
"decodedUser": {
"exp": 1715503657,
"sub": "session",
"iss": "marionette",
"aud": [
"marionette"
],
"jti": "b0ebeba5-79b1-4e28-b22e-ba0ed1c3635d",
"uid": "872a9c32db4545e8ac731551fb61c227",
"email": "businessanalyst@marionette.dev",
"role": "admin",
"level": 3,
"state": "active",
"referral_id": null
},
"user": {
"id": "872a9c32db4545e8ac731551fb61c227",
"email": "businessanalyst@marionette.dev",
"password": "sha256$4be643c4$1$95c93926a1850e210d379a4922c03cc7f397828e090c0cd9fac794af4447d065",
"username": null,
"role": "ADMIN",
"state": "active",
"referralId": null,
"referralGroupId": null,
"locale": null,
"email_verified": false,
"phone_verified": false,
"profile_verified": false,
"isPhone": null,
"data": null,
"otp": false,
"enabled2fa": false,
"secret2fa": "",
"googleIdentity": false,
"softban": false,
"createdAt": "2024-02-13T18:50:17.000Z",
"updatedAt": "2024-04-12T08:44:05.000Z"
},
"permissions": [
"editCurrency",
"viewCurrencies"
],
"token": "eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE3MTU1MDM2NTcsInN1YiI6InNlc3Npb24iLCJpc3MiOiJtYXJpb25ldHRlIiwiYXVkIjpbIm1hcmlvbmV0dGUiXSwianRpIjoiYjBlYmViYTUtNzliMS00ZTI4LWIyMmUtYmEwZWQxYzM2MzVkIiwidWlkIjoiODcyYTljMzJkYjQ1NDVlOGFjNzMxNTUxZmI2MWMyMjciLCJlbWFpbCI6ImJ1c2luZXNzYW5hbHlzdEBtYXJpb25ldHRlLmRldiIsInJvbGUiOiJhZG1pbiIsImxldmVsIjozLCJzdGF0ZSI6ImFjdGl2ZSIsInJlZmVycmFsX2lkIjpudWxsfQ.2meEWB_-1J1veu86q201--x5NduugDMRHWX_vwActqsyz_62RhkXICU41J9g8A6TzxoaYPncxdEypvnzIFunz6Xvx70JM-03cCPsJ74Lz6LGNt2KApkNkuJ_vdMVzqtpVp-RxNnylnqgwtHISjShEtBs8cCVvXWTfGJYh_FvC6AWccZt8hI6sHNzP3yVhz13BPJlejOYF4OYyh3iNPXlj3PkT9lfm7szyuWrBCD4gLKtABhzj2W8VWJOuhTmv8M4yw5teCH5rxobL9838r8qEcOsm6SM6fSmyVtpbxcdI8K0b1UJWcxhY5D0SYKWCLSd4n4GBA9ubvJVHIGFZcurqg",
"isApiKey": false
}
}
As we can see, if an employee does not have the role that is being checked in the workflow, then the workflow will end without any action calls.
In this part of Workflow creation, we will review the model with the Requester who makes a request to update currency, and the Approver who will review the request and make a decision. For this flow, there should be a connection between the Requester and Approver employees through task creation in Workspace mode.
Therefore, both the Requester and the Approver should be granted the permission "useWorkspace" and "manageTasks".
This allows the Requester to observe the status of created tasks.
Additionally, the Approver requires additional permission, "acceptCurrency", which enables one to view task details and make decisions. Without this permission, there is no option to review task details and make a decision.
In this example, employee businessanalyst@marionette.dev will act as the Requester, while employee qa@tunex.io will serve as the Approver.
To enable task creation for the Requester and decision-making for the Approver, the workflow model should include "set" and "user decision" nodes.
As observed, if the Role checks result in a "false" outcome, the subsequent node will be "set", where there is an opportunity to input the main details for the task title and description.
After the "set" node, there will be a "user decision" node with the following main conditions:
Component: Within the framework of workflow construction, the “user decision” element plays a crucial role, allowing the administrator to decide whether to confirm or cancel changes to the data. This element includes a Component attribute, used to visually represent changes to the administrator. Visual representation may include added, modified, created, or deleted data. The Params Key attribute is utilized to pass this data to the Component, enabling the administrator to visually evaluate changes before approving or rejecting them.
Assignee User: The Approver can be assigned by email.
Assignee Role: The Approver can be assigned by role.
Assignee Permission: The Approver can be assigned by permission.
Out port "Approve": This port has a primary color for the button in task details (positive).
Out port "Reject": This port has a danger color for the button in task details (negative).
As observed in this flow, if the Approver makes an "Approve" decision, the next step will be an "action call" with currencies.updateCurrency. Conversely, if the decision is "Reject", the workflow will proceed to the "end" node.
Workflow Process for updating Currency configurations
Steps for Requester. Login to Puppeteer with the credentials businessanalyst@marionette.dev and navigate to the Configurations page. Once there, locate the "Currencies" sub-menu.
Steps for Approver
If the Approver decides to reject the request, it will be declined without any changes to the Currency configuration. The task status will be set to 'resolved', and it will be removed from the open tasks list for both the Approver and the Requester in the Workspace.
Full Audit logs code for Workflow
{
"initialData": {
"name": "Cardano",
"id": "ADA",
"precision": 4,
"position": 7,
"lightBgColor1": "#ff0000",
"lightBgColor2": "#D6CCED",
"lightTextColor": "#ffffff",
"darkBgColor1": "#569494",
"darkBgColor2": "#0A0F17",
"darkTextColor": "#ffffff",
"userBalanceEnable": true,
"enabled": true,
"hide": false,
"trading_commission_enabled": true,
"payout_fee": 2,
"min_payout_fee": 1,
"max_payout_fee": 250
},
"initialMeta": {
"userIP": "176.120.105.193",
"userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0",
"method": "POST",
"path": "api/v2/",
"decodedUser": {
"exp": 1715513322,
"sub": "session",
"iss": "marionette",
"aud": [
"marionette"
],
"jti": "98b91213-ade7-4066-a6e5-2106c0c62690",
"uid": "872a9c32db4545e8ac731551fb61c227",
"email": "businessanalyst@marionette.dev",
"role": "admin",
"level": 3,
"state": "active",
"referral_id": null
},
"user": {
"id": "872a9c32db4545e8ac731551fb61c227",
"email": "businessanalyst@marionette.dev",
"password": "sha256$4be643c4$1$95c93926a1850e210d379a4922c03cc7f397828e090c0cd9fac794af4447d065",
"username": null,
"role": "ADMIN",
"state": "active",
"referralId": null,
"referralGroupId": null,
"locale": null,
"email_verified": false,
"phone_verified": false,
"profile_verified": false,
"isPhone": null,
"data": null,
"otp": false,
"enabled2fa": false,
"secret2fa": "",
"googleIdentity": false,
"softban": false,
"createdAt": "2024-02-13T18:50:17.000Z",
"updatedAt": "2024-04-12T08:44:05.000Z"
},
"permissions": [
"acceptCurrencyPI",
"manageTasks",
"useWorkspace",
"editCurrency",
"viewCurrencies"
],
"token": "eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE3MTU1MTMzMjIsInN1YiI6InNlc3Npb24iLCJpc3MiOiJtYXJpb25ldHRlIiwiYXVkIjpbIm1hcmlvbmV0dGUiXSwianRpIjoiOThiOTEyMTMtYWRlNy00MDY2LWE2ZTUtMjEwNmMwYzYyNjkwIiwidWlkIjoiODcyYTljMzJkYjQ1NDVlOGFjNzMxNTUxZmI2MWMyMjciLCJlbWFpbCI6ImJ1c2luZXNzYW5hbHlzdEBtYXJpb25ldHRlLmRldiIsInJvbGUiOiJhZG1pbiIsImxldmVsIjozLCJzdGF0ZSI6ImFjdGl2ZSIsInJlZmVycmFsX2lkIjpudWxsfQ.J2nJwoEiVNkUql-M9AB9PT0gXMScvPHnpxDOUw6bP3b-JNG_qk2u4CWVQLmjR2VcrjGlJX6yB__YfzXmNaH3_FD3LhCvDBb7nXUeL7TdHVfWtyGjxx7bTV-B548ufCPyOpJtOd4T9d05c_KgKxmRXr9MsYm-KsxSvjK2uZEl_oeNKkeeuDDFKG6CmAPBhdOo6vnmJcwOYq3mxUz10ONkbEqoavexADxJByO-ivgVgzf_2HSJtMf3SSvzy5gFH76wm_sLcd3ezAIy5GBA411nCvq3umoAo79I9oKJL6PsuiVxyK8ZD_-wQvbnlGnZRwVxvlw9wirT-epZFyd9hfipww",
"isApiKey": false
}
}
Full Audit logs code for Workflow with 'Reject' decision
{
"name": "Cardano",
"id": "ADA",
"precision": 4,
"position": 7,
"lightBgColor1": "#ff0000",
"lightBgColor2": "#D6CCED",
"lightTextColor": "#ffffff",
"darkBgColor1": "#569494",
"darkBgColor2": "#0A0F17",
"darkTextColor": "#ffffff",
"userBalanceEnable": true,
"enabled": true,
"hide": false,
"trading_commission_enabled": true,
"payout_fee": 2,
"min_payout_fee": 1,
"max_payout_fee": 250,
"taskTitle": "Request to update Currency ADA",
"taskDescription": "Requested by businessanalyst@marionette.dev"
}
Runtimes details
{
"initialData": {
"name": "Cardano",
"id": "ADA",
"precision": 4,
"position": 7,
"lightBgColor1": "#ff0000",
"lightBgColor2": "#D6CCED",
"lightTextColor": "#ffffff",
"darkBgColor1": "#569494",
"darkBgColor2": "#0A0F17",
"darkTextColor": "#ffffff",
"userBalanceEnable": true,
"enabled": true,
"hide": false,
"trading_commission_enabled": true,
"payout_fee": 2,
"min_payout_fee": 1,
"max_payout_fee": 250,
"taskTitle": "Request to update Currency ADA",
"taskDescription": "Requested by businessanalyst@marionette.dev"
},
"initialMeta": {
"userIP": "176.120.105.193",
"userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0",
"method": "POST",
"path": "api/v2/",
"decodedUser": {
"exp": 1715513322,
"sub": "session",
"iss": "marionette",
"aud": [
"marionette"
],
"jti": "98b91213-ade7-4066-a6e5-2106c0c62690",
"uid": "872a9c32db4545e8ac731551fb61c227",
"email": "businessanalyst@marionette.dev",
"role": "admin",
"level": 3,
"state": "active",
"referral_id": null
},
"user": {
"id": "872a9c32db4545e8ac731551fb61c227",
"email": "businessanalyst@marionette.dev",
"password": "sha256$4be643c4$1$95c93926a1850e210d379a4922c03cc7f397828e090c0cd9fac794af4447d065",
"username": null,
"role": "ADMIN",
"state": "active",
"referralId": null,
"referralGroupId": null,
"locale": null,
"email_verified": false,
"phone_verified": false,
"profile_verified": false,
"isPhone": null,
"data": null,
"otp": false,
"enabled2fa": false,
"secret2fa": "",
"googleIdentity": false,
"softban": false,
"createdAt": "2024-02-13T18:50:17.000Z",
"updatedAt": "2024-04-12T08:44:05.000Z"
},
"permissions": [
"acceptCurrencyPI",
"manageTasks",
"useWorkspace",
"editCurrency",
"viewCurrencies"
],
"token": "eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE3MTU1MTMzMjIsInN1YiI6InNlc3Npb24iLCJpc3MiOiJtYXJpb25ldHRlIiwiYXVkIjpbIm1hcmlvbmV0dGUiXSwianRpIjoiOThiOTEyMTMtYWRlNy00MDY2LWE2ZTUtMjEwNmMwYzYyNjkwIiwidWlkIjoiODcyYTljMzJkYjQ1NDVlOGFjNzMxNTUxZmI2MWMyMjciLCJlbWFpbCI6ImJ1c2luZXNzYW5hbHlzdEBtYXJpb25ldHRlLmRldiIsInJvbGUiOiJhZG1pbiIsImxldmVsIjozLCJzdGF0ZSI6ImFjdGl2ZSIsInJlZmVycmFsX2lkIjpudWxsfQ.J2nJwoEiVNkUql-M9AB9PT0gXMScvPHnpxDOUw6bP3b-JNG_qk2u4CWVQLmjR2VcrjGlJX6yB__YfzXmNaH3_FD3LhCvDBb7nXUeL7TdHVfWtyGjxx7bTV-B548ufCPyOpJtOd4T9d05c_KgKxmRXr9MsYm-KsxSvjK2uZEl_oeNKkeeuDDFKG6CmAPBhdOo6vnmJcwOYq3mxUz10ONkbEqoavexADxJByO-ivgVgzf_2HSJtMf3SSvzy5gFH76wm_sLcd3ezAIy5GBA411nCvq3umoAo79I9oKJL6PsuiVxyK8ZD_-wQvbnlGnZRwVxvlw9wirT-epZFyd9hfipww",
"isApiKey": false
}
}
If the Approver decides to approve the request, it will be accepted with the required changes to the Currency configuration. The task status will be set to 'resolved', and it will be removed from the open tasks list for both the Approver and the Requester in the Workspace. Configurations for the Currency will be updated accordingly.
Full Audit logs code for Workflow
{
"initialData": {
"name": "Cardano",
"id": "ADA",
"precision": 4,
"position": 7,
"lightBgColor1": "#ff0000",
"lightBgColor2": "#D6CCED",
"lightTextColor": "#ffffff",
"darkBgColor1": "#569494",
"darkBgColor2": "#0A0F17",
"darkTextColor": "#ffffff",
"userBalanceEnable": true,
"enabled": true,
"hide": false,
"trading_commission_enabled": true,
"payout_fee": 2,
"min_payout_fee": 1,
"max_payout_fee": 250
},
"initialMeta": {
"userIP": "176.120.105.193",
"userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0",
"method": "POST",
"path": "api/v2/",
"decodedUser": {
"exp": 1715513322,
"sub": "session",
"iss": "marionette",
"aud": [
"marionette"
],
"jti": "98b91213-ade7-4066-a6e5-2106c0c62690",
"uid": "872a9c32db4545e8ac731551fb61c227",
"email": "businessanalyst@marionette.dev",
"role": "admin",
"level": 3,
"state": "active",
"referral_id": null
},
"user": {
"id": "872a9c32db4545e8ac731551fb61c227",
"email": "businessanalyst@marionette.dev",
"password": "sha256$4be643c4$1$95c93926a1850e210d379a4922c03cc7f397828e090c0cd9fac794af4447d065",
"username": null,
"role": "ADMIN",
"state": "active",
"referralId": null,
"referralGroupId": null,
"locale": null,
"email_verified": false,
"phone_verified": false,
"profile_verified": false,
"isPhone": null,
"data": null,
"otp": false,
"enabled2fa": false,
"secret2fa": "",
"googleIdentity": false,
"softban": false,
"createdAt": "2024-02-13T18:50:17.000Z",
"updatedAt": "2024-04-12T08:44:05.000Z"
},
"permissions": [
"acceptCurrencyPI",
"manageTasks",
"useWorkspace",
"editCurrency",
"viewCurrencies"
],
"token": "eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE3MTU1MTMzMjIsInN1YiI6InNlc3Npb24iLCJpc3MiOiJtYXJpb25ldHRlIiwiYXVkIjpbIm1hcmlvbmV0dGUiXSwianRpIjoiOThiOTEyMTMtYWRlNy00MDY2LWE2ZTUtMjEwNmMwYzYyNjkwIiwidWlkIjoiODcyYTljMzJkYjQ1NDVlOGFjNzMxNTUxZmI2MWMyMjciLCJlbWFpbCI6ImJ1c2luZXNzYW5hbHlzdEBtYXJpb25ldHRlLmRldiIsInJvbGUiOiJhZG1pbiIsImxldmVsIjozLCJzdGF0ZSI6ImFjdGl2ZSIsInJlZmVycmFsX2lkIjpudWxsfQ.J2nJwoEiVNkUql-M9AB9PT0gXMScvPHnpxDOUw6bP3b-JNG_qk2u4CWVQLmjR2VcrjGlJX6yB__YfzXmNaH3_FD3LhCvDBb7nXUeL7TdHVfWtyGjxx7bTV-B548ufCPyOpJtOd4T9d05c_KgKxmRXr9MsYm-KsxSvjK2uZEl_oeNKkeeuDDFKG6CmAPBhdOo6vnmJcwOYq3mxUz10ONkbEqoavexADxJByO-ivgVgzf_2HSJtMf3SSvzy5gFH76wm_sLcd3ezAIy5GBA411nCvq3umoAo79I9oKJL6PsuiVxyK8ZD_-wQvbnlGnZRwVxvlw9wirT-epZFyd9hfipww",
"isApiKey": false
}
}
Full Audit logs code for Workflow with 'Approve' decision
{
"name": "Cardano",
"id": "ADA",
"precision": 4,
"position": 7,
"lightBgColor1": "#ff0000",
"lightBgColor2": "#D6CCED",
"lightTextColor": "#ffffff",
"darkBgColor1": "#569494",
"darkBgColor2": "#0A0F17",
"darkTextColor": "#ffffff",
"userBalanceEnable": true,
"enabled": true,
"hide": false,
"trading_commission_enabled": true,
"payout_fee": 2,
"min_payout_fee": 1,
"max_payout_fee": 250,
"taskTitle": "Request to update Currency ADA",
"taskDescription": "Requested by businessanalyst@marionette.dev"
}
Full Audit logs code for workflow with 'success' action
{
"params": {
"name": "Cardano",
"id": "ADA",
"precision": 4,
"position": 7,
"lightBgColor1": "#ff0000",
"lightBgColor2": "#D6CCED",
"lightTextColor": "#ffffff",
"darkBgColor1": "#569494",
"darkBgColor2": "#0A0F17",
"darkTextColor": "#ffffff",
"userBalanceEnable": true,
"enabled": true,
"hide": false,
"trading_commission_enabled": true,
"payout_fee": 2,
"min_payout_fee": 1,
"max_payout_fee": 250,
"taskTitle": "Request to update Currency ADA",
"taskDescription": "Requested by businessanalyst@marionette.dev"
},
"result": {
"id": "ADA",
"name": "Cardano",
"userBalanceEnable": true,
"lightBgColor1": "#ff0000",
"lightBgColor2": "#D6CCED",
"darkBgColor1": "#569494",
"darkBgColor2": "#0A0F17",
"lightTextColor": "#ffffff",
"darkTextColor": "#ffffff",
"icon_url": "https://devtunexio.sfo2.digitaloceanspaces.com/3126875f-0b87-4147-b8f5-db2a18a90e4f.svg",
"precision": 4,
"enabled": true,
"position": 7,
"trading_commission_enabled": true,
"hide": false,
"staking_enabled": true,
"staking_period": "0 0 * */3 *",
"staking_apr": 55,
"last_staking_calc": 1712880000000,
"min_staking_amount": 222,
"instant_unstaking": false,
"payout_fee": 2,
"min_payout_fee": 1,
"max_payout_fee": 250,
"createdAt": "2023-05-12T14:41:13.000Z",
"updatedAt": "2024-04-12T12:25:11.511Z"
}
}
Runtimes details
{
"initialData": {
"name": "Cardano",
"id": "ADA",
"precision": 4,
"position": 7,
"lightBgColor1": "#ff0000",
"lightBgColor2": "#D6CCED",
"lightTextColor": "#ffffff",
"darkBgColor1": "#569494",
"darkBgColor2": "#0A0F17",
"darkTextColor": "#ffffff",
"userBalanceEnable": true,
"enabled": true,
"hide": false,
"trading_commission_enabled": true,
"payout_fee": 2,
"min_payout_fee": 1,
"max_payout_fee": 250,
"taskTitle": "Request to update Currency ADA",
"taskDescription": "Requested by businessanalyst@marionette.dev"
},
"initialMeta": {
"userIP": "176.120.105.193",
"userAgent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0",
"method": "POST",
"path": "api/v2/",
"decodedUser": {
"exp": 1715513322,
"sub": "session",
"iss": "marionette",
"aud": [
"marionette"
],
"jti": "98b91213-ade7-4066-a6e5-2106c0c62690",
"uid": "872a9c32db4545e8ac731551fb61c227",
"email": "businessanalyst@marionette.dev",
"role": "admin",
"level": 3,
"state": "active",
"referral_id": null
},
"user": {
"id": "872a9c32db4545e8ac731551fb61c227",
"email": "businessanalyst@marionette.dev",
"password": "sha256$4be643c4$1$95c93926a1850e210d379a4922c03cc7f397828e090c0cd9fac794af4447d065",
"username": null,
"role": "ADMIN",
"state": "active",
"referralId": null,
"referralGroupId": null,
"locale": null,
"email_verified": false,
"phone_verified": false,
"profile_verified": false,
"isPhone": null,
"data": null,
"otp": false,
"enabled2fa": false,
"secret2fa": "",
"googleIdentity": false,
"softban": false,
"createdAt": "2024-02-13T18:50:17.000Z",
"updatedAt": "2024-04-12T08:44:05.000Z"
},
"permissions": [
"acceptCurrencyPI",
"manageTasks",
"useWorkspace",
"editCurrency",
"viewCurrencies"
],
"token": "eyJhbGciOiJSUzI1NiJ9.eyJleHAiOjE3MTU1MTMzMjIsInN1YiI6InNlc3Npb24iLCJpc3MiOiJtYXJpb25ldHRlIiwiYXVkIjpbIm1hcmlvbmV0dGUiXSwianRpIjoiOThiOTEyMTMtYWRlNy00MDY2LWE2ZTUtMjEwNmMwYzYyNjkwIiwidWlkIjoiODcyYTljMzJkYjQ1NDVlOGFjNzMxNTUxZmI2MWMyMjciLCJlbWFpbCI6ImJ1c2luZXNzYW5hbHlzdEBtYXJpb25ldHRlLmRldiIsInJvbGUiOiJhZG1pbiIsImxldmVsIjozLCJzdGF0ZSI6ImFjdGl2ZSIsInJlZmVycmFsX2lkIjpudWxsfQ.J2nJwoEiVNkUql-M9AB9PT0gXMScvPHnpxDOUw6bP3b-JNG_qk2u4CWVQLmjR2VcrjGlJX6yB__YfzXmNaH3_FD3LhCvDBb7nXUeL7TdHVfWtyGjxx7bTV-B548ufCPyOpJtOd4T9d05c_KgKxmRXr9MsYm-KsxSvjK2uZEl_oeNKkeeuDDFKG6CmAPBhdOo6vnmJcwOYq3mxUz10ONkbEqoavexADxJByO-ivgVgzf_2HSJtMf3SSvzy5gFH76wm_sLcd3ezAIy5GBA411nCvq3umoAo79I9oKJL6PsuiVxyK8ZD_-wQvbnlGnZRwVxvlw9wirT-epZFyd9hfipww",
"isApiKey": false
},
"result": {
"id": "ADA",
"name": "Cardano",
"userBalanceEnable": true,
"lightBgColor1": "#ff0000",
"lightBgColor2": "#D6CCED",
"darkBgColor1": "#569494",
"darkBgColor2": "#0A0F17",
"lightTextColor": "#ffffff",
"darkTextColor": "#ffffff",
"icon_url": "https://devtunexio.sfo2.digitaloceanspaces.com/3126875f-0b87-4147-b8f5-db2a18a90e4f.svg",
"precision": 4,
"enabled": true,
"position": 7,
"trading_commission_enabled": true,
"hide": false,
"staking_enabled": true,
"staking_period": "0 0 * */3 *",
"staking_apr": 55,
"last_staking_calc": 1712880000000,
"min_staking_amount": 222,
"instant_unstaking": false,
"payout_fee": 2,
"min_payout_fee": 1,
"max_payout_fee": 250,
"createdAt": "2023-05-12T14:41:13.000Z",
"updatedAt": "2024-04-12T12:25:11.511Z"
}
}
Common Issues and Solutions
Error Messages and Their Meanings
Definitions of Key Terms Used in the Documentation
Additional Resources
Contact Information for Support