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
e6064cc5
Verified
Commit
e6064cc5
authored
6 years ago
by
Côme Chilliet
Browse files
Options
Download
Patches
Plain Diff
feat(invitations) Add registrations handling
issue
#5850
parent
26a7fd85
dev
6104-mail-methods-refactor
6231-give-the-ability-to-the-webservice-to-notice-if-an-attribute-is-monovalued-or-multivalued
6237-add-requiredattrs-array-to-the-webservice-informations
6245-adapt-the-ci-to-the-reorganisation-of-the-dev-tools-and-fixing-the-trigger-downstream-pipelines
6250-supann-configuration-backend-requires-account-life-cycle-section
6280-plugins-update-plugins-to-take-into-consideration-the-new-directory-of-core-structure
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
6346-lifecycle-adaptation-to-select-supann-resources-and-related-states-via-regex-mechanism
master
fusiondirectory-1.5
fusiondirectory-1.4
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
invitations/admin/invitations/class_invitation.inc
+88
-5
invitations/admin/invitations/class_invitation.inc
invitations/admin/invitations/class_invitationManagement.inc
+1
-1
invitations/admin/invitations/class_invitationManagement.inc
invitations/admin/invitations/class_registration.inc
+82
-0
invitations/admin/invitations/class_registration.inc
invitations/config/invitations/class_invitationsConfig.inc
+5
-0
invitations/config/invitations/class_invitationsConfig.inc
invitations/contrib/openldap/invitations-fd-conf.schema
+8
-1
invitations/contrib/openldap/invitations-fd-conf.schema
invitations/contrib/openldap/invitations-fd.schema
+14
-14
invitations/contrib/openldap/invitations-fd.schema
with
198 additions
and
21 deletions
+198
-21
invitations/admin/invitations/class_invitation.inc
+
88
−
5
View file @
e6064cc5
...
@@ -52,6 +52,10 @@ class invitation extends simplePlugin
...
@@ -52,6 +52,10 @@ class invitation extends simplePlugin
_
(
'Name'
),
_
(
'Name used to identify this invitation'
),
_
(
'Name'
),
_
(
'Name used to identify this invitation'
),
'cn'
,
TRUE
'cn'
,
TRUE
),
),
new
SelectAttribute
(
_
(
'Form'
),
_
(
'Public form this invitation should link to'
),
'fdInvitationFormDN'
,
TRUE
),
new
StringAttribute
(
new
StringAttribute
(
_
(
'Email subject'
),
_
(
'Subject of the email sent for this invitation'
),
_
(
'Email subject'
),
_
(
'Subject of the email sent for this invitation'
),
'fdInvitationEmailSubject'
,
TRUE
'fdInvitationEmailSubject'
,
TRUE
...
@@ -60,10 +64,6 @@ class invitation extends simplePlugin
...
@@ -60,10 +64,6 @@ class invitation extends simplePlugin
_
(
'Email content'
),
_
(
'Content of the email sent for this invitation'
),
_
(
'Email content'
),
_
(
'Content of the email sent for this invitation'
),
'fdInvitationEmailContent'
,
TRUE
'fdInvitationEmailContent'
,
TRUE
),
),
new
SelectAttribute
(
_
(
'Form'
),
_
(
'Public form this invitation should link to'
),
'fdInvitationFormDN'
,
TRUE
),
new
DisplayLDAPAttribute
(
new
DisplayLDAPAttribute
(
_
(
'Author'
),
_
(
'Author of this invitation'
),
_
(
'Author'
),
_
(
'Author of this invitation'
),
'fdInvitationAuthor'
,
FALSE
,
'fdInvitationAuthor'
,
FALSE
,
...
@@ -71,6 +71,19 @@ class invitation extends simplePlugin
...
@@ -71,6 +71,19 @@ class invitation extends simplePlugin
),
),
)
)
),
),
'emails'
=>
array
(
'name'
=>
_
(
'Emails'
),
'attrs'
=>
array
(
new
StringAttribute
(
_
(
'From email'
),
_
(
'Email address set as "From" field and "Reply to" in the sent emails'
),
'from_mail'
,
FALSE
),
new
FileTextAreaAttribute
(
_
(
'Emails'
),
_
(
'List of email adresses of people to invite - one per line'
),
'emails'
,
FALSE
),
)
)
);
);
}
}
...
@@ -80,9 +93,79 @@ class invitation extends simplePlugin
...
@@ -80,9 +93,79 @@ class invitation extends simplePlugin
$attributesInfo
=
$this
->
getAttributesInfo
();
$attributesInfo
=
$this
->
getAttributesInfo
();
}
}
$choices
=
objects
::
ls
(
'publicForm'
);
$choices
=
objects
::
ls
(
'publicForm'
);
$attributesInfo
[
'main'
][
'attrs'
][
4
]
->
setChoices
(
array_keys
(
$choices
),
array_values
(
$choices
));
$attributesInfo
[
'main'
][
'attrs'
][
2
]
->
setChoices
(
array_keys
(
$choices
),
array_values
(
$choices
));
$attributesInfo
[
'emails'
][
'attrs'
][
0
]
->
setInLdap
(
FALSE
);
$attributesInfo
[
'emails'
][
'attrs'
][
1
]
->
setInLdap
(
FALSE
);
parent
::
__construct
(
$dn
,
$object
,
$parent
,
$mainTab
,
$attributesInfo
);
parent
::
__construct
(
$dn
,
$object
,
$parent
,
$mainTab
,
$attributesInfo
);
}
}
function
check
()
{
$messages
=
parent
::
check
();
$emails
=
explode
(
"
\n
"
,
$this
->
emails
);
foreach
(
$emails
as
$email
)
{
if
(
!
tests
::
is_email
(
$email
))
{
$messages
[]
=
sprintf
(
_
(
'"%s" is not a valid email address'
),
$email
);
}
}
if
(
!
empty
(
$emails
)
&&
empty
(
$this
->
from_mail
))
{
$messages
[]
=
sprintf
(
_
(
'You need to fill the "%s" field in order to send invitations'
),
$this
->
attributesAccess
[
'from_mail'
]
->
getLabel
());
}
return
$messages
;
}
protected
function
shouldSave
()
{
return
(
parent
::
shouldSave
()
||
!
empty
(
$this
->
emails
));
}
protected
function
ldap_save
()
{
global
$ui
;
$errors
=
parent
::
ldap_save
();
if
(
!
empty
(
$errors
))
{
return
$errors
;
}
$emails
=
explode
(
"
\n
"
,
$this
->
emails
);
$success
=
0
;
foreach
(
$emails
as
$email
)
{
if
(
empty
(
$email
))
{
continue
;
}
if
(
mail_utf8
(
$email
,
FALSE
,
$this
->
from_mail
,
$this
->
fdInvitationEmailSubject
,
$this
->
fdInvitationEmailContent
))
{
$tabObject
=
objects
::
create
(
'registration'
);
$baseObject
=
$tabObject
->
getBaseObject
();
$baseObject
->
base
=
$this
->
base
;
$baseObject
->
fdRegistrationEmailAddress
=
$email
;
$baseObject
->
fdRegistrationState
=
'sent'
;
$baseObject
->
fdRegistrationLastChange
=
date
(
'c'
)
.
':'
.
$ui
->
dn
;
$baseObject
->
fdRegistrationInvitationDN
=
$this
->
dn
;
$messages
=
$tabObject
->
save
();
if
(
!
empty
(
$messages
))
{
$errors
[]
=
sprintf
(
_
(
'Failed to create registration object for "%s", because of the following errors: %s'
),
$email
,
implode
(
"
\n
"
,
$messages
));
}
else
{
$success
++
;
}
}
else
{
$errors
[]
=
sprintf
(
_
(
'Failed to send invitation email to "%s". Check your email settings.'
),
$email
);
}
}
if
(
$success
>
0
)
{
msg_dialog
::
display
(
_
(
'Success'
),
sprintf
(
_
(
'%d invitations were sent and saved successfully'
),
$success
),
INFO_DIALOG
);
}
return
$errors
;
}
}
}
?>
?>
This diff is collapsed.
Click to expand it.
invitations/admin/invitations/class_invitationManagement.inc
+
1
−
1
View file @
e6064cc5
...
@@ -28,7 +28,7 @@ class invitationManagement extends management
...
@@ -28,7 +28,7 @@ class invitationManagement extends management
'plDescription'
=>
_
(
'Manage invitations'
),
'plDescription'
=>
_
(
'Manage invitations'
),
'plIcon'
=>
''
,
'plIcon'
=>
''
,
'plSection'
=>
'accounts'
,
'plSection'
=>
'accounts'
,
'plManages'
=>
array
(
'invitation'
),
'plManages'
=>
array
(
'invitation'
,
'registration'
),
'plProvidedAcls'
=>
array
()
'plProvidedAcls'
=>
array
()
);
);
...
...
This diff is collapsed.
Click to expand it.
invitations/admin/invitations/class_registration.inc
0 → 100644
+
82
−
0
View file @
e6064cc5
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2017-2018 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class
registration
extends
simplePlugin
{
public
static
function
plInfo
()
{
return
array
(
'plShortName'
=>
_
(
'Registration'
),
'plDescription'
=>
_
(
'Registration sent through a public form'
),
'plIcon'
=>
''
,
'plObjectClass'
=>
array
(
'fdRegistration'
),
'plObjectType'
=>
array
(
'registration'
=>
array
(
'name'
=>
_
(
'Registration'
),
'ou'
=>
get_ou
(
'registrationRDN'
),
'icon'
=>
''
,
'mainAttr'
=>
'fdRegistrationEmailAddress'
,
)),
'plForeignKeys'
=>
array
(
'fdRegistrationInvitationDN'
=>
'invitation'
,
'fdRegistrationUserDN'
=>
'user'
,
),
'plProvidedAcls'
=>
parent
::
generatePlProvidedAcls
(
static
::
getAttributesInfo
())
);
}
static
function
getAttributesInfo
()
{
return
array
(
'main'
=>
array
(
'name'
=>
_
(
'Registration'
),
'attrs'
=>
array
(
new
BaseSelectorAttribute
(
get_ou
(
'registrationRDN'
)),
new
DisplayLDAPAttribute
(
_
(
'Email address'
),
_
(
'Email address which the invitation was sent to'
),
'fdRegistrationEmailAddress'
,
TRUE
),
new
DisplayLDAPAttribute
(
_
(
'Status'
),
_
(
'State of this registration'
),
'fdRegistrationState'
,
FALSE
),
new
DisplayLDAPAttribute
(
_
(
'Last change'
),
_
(
'Date and author of the last state change'
),
'fdRegistrationLastChange'
,
FALSE
),
new
DisplayLDAPAttribute
(
_
(
'Invitation'
),
_
(
'Invitation object used to create this registration'
),
'fdRegistrationInvitationDN'
,
FALSE
),
new
DisplayLDAPAttribute
(
_
(
'User object'
),
_
(
'User object created by this registration'
),
'fdRegistrationUserDN'
,
FALSE
),
)
),
);
}
function
__construct
(
$dn
=
NULL
,
$object
=
NULL
,
$parent
=
NULL
,
$mainTab
=
FALSE
,
$attributesInfo
=
NULL
)
{
parent
::
__construct
(
$dn
,
$object
,
$parent
,
$mainTab
,
$attributesInfo
);
}
}
?>
This diff is collapsed.
Click to expand it.
invitations/config/invitations/class_invitationsConfig.inc
+
5
−
0
View file @
e6064cc5
...
@@ -44,6 +44,11 @@ class invitationsConfig extends simplePlugin
...
@@ -44,6 +44,11 @@ class invitationsConfig extends simplePlugin
'fdInvitationRDN'
,
TRUE
,
'fdInvitationRDN'
,
TRUE
,
'ou=invitations'
'ou=invitations'
),
),
new
StringAttribute
(
_
(
'Registrations RDN'
),
_
(
'Branch in which registrations will be stored'
),
'fdRegistrationRDN'
,
TRUE
,
'ou=registrations'
),
)
)
),
),
);
);
...
...
This diff is collapsed.
Click to expand it.
invitations/contrib/openldap/invitations-fd-conf.schema
+
8
−
1
View file @
e6064cc5
...
@@ -10,9 +10,16 @@ attributetype ( 1.3.6.1.4.1.38414.70.1.1 NAME 'fdInvitationRDN'
...
@@ -10,9 +10,16 @@ attributetype ( 1.3.6.1.4.1.38414.70.1.1 NAME 'fdInvitationRDN'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE)
SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.38414.70.1.2 NAME 'fdRegistrationRDN'
DESC 'FusionDirectory - Registrations RDN'
EQUALITY caseExactIA5Match
SUBSTR caseExactIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE)
# Object Class
# Object Class
objectclass ( 1.3.6.1.4.1.38414.70.2.1 NAME 'fdInvitationsPluginConf'
objectclass ( 1.3.6.1.4.1.38414.70.2.1 NAME 'fdInvitationsPluginConf'
DESC 'FusionDirectory - Invitations plugin configuration'
DESC 'FusionDirectory - Invitations plugin configuration'
SUP top AUXILIARY
SUP top AUXILIARY
MUST ( cn )
MUST ( cn )
MAY ( fdInvitationRDN ) )
MAY ( fdInvitationRDN
$ fdRegistrationRDN
) )
This diff is collapsed.
Click to expand it.
invitations/contrib/openldap/invitations-fd.schema
+
14
−
14
View file @
e6064cc5
...
@@ -34,36 +34,36 @@ attributetype ( 1.3.6.1.4.1.38414.69.10.4 NAME 'fdInvitationAuthor'
...
@@ -34,36 +34,36 @@ attributetype ( 1.3.6.1.4.1.38414.69.10.4 NAME 'fdInvitationAuthor'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.69.11.1 NAME 'fd
Inscrip
tionEmailAddress'
attributetype ( 1.3.6.1.4.1.38414.69.11.1 NAME 'fd
Registra
tionEmailAddress'
DESC 'FusionDirectory - Email address
to
which the invitation was sent to'
DESC 'FusionDirectory - Email address which the invitation was sent to'
EQUALITY caseIgnoreIA5Match
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
SINGLE-VALUE )
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.69.11.2 NAME 'fd
Inscrip
tionState'
attributetype ( 1.3.6.1.4.1.38414.69.11.2 NAME 'fd
Registra
tionState'
DESC 'FusionDirectory - State of this
inscrip
tion'
DESC 'FusionDirectory - State of this
registra
tion'
EQUALITY caseIgnoreIA5Match
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
SINGLE-VALUE )
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.69.11.3 NAME 'fd
Inscrip
tionLastChange'
attributetype ( 1.3.6.1.4.1.38414.69.11.3 NAME 'fd
Registra
tionLastChange'
DESC 'FusionDirectory - Date and author of the last state change'
DESC 'FusionDirectory - Date and author of the last state change'
EQUALITY caseIgnoreIA5Match
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
SINGLE-VALUE )
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.69.11.4 NAME 'fd
Inscrip
tionInvitationDN'
attributetype ( 1.3.6.1.4.1.38414.69.11.4 NAME 'fd
Registra
tionInvitationDN'
DESC 'FusionDirectory - DN of the invitation object used for this
inscrip
tion'
DESC 'FusionDirectory - DN of the invitation object used for this
registra
tion'
EQUALITY caseIgnoreMatch
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.69.11.5 NAME 'fd
Inscrip
tionUserDN'
attributetype ( 1.3.6.1.4.1.38414.69.11.5 NAME 'fd
Registra
tionUserDN'
DESC 'FusionDirectory - DN of the user object created by this
inscrip
tion'
DESC 'FusionDirectory - DN of the user object created by this
registra
tion'
EQUALITY caseIgnoreMatch
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
...
@@ -76,8 +76,8 @@ objectclass ( 1.3.6.1.4.1.38414.69.2.1 NAME 'fdInvitation'
...
@@ -76,8 +76,8 @@ objectclass ( 1.3.6.1.4.1.38414.69.2.1 NAME 'fdInvitation'
MUST ( cn )
MUST ( cn )
MAY ( fdInvitationEmailSubject $ fdInvitationEmailContent $ fdInvitationFormDN $ fdInvitationAuthor ) )
MAY ( fdInvitationEmailSubject $ fdInvitationEmailContent $ fdInvitationFormDN $ fdInvitationAuthor ) )
objectclass ( 1.3.6.1.4.1.38414.69.2.2 NAME 'fd
Inscrip
tion'
objectclass ( 1.3.6.1.4.1.38414.69.2.2 NAME 'fd
Registra
tion'
DESC 'FusionDirectory -
Inscrip
tion status and information'
DESC 'FusionDirectory -
Registra
tion status and information'
MUST ( fd
Inscrip
tionEmailAddress $ fd
Inscrip
tionState )
MUST ( fd
Registra
tionEmailAddress $ fd
Registra
tionState )
MAY ( fd
Inscrip
tionLastChange $
MAY ( fd
Registra
tionLastChange $
fd
Inscrip
tionInvitationDN $ fd
Inscrip
tionUserDN ) )
fd
Registra
tionInvitationDN $ fd
Registra
tionUserDN ) )
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