@burgan-tech/morph-idm-runtime 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +245 -0
- package/burgan-tech-morph-idm-runtime-0.0.0.tgz +0 -0
- package/morph-idm/Extensions/.gitkeep +0 -0
- package/morph-idm/Functions/.gitkeep +0 -0
- package/morph-idm/Functions/user/function-validate-user.json +31 -0
- package/morph-idm/Functions/user/src/ValidateUser.csx +39 -0
- package/morph-idm/Mappings/device-register-evaluate-get-device-request.mapper.json +319 -0
- package/morph-idm/Mappings/device-register-evaluate-get-device-response.mapper.json +761 -0
- package/morph-idm/Mappings/device-register-new-device-call-device-start-request.mapper.json +762 -0
- package/morph-idm/Mappings/device-register-start.mapper.json +971 -0
- package/morph-idm/Mappings/device-start-request.mapper.json +20 -0
- package/morph-idm/Mappings/device-start.mapper.json +896 -0
- package/morph-idm/Mappings/device-update-request.mapper.json +883 -0
- package/morph-idm/Mappings/token-start-request.mapper.json +436 -0
- package/morph-idm/Schemas/approval-matrix/approval-matrix-master-1.0.0.json +98 -0
- package/morph-idm/Schemas/approval-matrix/approval-matrix-update-1.0.0.json +85 -0
- package/morph-idm/Schemas/client/client-master-1.0.0.json +293 -0
- package/morph-idm/Schemas/client/client-update-master-1.0.0.json +201 -0
- package/morph-idm/Schemas/consent/consent-master-1.0.0.json +151 -0
- package/morph-idm/Schemas/device/device-master-1.0.0.json +433 -0
- package/morph-idm/Schemas/device/device-register-master-1.0.0.json +300 -0
- package/morph-idm/Schemas/device/device-register-start-1.0.0.json +270 -0
- package/morph-idm/Schemas/device/device-start-1.0.0.json +281 -0
- package/morph-idm/Schemas/device/device-update-1.0.0.json +275 -0
- package/morph-idm/Schemas/headers-1.0.0.json +245 -0
- package/morph-idm/Schemas/organization/organization-master-1.0.0.json +386 -0
- package/morph-idm/Schemas/organization/organization-update-1.0.0.json +60 -0
- package/morph-idm/Schemas/privilege/privilege-master-1.0.0.json +84 -0
- package/morph-idm/Schemas/privilege/privilege-update-1.0.0.json +76 -0
- package/morph-idm/Schemas/scope/scope-group-master-1.0.0.json +52 -0
- package/morph-idm/Schemas/scope/scope-master-1.0.0.json +120 -0
- package/morph-idm/Schemas/token/token-master-1.0.0.json +346 -0
- package/morph-idm/Schemas/token/token-start-1.0.0.json +50 -0
- package/morph-idm/Schemas/transaction-limit/transaction-limit-master-1.0.0.json +175 -0
- package/morph-idm/Schemas/transaction-limit/transaction-limit-update-1.0.0.json +90 -0
- package/morph-idm/Schemas/user/person-master-1.0.0.json +211 -0
- package/morph-idm/Schemas/user/user-master-1.0.0.json +121 -0
- package/morph-idm/Tasks/.gitkeep +0 -0
- package/morph-idm/Tasks/call-device-start-1.0.0.json +21 -0
- package/morph-idm/Tasks/call-device-update-1.0.0.json +21 -0
- package/morph-idm/Tasks/client/client-create-rsa.json +26 -0
- package/morph-idm/Tasks/client/client-password-generator.json +14 -0
- package/morph-idm/Tasks/client/get-client-by-task.json +18 -0
- package/morph-idm/Tasks/consent/get-consent-by-task.json +18 -0
- package/morph-idm/Tasks/consent/get-multi-consents-by-task.json +25 -0
- package/morph-idm/Tasks/device/get-device-by-task.json +18 -0
- package/morph-idm/Tasks/get-device-1.0.0.json +20 -0
- package/morph-idm/Tasks/scope/get-scope-by-task.json +17 -0
- package/morph-idm/Tasks/scope/scope-by-user-task.json +25 -0
- package/morph-idm/Tasks/scope/scope-details-task.json +25 -0
- package/morph-idm/Tasks/token/send-token-to-main.json +20 -0
- package/morph-idm/Tasks/token/token-create-jwt.json +27 -0
- package/morph-idm/Tasks/user/get-user-by-task.json +18 -0
- package/morph-idm/Tasks/user/send-otp-task.json +25 -0
- package/morph-idm/Tasks/user/send-push-task.json +22 -0
- package/morph-idm/Tasks/user/user-password-generator.json +26 -0
- package/morph-idm/Tasks/user/verify-otp-task.json +22 -0
- package/morph-idm/Tasks/user/verify-push-task.json +22 -0
- package/morph-idm/Views/.gitkeep +0 -0
- package/morph-idm/Workflows/.gitkeep +0 -0
- package/morph-idm/Workflows/approval-matrix/approval-1.0.0.json +452 -0
- package/morph-idm/Workflows/approval-matrix/approval-matrix-1.0.0.json +184 -0
- package/morph-idm/Workflows/client/client-1.0.0.json +257 -0
- package/morph-idm/Workflows/client/client-update-1.0.0.json +202 -0
- package/morph-idm/Workflows/client/execute/client.http +377 -0
- package/morph-idm/Workflows/client/src/ClientCreateRsa.csx +198 -0
- package/morph-idm/Workflows/client/src/ClientCreateRsaByScript.csx +118 -0
- package/morph-idm/Workflows/client/src/CreateRsaByHttpCallMapping.csx +223 -0
- package/morph-idm/Workflows/client/src/PasswordGeneratorMapping.csx +26 -0
- package/morph-idm/Workflows/client/src/RsaExistsRule.csx +44 -0
- package/morph-idm/Workflows/client-manager/client-manager-1.0.0.json +217 -0
- package/morph-idm/Workflows/client-manager/execute/client-manager.http +214 -0
- package/morph-idm/Workflows/client-manager/src/ClientCreatedRule.csx +28 -0
- package/morph-idm/Workflows/client-manager/src/ClientExistsRule.csx +25 -0
- package/morph-idm/Workflows/client-manager/src/CreateClientSubFlowMapping.csx +63 -0
- package/morph-idm/Workflows/client-manager/src/GetClientForManagerMapping.csx +59 -0
- package/morph-idm/Workflows/consent/consent-1.0.0.json +424 -0
- package/morph-idm/Workflows/consent/execute/README.md +167 -0
- package/morph-idm/Workflows/consent/execute/consent-invitation-flow.http +283 -0
- package/morph-idm/Workflows/consent/execute/create-consent.http +780 -0
- package/morph-idm/Workflows/consent/src/AutoConsentRule.csx +29 -0
- package/morph-idm/Workflows/consent/src/ConsentTimeoutTimer.csx +14 -0
- package/morph-idm/Workflows/consent-selection/consent-selection-1.0.0.json +331 -0
- package/morph-idm/Workflows/consent-selection/src/AutoConsentCreatedRule.csx +28 -0
- package/morph-idm/Workflows/consent-selection/src/ConsentFetchMapping.csx +82 -0
- package/morph-idm/Workflows/consent-selection/src/ConsentSelectedMapping.csx +70 -0
- package/morph-idm/Workflows/consent-selection/src/CreateAutoConsentMapping.csx +150 -0
- package/morph-idm/Workflows/consent-selection/src/MultipleConsentsRule.csx +31 -0
- package/morph-idm/Workflows/consent-selection/src/NoConsentEligibleRule.csx +44 -0
- package/morph-idm/Workflows/consent-selection/src/SingleConsentRule.csx +45 -0
- package/morph-idm/Workflows/device/device-1.0.0.json +261 -0
- package/morph-idm/Workflows/device/device-migration-1.0.0.json +213 -0
- package/morph-idm/Workflows/device/device-register-1.0.0-documentation.md +646 -0
- package/morph-idm/Workflows/device/device-register-1.0.0-documentation.svg +36 -0
- package/morph-idm/Workflows/device/device-register-1.0.0.json +185 -0
- package/morph-idm/Workflows/device/execute/device-android.http +260 -0
- package/morph-idm/Workflows/device/execute/device-huawei.http +219 -0
- package/morph-idm/Workflows/device/execute/device-ios.http +325 -0
- package/morph-idm/Workflows/device/execute/device-web.http +284 -0
- package/morph-idm/Workflows/device/src/DeviceCreatedRule.csx +32 -0
- package/morph-idm/Workflows/device/src/DeviceFoundRule.csx +32 -0
- package/morph-idm/Workflows/device/src/DeviceNotFoundRule.csx +28 -0
- package/morph-idm/Workflows/device/src/DeviceUpdatedRule.csx +26 -0
- package/morph-idm/Workflows/device/src/NoUpdateRule.csx +19 -0
- package/morph-idm/Workflows/device/src/ReInstallRule.csx +19 -0
- package/morph-idm/Workflows/document-validation/_FF_document-validation.json +423 -0
- package/morph-idm/Workflows/document-validation/src/ApproveRule.csx +16 -0
- package/morph-idm/Workflows/document-validation/src/ClassifyRule.csx +16 -0
- package/morph-idm/Workflows/document-validation/src/ExtractRule.csx +16 -0
- package/morph-idm/Workflows/document-validation/src/HitlRule.csx +16 -0
- package/morph-idm/Workflows/document-validation/src/RejectRule.csx +16 -0
- package/morph-idm/Workflows/document-validation/src/RunOcrRule.csx +16 -0
- package/morph-idm/Workflows/document-validation/src/StartRule.csx +16 -0
- package/morph-idm/Workflows/document-validation/src/ToAggregateRule.csx +16 -0
- package/morph-idm/Workflows/document-validation/src/ToFraudRule.csx +16 -0
- package/morph-idm/Workflows/document-validation/src/ToReferentialRule.csx +16 -0
- package/morph-idm/Workflows/document-validation/src/ToSemanticRule.csx +16 -0
- package/morph-idm/Workflows/document-validation/src/ToStructuralRule.csx +16 -0
- package/morph-idm/Workflows/organization/execute/create-organization.http +280 -0
- package/morph-idm/Workflows/organization/organization-1.0.0-documentation.md +616 -0
- package/morph-idm/Workflows/organization/organization-1.0.0.json +181 -0
- package/morph-idm/Workflows/privilege/privilege-1.0.0.json +185 -0
- package/morph-idm/Workflows/scope/execute/scope-24-7-access.http +131 -0
- package/morph-idm/Workflows/scope/execute/scope-business-hours.http +138 -0
- package/morph-idm/Workflows/scope/execute/scope-corporate.http +165 -0
- package/morph-idm/Workflows/scope/execute/scope-individual.http +133 -0
- package/morph-idm/Workflows/scope/execute/scope-lifecycle-test.http +133 -0
- package/morph-idm/Workflows/scope/execute/scope-multi-systems.http +159 -0
- package/morph-idm/Workflows/scope/execute/scope-restricted.http +143 -0
- package/morph-idm/Workflows/scope/scope-1.0.0.json +142 -0
- package/morph-idm/Workflows/scope/scope-group-1.0.0.json +144 -0
- package/morph-idm/Workflows/scope-group/execute/create-scope-group.http +222 -0
- package/morph-idm/Workflows/token/execute/README.md +450 -0
- package/morph-idm/Workflows/token/execute/token.http +236 -0
- package/morph-idm/Workflows/token/oauth-authentication-workflow.json +406 -0
- package/morph-idm/Workflows/token/password-subflow.json +173 -0
- package/morph-idm/Workflows/token/scope-cdc-worker.1.0.0.json +46 -0
- package/morph-idm/Workflows/token/src/CreateRsaJwtMapping.csx +208 -0
- package/morph-idm/Workflows/token/src/ExpireTokenTimer.csx +14 -0
- package/morph-idm/Workflows/token/src/PrepareAuthorizationCodeRule.csx +16 -0
- package/morph-idm/Workflows/token/src/RequestInappropriateRule.csx +16 -0
- package/morph-idm/Workflows/token/src/SendJwtToMainMapping.csx +167 -0
- package/morph-idm/Workflows/token/token-1.0.0.json +356 -0
- package/morph-idm/Workflows/token/token-1.0.0.openapi.json.md +707 -0
- package/morph-idm/Workflows/token/token-exchange.1.0.0.json +45 -0
- package/morph-idm/Workflows/transaction-limit/transaction-limit-1.0.0.json +244 -0
- package/morph-idm/Workflows/transaction-limit/transaction-limit-authorization.json +502 -0
- package/morph-idm/Workflows/transaction-limit/transaction-limit-capture.json +142 -0
- package/morph-idm/Workflows/user/execute/README-LOGIN.md +535 -0
- package/morph-idm/Workflows/user/execute/create-user-1234567890.http +116 -0
- package/morph-idm/Workflows/user/execute/create-user-minimal.http +22 -0
- package/morph-idm/Workflows/user/execute/create-user-person-password.http +130 -0
- package/morph-idm/Workflows/user/execute/create-user-person.http +249 -0
- package/morph-idm/Workflows/user/execute/create-user-system.http +16 -0
- package/morph-idm/Workflows/user/execute/user-login.http +583 -0
- package/morph-idm/Workflows/user/execute/user-requests.http +51 -0
- package/morph-idm/Workflows/user/person-1.0.0.json +140 -0
- package/morph-idm/Workflows/user/person-cdc-worker.1.0.0.json +46 -0
- package/morph-idm/Workflows/user/person-upsert-1.0.0.json +129 -0
- package/morph-idm/Workflows/user/src/ApproveRule.csx +16 -0
- package/morph-idm/Workflows/user/src/AutoConsentCreatedRule.csx +20 -0
- package/morph-idm/Workflows/user/src/AutoConsentRequiredRule.csx +77 -0
- package/morph-idm/Workflows/user/src/CheckDeviceByUserReferenceMapping.csx +66 -0
- package/morph-idm/Workflows/user/src/ClientValidationFailRule.csx +28 -0
- package/morph-idm/Workflows/user/src/ClientValidationRule.csx +25 -0
- package/morph-idm/Workflows/user/src/ConsentSelectedRule.csx +24 -0
- package/morph-idm/Workflows/user/src/ConsentValidationRule.csx +36 -0
- package/morph-idm/Workflows/user/src/CreateAutoConsentMapping.csx +171 -0
- package/morph-idm/Workflows/user/src/DeviceFoundForLoginRule.csx +32 -0
- package/morph-idm/Workflows/user/src/DeviceNotFoundForLoginRule.csx +31 -0
- package/morph-idm/Workflows/user/src/GetClientMapping.csx +45 -0
- package/morph-idm/Workflows/user/src/GetConsentMapping.csx +27 -0
- package/morph-idm/Workflows/user/src/GetDeviceMapping.csx +52 -0
- package/morph-idm/Workflows/user/src/GetScopeMapping.csx +139 -0
- package/morph-idm/Workflows/user/src/GetScopesByUserMapping.csx +137 -0
- package/morph-idm/Workflows/user/src/GetUserMapping.csx +39 -0
- package/morph-idm/Workflows/user/src/GrantValidationFailRule.csx +48 -0
- package/morph-idm/Workflows/user/src/GrantValidationRule.csx +45 -0
- package/morph-idm/Workflows/user/src/IsIbWebClientWithDeviceRule.csx +42 -0
- package/morph-idm/Workflows/user/src/NonIbWebClientWithDeviceRule.csx +42 -0
- package/morph-idm/Workflows/user/src/OtpSentRule.csx +31 -0
- package/morph-idm/Workflows/user/src/OtpVerifiedRule.csx +31 -0
- package/morph-idm/Workflows/user/src/PushSentRule.csx +31 -0
- package/morph-idm/Workflows/user/src/PushVerifiedRule.csx +31 -0
- package/morph-idm/Workflows/user/src/RejectRule.csx +16 -0
- package/morph-idm/Workflows/user/src/ScopeFetchedRule.csx +35 -0
- package/morph-idm/Workflows/user/src/ScopeValidationFailRule.csx +67 -0
- package/morph-idm/Workflows/user/src/ScopeValidationRule.csx +67 -0
- package/morph-idm/Workflows/user/src/SendOtpMapping.csx +94 -0
- package/morph-idm/Workflows/user/src/SendPushMapping.csx +90 -0
- package/morph-idm/Workflows/user/src/TokenGenerationSuccessRule.csx +28 -0
- package/morph-idm/Workflows/user/src/TriggerConsentSelectionAsSubFlowMapping.csx +63 -0
- package/morph-idm/Workflows/user/src/TriggerTokenWorkflowAsSubFlowMapping.csx +42 -0
- package/morph-idm/Workflows/user/src/UserPasswordGeneratorMapping.csx +190 -0
- package/morph-idm/Workflows/user/src/UserValidationFailRule.csx +36 -0
- package/morph-idm/Workflows/user/src/UserValidationRule.csx +38 -0
- package/morph-idm/Workflows/user/src/VerifyOtpMapping.csx +65 -0
- package/morph-idm/Workflows/user/src/VerifyPushMapping.csx +65 -0
- package/morph-idm/Workflows/user/user-1.0.0.json +400 -0
- package/morph-idm/Workflows/user/user-force-update.1.0.0.json +46 -0
- package/morph-idm/Workflows/user/user-login-certificate.1.0.0.json +46 -0
- package/morph-idm/Workflows/user/user-login.1.0.0.json +1144 -0
- package/morph-idm/Workflows/user/user-password-reset.1.0.0.json +45 -0
- package/package.json +21 -0
- package/vnext.config.json +58 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using System.Dynamic;
|
|
4
|
+
using System.Threading.Tasks;
|
|
5
|
+
using BBT.Workflow.Definitions;
|
|
6
|
+
using BBT.Workflow.Scripting;
|
|
7
|
+
using BBT.Workflow.Scripting.Functions;
|
|
8
|
+
|
|
9
|
+
/// <summary>
|
|
10
|
+
/// Mapping for creating auto-consent via consent workflow subflow.
|
|
11
|
+
/// Prepares the consent data from consent-selection instance data.
|
|
12
|
+
/// </summary>
|
|
13
|
+
public class CreateAutoConsentMapping : ScriptBase, ISubFlowMapping
|
|
14
|
+
{
|
|
15
|
+
public Task<ScriptResponse> InputHandler(ScriptContext context)
|
|
16
|
+
{
|
|
17
|
+
dynamic expandoObject = new ExpandoObject();
|
|
18
|
+
|
|
19
|
+
// Get user key
|
|
20
|
+
var userKey = context.Instance?.Data?.userName?.ToString() ?? string.Empty;
|
|
21
|
+
|
|
22
|
+
// Get client key
|
|
23
|
+
var clientId = context.Instance?.Data?.clientId?.ToString() ?? string.Empty;
|
|
24
|
+
|
|
25
|
+
// Get the first auto-consent eligible scope
|
|
26
|
+
var autoConsentEligibleScopes = context.Instance?.Data?.autoConsentEligibleScopes;
|
|
27
|
+
var selectedScopeKey = string.Empty;
|
|
28
|
+
var selectedGroupKey = string.Empty;
|
|
29
|
+
|
|
30
|
+
if (autoConsentEligibleScopes != null)
|
|
31
|
+
{
|
|
32
|
+
foreach (var scope in autoConsentEligibleScopes)
|
|
33
|
+
{
|
|
34
|
+
selectedScopeKey = scope?.scopeKey?.ToString();
|
|
35
|
+
selectedGroupKey = scope?.groupKey?.ToString();
|
|
36
|
+
if (!string.IsNullOrEmpty(selectedScopeKey))
|
|
37
|
+
{
|
|
38
|
+
break; // Use the first eligible scope
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Fallback to first scope from scopeSnapshot if no auto-consent scope found
|
|
44
|
+
if (string.IsNullOrEmpty(selectedScopeKey))
|
|
45
|
+
{
|
|
46
|
+
var scopes = context.Instance?.Data?.scopeSnapshot?.scopes;
|
|
47
|
+
if (scopes != null)
|
|
48
|
+
{
|
|
49
|
+
foreach (var scope in scopes)
|
|
50
|
+
{
|
|
51
|
+
selectedScopeKey = scope?.key?.ToString();
|
|
52
|
+
selectedGroupKey = scope?.groupKey?.ToString();
|
|
53
|
+
if (!string.IsNullOrEmpty(selectedScopeKey))
|
|
54
|
+
{
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Build consent key: {user}-{client}-{scope}
|
|
62
|
+
var consentKey = $"{userKey}-{clientId}-{selectedScopeKey}";
|
|
63
|
+
|
|
64
|
+
// Prepare consent data
|
|
65
|
+
expandoObject.key = consentKey;
|
|
66
|
+
expandoObject.tags = new List<string> { "auto-consent", "consent-selection-flow" };
|
|
67
|
+
|
|
68
|
+
// Build attributes for consent
|
|
69
|
+
var attributes = new ExpandoObject() as IDictionary<string, object>;
|
|
70
|
+
|
|
71
|
+
// User reference
|
|
72
|
+
attributes["user"] = new {
|
|
73
|
+
domain = "morph-idm",
|
|
74
|
+
workflow = "user",
|
|
75
|
+
key = userKey,
|
|
76
|
+
version = "1.0.0"
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// Client reference
|
|
80
|
+
attributes["client"] = new {
|
|
81
|
+
domain = "morph-idm",
|
|
82
|
+
workflow = "client",
|
|
83
|
+
key = clientId,
|
|
84
|
+
version = "1.0.0"
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// Scope reference
|
|
88
|
+
attributes["scope"] = new {
|
|
89
|
+
domain = "morph-idm",
|
|
90
|
+
workflow = "scope",
|
|
91
|
+
key = selectedScopeKey,
|
|
92
|
+
version = "1.0.0"
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// Default position
|
|
96
|
+
attributes["position"] = "self-access";
|
|
97
|
+
|
|
98
|
+
// Default roles for auto-consent
|
|
99
|
+
attributes["roles"] = new List<object>
|
|
100
|
+
{
|
|
101
|
+
new { role = "idm.self-access", allowance = "allow" }
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
// Set consent timestamps
|
|
105
|
+
attributes["grantedAt"] = DateTime.UtcNow.ToString("o");
|
|
106
|
+
attributes["expiresAt"] = DateTime.UtcNow.AddYears(1).ToString("o"); // 1 year default
|
|
107
|
+
|
|
108
|
+
// Flag to indicate this is auto-consent
|
|
109
|
+
attributes["isAutoConsent"] = true;
|
|
110
|
+
|
|
111
|
+
expandoObject.attributes = attributes;
|
|
112
|
+
|
|
113
|
+
LogInformation($"CreateAutoConsentMapping InputHandler: Creating auto-consent for user={userKey}, client={clientId}, scope={selectedScopeKey}, key={consentKey}");
|
|
114
|
+
|
|
115
|
+
return Task.FromResult(new ScriptResponse
|
|
116
|
+
{
|
|
117
|
+
Data = expandoObject,
|
|
118
|
+
Headers = null
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
public async Task<ScriptResponse> OutputHandler(ScriptContext context)
|
|
123
|
+
{
|
|
124
|
+
// Extract the created consent info from subflow response
|
|
125
|
+
var consentKey = context.Body?.key?.ToString();
|
|
126
|
+
var consentState = context.Body?.state?.ToString();
|
|
127
|
+
|
|
128
|
+
LogInformation($"CreateAutoConsentMapping OutputHandler: Auto-consent created - key={consentKey}, state={consentState}");
|
|
129
|
+
|
|
130
|
+
// Store the created consent info
|
|
131
|
+
return new ScriptResponse
|
|
132
|
+
{
|
|
133
|
+
Data = new
|
|
134
|
+
{
|
|
135
|
+
autoConsentCreated = true,
|
|
136
|
+
autoConsentKey = consentKey,
|
|
137
|
+
autoConsentState = consentState,
|
|
138
|
+
selectedConsent = new
|
|
139
|
+
{
|
|
140
|
+
key = consentKey,
|
|
141
|
+
roles = context.Body?.data?.roles,
|
|
142
|
+
expiresAt = context.Body?.data?.expiresAt
|
|
143
|
+
},
|
|
144
|
+
selectedConsentKey = consentKey
|
|
145
|
+
},
|
|
146
|
+
Headers = null
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
using System.Threading.Tasks;
|
|
2
|
+
using BBT.Workflow.Scripting;
|
|
3
|
+
using BBT.Workflow.Scripting.Functions;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Rule to check if there are multiple consents requiring user selection.
|
|
7
|
+
/// Returns true if consentCount > 1.
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class MultipleConsentsRule : ScriptBase, IConditionMapping
|
|
10
|
+
{
|
|
11
|
+
public async Task<bool> Handler(ScriptContext context)
|
|
12
|
+
{
|
|
13
|
+
if (!HasProperty(context.Instance?.Data, "consentCount"))
|
|
14
|
+
{
|
|
15
|
+
LogWarning("MultipleConsentsRule: consentCount not found");
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
var consentCount = (int)(context.Instance?.Data?.consentCount ?? 0);
|
|
20
|
+
|
|
21
|
+
if (consentCount > 1)
|
|
22
|
+
{
|
|
23
|
+
LogInformation($"MultipleConsentsRule: {consentCount} consents found, user selection required");
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
LogInformation($"MultipleConsentsRule: consentCount={consentCount}, not multiple");
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
using System.Threading.Tasks;
|
|
2
|
+
using BBT.Workflow.Scripting;
|
|
3
|
+
using BBT.Workflow.Scripting.Functions;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Rule to check if there are no consents but auto-consent is eligible.
|
|
7
|
+
/// Returns true if consentCount == 0 AND hasAutoConsentEligible == true.
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class NoConsentEligibleRule : ScriptBase, IConditionMapping
|
|
10
|
+
{
|
|
11
|
+
public async Task<bool> Handler(ScriptContext context)
|
|
12
|
+
{
|
|
13
|
+
if (!HasProperty(context.Instance?.Data, "consentCount"))
|
|
14
|
+
{
|
|
15
|
+
LogWarning("NoConsentEligibleRule: consentCount not found");
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
var consentCount = (int)(context.Instance?.Data?.consentCount ?? 0);
|
|
20
|
+
|
|
21
|
+
if (consentCount > 0)
|
|
22
|
+
{
|
|
23
|
+
LogInformation($"NoConsentEligibleRule: consentCount={consentCount}, consents exist");
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Check auto-consent eligibility
|
|
28
|
+
var hasAutoConsentEligible = false;
|
|
29
|
+
if (HasProperty(context.Instance?.Data, "hasAutoConsentEligible"))
|
|
30
|
+
{
|
|
31
|
+
hasAutoConsentEligible = context.Instance?.Data?.hasAutoConsentEligible == true;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (hasAutoConsentEligible)
|
|
35
|
+
{
|
|
36
|
+
LogInformation("NoConsentEligibleRule: No consents but auto-consent eligible, creating auto-consent");
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
LogInformation("NoConsentEligibleRule: No consents and not eligible for auto-consent");
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
using System.Threading.Tasks;
|
|
2
|
+
using BBT.Workflow.Scripting;
|
|
3
|
+
using BBT.Workflow.Scripting.Functions;
|
|
4
|
+
|
|
5
|
+
/// <summary>
|
|
6
|
+
/// Rule to check if there is exactly one consent.
|
|
7
|
+
/// Returns true if consentCount == 1, auto-selecting it.
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class SingleConsentRule : ScriptBase, IConditionMapping
|
|
10
|
+
{
|
|
11
|
+
public async Task<bool> Handler(ScriptContext context)
|
|
12
|
+
{
|
|
13
|
+
if (!HasProperty(context.Instance?.Data, "consentCount"))
|
|
14
|
+
{
|
|
15
|
+
LogWarning("SingleConsentRule: consentCount not found");
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
var consentCount = (int)(context.Instance?.Data?.consentCount ?? 0);
|
|
20
|
+
|
|
21
|
+
if (consentCount == 1)
|
|
22
|
+
{
|
|
23
|
+
// Auto-select the single consent
|
|
24
|
+
var consents = context.Instance?.Data?.consents;
|
|
25
|
+
if (consents != null)
|
|
26
|
+
{
|
|
27
|
+
foreach (var consent in consents)
|
|
28
|
+
{
|
|
29
|
+
var consentKey = consent?.key?.ToString();
|
|
30
|
+
LogInformation($"SingleConsentRule: Auto-selecting single consent: {consentKey}");
|
|
31
|
+
|
|
32
|
+
// Store selected consent
|
|
33
|
+
context.Instance.Data.selectedConsent = consent;
|
|
34
|
+
context.Instance.Data.selectedConsentKey = consentKey;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
LogInformation($"SingleConsentRule: consentCount={consentCount}, not single");
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "../../../schemas/schemas/workflow-definition.schema.json",
|
|
3
|
+
"key": "device",
|
|
4
|
+
"flow": "sys-flows",
|
|
5
|
+
"domain": "morph-idm",
|
|
6
|
+
"version": "1.0.0",
|
|
7
|
+
"tags": [
|
|
8
|
+
"new"
|
|
9
|
+
],
|
|
10
|
+
"attributes": {
|
|
11
|
+
"type": "F",
|
|
12
|
+
"labels": [
|
|
13
|
+
{
|
|
14
|
+
"label": "Device",
|
|
15
|
+
"language": "en"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"startTransition": {
|
|
19
|
+
"key": "start",
|
|
20
|
+
"target": "saved",
|
|
21
|
+
"triggerType": 0,
|
|
22
|
+
"versionStrategy": "Minor",
|
|
23
|
+
"schema": {
|
|
24
|
+
"key": "device-start",
|
|
25
|
+
"domain": "morph-idm",
|
|
26
|
+
"version": "1.0.0",
|
|
27
|
+
"flow": "sys-schemas"
|
|
28
|
+
},
|
|
29
|
+
"labels": [
|
|
30
|
+
{
|
|
31
|
+
"label": "Başlat",
|
|
32
|
+
"language": "tr"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"label": "Start",
|
|
36
|
+
"language": "en"
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
},
|
|
40
|
+
"sharedTransitions": [
|
|
41
|
+
{
|
|
42
|
+
"key": "update",
|
|
43
|
+
"target": "$self",
|
|
44
|
+
"versionStrategy": "Major",
|
|
45
|
+
"triggerType": 0,
|
|
46
|
+
"schema": {
|
|
47
|
+
"key": "device-update",
|
|
48
|
+
"domain": "morph-idm",
|
|
49
|
+
"version": "1.0.0",
|
|
50
|
+
"flow": "sys-schemas"
|
|
51
|
+
},
|
|
52
|
+
"mapping": {
|
|
53
|
+
"location": "mappings/device-update-request.mapper.json",
|
|
54
|
+
"code": ""
|
|
55
|
+
},
|
|
56
|
+
"labels": [
|
|
57
|
+
{
|
|
58
|
+
"label": "Güncelle",
|
|
59
|
+
"language": "tr"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"label": "Update",
|
|
63
|
+
"language": "en"
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
"availableIn": [
|
|
67
|
+
"saved",
|
|
68
|
+
"registered"
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"states": [
|
|
73
|
+
{
|
|
74
|
+
"key": "saved",
|
|
75
|
+
"stateType": 1,
|
|
76
|
+
"versionStrategy": "Minor",
|
|
77
|
+
"labels": [
|
|
78
|
+
{
|
|
79
|
+
"language": "tr",
|
|
80
|
+
"label": "Kayıtlı"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"language": "en",
|
|
84
|
+
"label": "Saved"
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"transitions": [
|
|
88
|
+
{
|
|
89
|
+
"key": "assign-user",
|
|
90
|
+
"target": "registered",
|
|
91
|
+
"versionStrategy": "Minor",
|
|
92
|
+
"triggerType": 0,
|
|
93
|
+
"schema": null,
|
|
94
|
+
"labels": [
|
|
95
|
+
{
|
|
96
|
+
"label": "Kullanıcı Ata",
|
|
97
|
+
"language": "tr"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"label": "Assign User",
|
|
101
|
+
"language": "en"
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"key": "expire-saved",
|
|
107
|
+
"target": "expired",
|
|
108
|
+
"versionStrategy": "Major",
|
|
109
|
+
"triggerType": 0,
|
|
110
|
+
"schema": null,
|
|
111
|
+
"labels": [
|
|
112
|
+
{
|
|
113
|
+
"label": "Süre Doldu",
|
|
114
|
+
"language": "tr"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"label": "Timeout",
|
|
118
|
+
"language": "en"
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"key": "registered",
|
|
126
|
+
"stateType": 2,
|
|
127
|
+
"versionStrategy": "Minor",
|
|
128
|
+
"labels": [
|
|
129
|
+
{
|
|
130
|
+
"language": "tr",
|
|
131
|
+
"label": "Kayıtlı"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"language": "en",
|
|
135
|
+
"label": "Registered"
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
"transitions": [
|
|
139
|
+
{
|
|
140
|
+
"key": "unassign-user",
|
|
141
|
+
"target": "saved",
|
|
142
|
+
"versionStrategy": "Major",
|
|
143
|
+
"triggerType": 0,
|
|
144
|
+
"schema": null,
|
|
145
|
+
"labels": [
|
|
146
|
+
{
|
|
147
|
+
"label": "Kullanıcı Atamasını Kaldır",
|
|
148
|
+
"language": "tr"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"label": "Unassign User",
|
|
152
|
+
"language": "en"
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"key": "ban-device",
|
|
158
|
+
"target": "banned",
|
|
159
|
+
"versionStrategy": "Major",
|
|
160
|
+
"triggerType": 0,
|
|
161
|
+
"schema": null,
|
|
162
|
+
"labels": [
|
|
163
|
+
{
|
|
164
|
+
"label": "Cihazı Yasakla",
|
|
165
|
+
"language": "tr"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"label": "Ban Device",
|
|
169
|
+
"language": "en"
|
|
170
|
+
}
|
|
171
|
+
]
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"key": "reassign-user",
|
|
175
|
+
"target": "registered",
|
|
176
|
+
"versionStrategy": "Minor",
|
|
177
|
+
"triggerType": 0,
|
|
178
|
+
"schema": null,
|
|
179
|
+
"labels": [
|
|
180
|
+
{
|
|
181
|
+
"label": "Kullanıcıyı Yeniden Ata",
|
|
182
|
+
"language": "tr"
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"label": "Reassign User",
|
|
186
|
+
"language": "en"
|
|
187
|
+
}
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"key": "expire-registered",
|
|
192
|
+
"target": "expired",
|
|
193
|
+
"versionStrategy": "Major",
|
|
194
|
+
"triggerType": 0,
|
|
195
|
+
"schema": null,
|
|
196
|
+
"labels": [
|
|
197
|
+
{
|
|
198
|
+
"label": "Süre Doldu",
|
|
199
|
+
"language": "tr"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"label": "Timeout",
|
|
203
|
+
"language": "en"
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
]
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"key": "banned",
|
|
211
|
+
"stateType": 2,
|
|
212
|
+
"versionStrategy": "Minor",
|
|
213
|
+
"labels": [
|
|
214
|
+
{
|
|
215
|
+
"language": "tr",
|
|
216
|
+
"label": "Yasaklı"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"language": "en",
|
|
220
|
+
"label": "Banned"
|
|
221
|
+
}
|
|
222
|
+
],
|
|
223
|
+
"transitions": [
|
|
224
|
+
{
|
|
225
|
+
"key": "unban-device",
|
|
226
|
+
"target": "registered",
|
|
227
|
+
"versionStrategy": "Major",
|
|
228
|
+
"triggerType": 0,
|
|
229
|
+
"schema": null,
|
|
230
|
+
"labels": [
|
|
231
|
+
{
|
|
232
|
+
"label": "Cihaz Yasakını Kaldır",
|
|
233
|
+
"language": "tr"
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"label": "Unban Device",
|
|
237
|
+
"language": "en"
|
|
238
|
+
}
|
|
239
|
+
]
|
|
240
|
+
}
|
|
241
|
+
]
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"key": "expired",
|
|
245
|
+
"stateType": 3,
|
|
246
|
+
"versionStrategy": "Minor",
|
|
247
|
+
"labels": [
|
|
248
|
+
{
|
|
249
|
+
"language": "tr",
|
|
250
|
+
"label": "Süresi Doldu"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"language": "en",
|
|
254
|
+
"label": "Expired"
|
|
255
|
+
}
|
|
256
|
+
],
|
|
257
|
+
"transitions": []
|
|
258
|
+
}
|
|
259
|
+
]
|
|
260
|
+
}
|
|
261
|
+
}
|