Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
fusiondirectory
fusiondirectory-orchestrator
Commits
532cf7b6
Verified
Commit
532cf7b6
authored
5 months ago
by
dockx thibault
Browse files
Options
Download
Patches
Plain Diff
Feat(Orchestrator) - lifecycle supann check logic
Changes supann check logic
parent
d22abf24
dev
63-orchestrator-mail-controller-format-of-mail-text-and-signature-are-not-utf8-usage-of-accents-is
70-create-unitests-for-orchestrator
73-orchestrator-create-a-librabry-in-core-orchestrator
78-redesign-audit-class
79-redesign-mail
80-redesign-notifications-class
81-redesign-reminders-class
82-redesign-lifecycle-class
main
revert-55863b23
1.1
2 merge requests
!72
Releasing Fusiondirectory Orchestrator 1.1
,
!63
Resolve "[Orchestrator] - LifeCycle array supann is analyzed with static numbering"
Pipeline
#30532
passed with stages
in 1 minute and 44 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/tasks/LifeCycle.php
+23
-19
plugins/tasks/LifeCycle.php
with
23 additions
and
19 deletions
+23
-19
plugins/tasks/LifeCycle.php
+
23
−
19
View file @
532cf7b6
...
@@ -138,31 +138,35 @@ class LifeCycle implements EndpointInterface
...
@@ -138,31 +138,35 @@ class LifeCycle implements EndpointInterface
if
(
empty
(
$currentUserLifeCycle
[
0
][
'supannressourceetatdate'
][
0
]))
{
if
(
empty
(
$currentUserLifeCycle
[
0
][
'supannressourceetatdate'
][
0
]))
{
return
FALSE
;
return
FALSE
;
}
}
// Perform the regular expression match
preg_match
(
$pattern
,
$currentUserLifeCycle
[
0
][
'supannressourceetatdate'
][
0
],
$matches
);
// Extracting values of current user
$userSupann
[
'Resource'
]
=
$matches
[
1
]
??
''
;
$userSupann
[
'State'
]
=
$matches
[
2
]
??
''
;
$userSupann
[
'SubState'
]
=
$matches
[
3
]
??
''
;
// Array index 4 is skipped, we only use end date to apply our life cycle logic. Start date has no use here.
$userSupann
[
'EndDate'
]
=
$matches
[
5
]
??
''
;
// Extracting values of desired pre-state behavior
// Extracting values of desired pre-state behavior
$preStateSupann
[
'Resource'
]
=
$lifeCycleBehavior
[
0
][
'fdtaskslifecyclepreresource'
][
0
];
$preStateSupann
[
'Resource'
]
=
$lifeCycleBehavior
[
0
][
'fdtaskslifecyclepreresource'
][
0
];
$preStateSupann
[
'State'
]
=
$lifeCycleBehavior
[
0
][
'fdtaskslifecycleprestate'
][
0
];
$preStateSupann
[
'State'
]
=
$lifeCycleBehavior
[
0
][
'fdtaskslifecycleprestate'
][
0
];
$preStateSupann
[
'SubState'
]
=
$lifeCycleBehavior
[
0
][
'fdtaskslifecyclepresubstate'
][
0
]
??
''
;
//SubState is optional
$preStateSupann
[
'SubState'
]
=
$lifeCycleBehavior
[
0
][
'fdtaskslifecyclepresubstate'
][
0
]
??
''
;
//SubState is optional
// Verifying if the user end date for selected resource is overdue
// Iteration of all potential existing supann states of the user in order to find a match
if
(
!
empty
(
$userSupann
[
'EndDate'
])
&&
strtotime
(
$userSupann
[
'EndDate'
])
<=
time
())
{
foreach
(
$currentUserLifeCycle
[
0
][
'supannressourceetatdate'
]
as
$resource
)
{
// Comparing value in a nesting conditions
// Perform the regular expression match
if
(
$userSupann
[
'Resource'
]
==
$preStateSupann
[
'Resource'
])
{
preg_match
(
$pattern
,
$resource
,
$matches
);
if
(
$userSupann
[
'State'
]
==
$preStateSupann
[
'State'
])
{
// as SubState is optional, if both resource and state match at this point, modification is allowed.
// Extracting values of current user
if
(
empty
(
$preStateSupann
[
'SubState'
]))
{
$userSupann
[
'Resource'
]
=
$matches
[
1
]
??
''
;
$result
=
TRUE
;
$userSupann
[
'State'
]
=
$matches
[
2
]
??
''
;
}
else
if
(
$preStateSupann
[
'SubState'
]
==
$userSupann
[
'SubState'
])
{
$userSupann
[
'SubState'
]
=
$matches
[
3
]
??
''
;
$result
=
TRUE
;
// Array index 4 is skipped, we only use end date to apply our life cycle logic. Start date has no use here.
$userSupann
[
'EndDate'
]
=
$matches
[
5
]
??
''
;
// Verifying if the user end date for selected resource is overdue
if
(
!
empty
(
$userSupann
[
'EndDate'
])
&&
strtotime
(
$userSupann
[
'EndDate'
])
<=
time
())
{
// Comparing value in a nesting conditions
if
(
$userSupann
[
'Resource'
]
==
$preStateSupann
[
'Resource'
])
{
if
(
$userSupann
[
'State'
]
==
$preStateSupann
[
'State'
])
{
// as SubState is optional, if both resource and state match at this point, modification is allowed.
if
(
empty
(
$preStateSupann
[
'SubState'
]))
{
$result
=
TRUE
;
}
else
if
(
$preStateSupann
[
'SubState'
]
==
$userSupann
[
'SubState'
])
{
$result
=
TRUE
;
}
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets