Verified Commit 26a7fd85 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:sparkles: feat(invitations) Create the invitations plugins

issue #5850
Showing with 299 additions and 0 deletions
+299 -0
<?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 invitation extends simplePlugin
{
public static function plInfo()
{
return array(
'plShortName' => _('Invitation'),
'plDescription' => _('Invitation to fill a public form'),
'plIcon' => '',
'plObjectClass' => array('fdInvitation'),
'plObjectType' => array('invitation' => array(
'name' => _('Invitation'),
'ou' => get_ou('invitationRDN'),
'icon' => '',
)),
'plForeignKeys' => array(
'fdInvitationFormDN' => 'publicForm',
),
'plProvidedAcls' => parent::generatePlProvidedAcls(static::getAttributesInfo())
);
}
static function getAttributesInfo ()
{
global $ui;
return array(
'main' => array(
'name' => _('Invitation'),
'attrs' => array(
new BaseSelectorAttribute(get_ou('invitationRDN')),
new HostNameAttribute(
_('Name'), _('Name used to identify this invitation'),
'cn', TRUE
),
new StringAttribute(
_('Email subject'), _('Subject of the email sent for this invitation'),
'fdInvitationEmailSubject', TRUE
),
new TextAreaAttribute(
_('Email content'), _('Content of the email sent for this invitation'),
'fdInvitationEmailContent', TRUE
),
new SelectAttribute(
_('Form'), _('Public form this invitation should link to'),
'fdInvitationFormDN', TRUE
),
new DisplayLDAPAttribute(
_('Author'), _('Author of this invitation'),
'fdInvitationAuthor', FALSE,
$ui->dn
),
)
),
);
}
function __construct ($dn = NULL, $object = NULL, $parent = NULL, $mainTab = FALSE, $attributesInfo = NULL)
{
if ($attributesInfo === NULL) {
$attributesInfo = $this->getAttributesInfo();
}
$choices = objects::ls('publicForm');
$attributesInfo['main']['attrs'][4]->setChoices(array_keys($choices), array_values($choices));
parent::__construct($dn, $object, $parent, $mainTab, $attributesInfo);
}
}
?>
<?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 invitationManagement extends management
{
public static function plInfo()
{
return array(
'plShortName' => _('Invitations'),
'plTitle' => _('Invitations management'),
'plDescription' => _('Manage invitations'),
'plIcon' => '',
'plSection' => 'accounts',
'plManages' => array('invitation'),
'plProvidedAcls' => array()
);
}
}
<?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.
*/
management::mainInc('invitationManagement');
?>
<?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 invitationsConfig extends simplePlugin
{
static function plInfo()
{
return array(
'plShortName' => _('Invitations configuration'),
'plDescription' => _('FusionDirectory invitations plugin configuration'),
'plObjectClass' => array('fdInvitationsPluginConf'),
'plCategory' => array('configuration'),
'plObjectType' => array('smallConfig'),
'plProvidedAcls' => parent::generatePlProvidedAcls(static::getAttributesInfo())
);
}
static function getAttributesInfo ()
{
return array(
'main' => array(
'name' => _('Invitations'),
'attrs' => array(
new StringAttribute (
_('Invitations RDN'), _('Branch in which invitations will be stored'),
'fdInvitationRDN', TRUE,
'ou=invitations'
),
)
),
);
}
}
?>
##
## invitations-fd-conf.schema - Needed by FusionDirectory for managing invitations configuration
##
# Attributes
attributetype ( 1.3.6.1.4.1.38414.70.1.1 NAME 'fdInvitationRDN'
DESC 'FusionDirectory - Invitations RDN'
EQUALITY caseExactIA5Match
SUBSTR caseExactIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE)
# Object Class
objectclass ( 1.3.6.1.4.1.38414.70.2.1 NAME 'fdInvitationsPluginConf'
DESC 'FusionDirectory - Invitations plugin configuration'
SUP top AUXILIARY
MUST ( cn )
MAY ( fdInvitationRDN ) )
##
## invitations-fd.schema - Needed by FusionDirectory for invitations plugin
##
## Maintained by the FusionDirectory Project <contact@fusiondirectory.org>
##
# Attributes
attributetype ( 1.3.6.1.4.1.38414.69.10.1 NAME 'fdInvitationEmailSubject'
DESC 'FusionDirectory - Subject of the email sent for invitation'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255}
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.69.10.2 NAME 'fdInvitationEmailContent'
DESC 'FusionDirectory - Content of the email sent for invitation'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.69.10.3 NAME 'fdInvitationFormDN'
DESC 'FusionDirectory - DN of the form used by this invitation'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.69.10.4 NAME 'fdInvitationAuthor'
DESC 'FusionDirectory - DN of the author of this invitation'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.69.11.1 NAME 'fdInscriptionEmailAddress'
DESC 'FusionDirectory - Email address to which the invitation was sent to'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.69.11.2 NAME 'fdInscriptionState'
DESC 'FusionDirectory - State of this inscription'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.69.11.3 NAME 'fdInscriptionLastChange'
DESC 'FusionDirectory - Date and author of the last state change'
EQUALITY caseIgnoreIA5Match
SUBSTR caseIgnoreIA5SubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256}
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.69.11.4 NAME 'fdInscriptionInvitationDN'
DESC 'FusionDirectory - DN of the invitation object used for this inscription'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
attributetype ( 1.3.6.1.4.1.38414.69.11.5 NAME 'fdInscriptionUserDN'
DESC 'FusionDirectory - DN of the user object created by this inscription'
EQUALITY caseIgnoreMatch
SUBSTR caseIgnoreSubstringsMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
SINGLE-VALUE )
# Objectclasses
objectclass ( 1.3.6.1.4.1.38414.69.2.1 NAME 'fdInvitation'
DESC 'FusionDirectory - Invitation'
MUST ( cn )
MAY ( fdInvitationEmailSubject $ fdInvitationEmailContent $ fdInvitationFormDN $ fdInvitationAuthor ) )
objectclass ( 1.3.6.1.4.1.38414.69.2.2 NAME 'fdInscription'
DESC 'FusionDirectory - Inscription status and information'
MUST ( fdInscriptionEmailAddress $ fdInscriptionState )
MAY ( fdInscriptionLastChange $
fdInscriptionInvitationDN $ fdInscriptionUserDN ) )
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment