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-plugins
Commits
e492d192
Verified
Commit
e492d192
authored
6 months ago
by
dockx thibault
Browse files
Options
Download
Patches
Plain Diff
Feat(Reminder) - supann update works
supann update works
parent
909fa01a
dev
6310-tasks-reminder-error-in-the-schema-duplicate-attribute-id
6311-put-the-version-1-5-in-all-yaml-for-fusiondirectory-1-5
6322-template-issue-when-creating-a-template-with-empty-password-error-message-should-not-be-seen-2
6332-zimbra-allows-update-of-data-for-unknown-domain-name-for-specific-individual-aliases
6337-webservice-issue-with-archiving-post-request-not-responding-but-successfully-archiving-user
6341-supann-extract-resources-states-sub-states-from-backend-configuration-to-their-own-objects
master
fusiondirectory-1.5
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
user-reminder/html/class_reminderFrontEnd.inc
+37
-18
user-reminder/html/class_reminderFrontEnd.inc
with
37 additions
and
18 deletions
+37
-18
user-reminder/html/class_reminderFrontEnd.inc
+
37
−
18
View file @
e492d192
...
...
@@ -38,6 +38,7 @@ class reminderFrontEnd extends standAlonePage
private
array
$task
;
private
string
$uid
;
private
string
$userDN
;
private
string
$message
;
/**
* @return bool
...
...
@@ -79,7 +80,7 @@ class reminderFrontEnd extends standAlonePage
if
(
!
empty
(
$this
->
uid
))
{
// verification of token
if
(
!
$this
->
checkToken
(
$this
->
token
))
{
$this
->
message
[]
=
"Error, data received are incorrect!"
;
$this
->
message
=
"Error, data received are incorrect!"
;
}
else
{
$success
=
$this
->
prolongedAccount
();
}
...
...
@@ -102,7 +103,7 @@ class reminderFrontEnd extends standAlonePage
private
function
prolongedAccount
():
bool
{
// Generate the supann string from main task.
$newIncompleteSupann
=
$this
->
createSupannString
();
$newIncompleteSupann
=
$this
->
createSupannString
(
TRUE
);
// retrieve all supann resource for specific user
$userSupann
=
$this
->
retrieveUserSupann
();
// Find a match between task supann string and user supann strings
...
...
@@ -121,24 +122,38 @@ class reminderFrontEnd extends standAlonePage
* @param $newSupannRessourceEtatDate
* @return bool
*/
private
function
updateUserSupannResource
(
$userSupannRessourceEtat
,
$newSupannRessourceEtatDate
)
:
bool
private
function
updateUserSupannResource
(
$userSupannRessourceEtat
,
$newSupannRessourceEtatDate
):
bool
{
global
$config
;
$result
=
FALSE
;
$ldap
=
$config
->
get_ldap_link
();
// We first have to delete the previous supannRessourceEtatDate
try
{
}
catch
(
Exception
$e
)
{
// Open the user tabs
$userTabs
=
objects
::
open
(
$this
->
userDN
,
'user'
);
// Verify if supann Account Status tab is available
if
(
isset
(
$userTabs
->
by_object
[
'supannAccountStatus'
]))
{
$supannRessourceEtatDateValues
=
[];
// Iteration on all potential supann values existing for that user dn.
foreach
(
$userTabs
->
by_object
[
'supannAccountStatus'
]
->
supannRessourceEtatDate
as
$line
)
{
list
(
$resource
,
$state
,
$subState
,
$start
,
$end
)
=
$userTabs
->
by_object
[
'supannAccountStatus'
]
->
attributesAccess
[
'supannRessourceEtatDate'
]
->
attribute
->
readValues
(
$line
);
// Simply create a string of the supann array received. Helping for the verification below.
$supannString
=
$this
->
createSupannString
(
FALSE
,
$resource
,
$state
,
$subState
,
$start
,
$end
);
// If there is a match with the user supann retrieve and previous methods, we change that value to the new one.
if
(
$supannString
===
$userSupannRessourceEtat
)
{
$supannRessourceEtatDateValues
[]
=
$newSupannRessourceEtatDate
;
}
else
{
// If not we have to keep previous supann value intact. (Mail or other resources, we mostly use account).
$supannRessourceEtatDateValues
[]
=
$line
;
}
}
$userTabs
->
by_object
[
'supannAccountStatus'
]
->
supannRessourceEtatDate
=
$supannRessourceEtatDateValues
;
}
$error
=
$userTabs
->
save
();
// We add the new supannRessourceEtatDate
try
{
}
catch
(
Exception
$e
)
{
if
(
!
empty
(
$error
))
{
$this
->
message
=
to_string
(
$error
);
}
else
{
$result
=
TRUE
;
}
return
$result
;
...
...
@@ -148,17 +163,21 @@ class reminderFrontEnd extends standAlonePage
* @return string
* Note : Simply create a string recognized by the ldap attribute supannRessourceEtat
*/
private
function
createSupannString
():
string
private
function
createSupannString
(
bool
$task
,
?string
$resource
=
''
,
?string
$state
=
''
,
?string
$subState
=
''
,
?string
$start
=
''
,
?string
$end
=
''
):
string
{
$supann
=
NULL
;
if
(
!
empty
(
$this
->
task
[
'resource'
]))
{
if
(
$task
&&
!
empty
(
$this
->
task
[
'resource'
]))
{
// case of subState present
if
(
!
empty
(
$this
->
task
[
'subState'
]))
{
$supann
=
'{'
.
$this
->
task
[
'resource'
]
.
'}'
.
$this
->
task
[
'state'
]
.
':'
.
$this
->
task
[
'subState'
];
}
else
{
$supann
=
'{'
.
$this
->
task
[
'resource'
]
.
'}'
.
$this
->
task
[
'state'
];
}
// This is going to be used for in the last supann verification when users tabs are open before updating states.
}
elseif
(
!
empty
(
$resource
))
{
$supann
=
'{'
.
$resource
.
'}'
.
$state
.
':'
.
$subState
.
':'
.
$start
.
':'
.
$end
;
}
return
$supann
;
...
...
@@ -364,7 +383,7 @@ class reminderFrontEnd extends standAlonePage
$dn
=
'ou='
.
$this
->
uid
.
',ou=tokens'
.
$config
->
current
[
'BASE'
];
$ldap
->
rmdir
(
$dn
);
if
(
!
$ldap
->
success
())
{
$this
->
message
[]
=
$ldap
->
get_error
();
$this
->
message
=
$ldap
->
get_error
();
}
}
...
...
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