made Kolab optional
This commit is contained in:
parent
e9d18cd1bc
commit
6e48ecdb47
|
@ -3,7 +3,7 @@
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
|
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
|
||||||
Copyright (C) 2004 - 2006 Roland Gruber
|
Copyright (C) 2004 - 2008 Roland Gruber
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -43,6 +43,8 @@ class kolabUser extends baseModule {
|
||||||
* @param string $scope account type (user, group, host)
|
* @param string $scope account type (user, group, host)
|
||||||
*/
|
*/
|
||||||
function __construct($scope) {
|
function __construct($scope) {
|
||||||
|
// call parent constructor
|
||||||
|
parent::__construct($scope);
|
||||||
// list of invitation policies
|
// list of invitation policies
|
||||||
$this->invitationPolicies = array(
|
$this->invitationPolicies = array(
|
||||||
'ACT_ALWAYS_ACCEPT' => _('Always accept'),
|
'ACT_ALWAYS_ACCEPT' => _('Always accept'),
|
||||||
|
@ -51,8 +53,7 @@ class kolabUser extends baseModule {
|
||||||
'ACT_REJECT_IF_CONFLICTS' => _('Reject if conflicts'),
|
'ACT_REJECT_IF_CONFLICTS' => _('Reject if conflicts'),
|
||||||
'ACT_MANUAL_IF_CONFLICTS' => _('Manual if conflicts')
|
'ACT_MANUAL_IF_CONFLICTS' => _('Manual if conflicts')
|
||||||
);
|
);
|
||||||
// call parent constructor
|
$this->autoAddObjectClasses = false;
|
||||||
parent::__construct($scope);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -258,172 +259,160 @@ class kolabUser extends baseModule {
|
||||||
$this->messages['quota'][1] = array('ERROR', _('Account %s:') . ' kolabUser_quota', _('Mail quota must be a number!'));
|
$this->messages['quota'][1] = array('ERROR', _('Account %s:') . ' kolabUser_quota', _('Mail quota must be a number!'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a list of modifications which have to be made to the LDAP account.
|
|
||||||
*
|
|
||||||
* @return array list of modifications
|
|
||||||
* <br>This function returns an array with 3 entries:
|
|
||||||
* <br>array( DN1 ('add' => array($attr), 'remove' => array($attr), 'modify' => array($attr)), DN2 .... )
|
|
||||||
* <br>DN is the DN to change. It may be possible to change several DNs (e.g. create a new user and add him to some groups via attribute memberUid)
|
|
||||||
* <br>"add" are attributes which have to be added to LDAP entry
|
|
||||||
* <br>"remove" are attributes which have to be removed from LDAP entry
|
|
||||||
* <br>"modify" are attributes which have to been modified in LDAP entry
|
|
||||||
*/
|
|
||||||
function save_attributes() {
|
|
||||||
// add object class if needed
|
|
||||||
if (!isset($this->attributes['objectClass']) || !in_array('kolabInetOrgPerson', $this->attributes['objectClass'])) {
|
|
||||||
$this->attributes['objectClass'][] = 'kolabInetOrgPerson';
|
|
||||||
}
|
|
||||||
return parent::save_attributes();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the HTML meta data for the main account page.
|
* Returns the HTML meta data for the main account page.
|
||||||
*
|
*
|
||||||
* @return array HTML meta data
|
* @return array HTML meta data
|
||||||
*/
|
*/
|
||||||
function display_html_attributes() {
|
function display_html_attributes() {
|
||||||
$attrsI = $this->getAccountContainer()->getAccountModule('inetOrgPerson')->getAttributes();
|
|
||||||
if ($this->getAccountContainer()->isNewAccount) {
|
|
||||||
if ($this->getAccountContainer()->getAccountModule('posixAccount') != null) {
|
|
||||||
$attrsP = $this->getAccountContainer()->getAccountModule('posixAccount')->getAttributes();
|
|
||||||
if (!$attrsP['userPassword'][0]) {
|
|
||||||
StatusMessage('ERROR', _("Please enter a user password on this page: %s"), '', array($this->getAccountContainer()->getAccountModule('posixAccount')->get_alias()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif ($this->getAccountContainer()->getAccountModule('inetOrgPerson') != null) {
|
|
||||||
if (!$attrsI['userPassword'][0]) {
|
|
||||||
StatusMessage('ERROR', _("Please enter a user password on this page: %s"), '', array($this->getAccountContainer()->getAccountModule('inetOrgPerson')->get_alias()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$attrsI['mail'][0]) {
|
|
||||||
StatusMessage('ERROR', _("Please enter an email address on this page: %s"), '', array($this->getAccountContainer()->getAccountModule('inetOrgPerson')->get_alias()));
|
|
||||||
}
|
|
||||||
$return = array();
|
$return = array();
|
||||||
// check if account is marked for deletion
|
if (isset($this->attributes['objectClass']) && in_array('kolabInetOrgPerson', $this->attributes['objectClass'])) {
|
||||||
if (isset($this->attributes['kolabDeleteflag'])) {
|
$attrsI = $this->getAccountContainer()->getAccountModule('inetOrgPerson')->getAttributes();
|
||||||
$return[] = array(
|
if ($this->getAccountContainer()->isNewAccount) {
|
||||||
array('kind' => 'text', 'text' => _('This account is marked for deletion.')));
|
if ($this->getAccountContainer()->getAccountModule('posixAccount') != null) {
|
||||||
return $return;
|
$attrsP = $this->getAccountContainer()->getAccountModule('posixAccount')->getAttributes();
|
||||||
}
|
if (!isset($attrsP['userPassword'][0]) || ($attrsP['userPassword'][0] == '')) {
|
||||||
// country
|
StatusMessage('ERROR', _("Please enter a user password on this page: %s"), '', array($this->getAccountContainer()->getAccountModule('posixAccount')->get_alias()));
|
||||||
$return[] = array(
|
}
|
||||||
array('kind' => 'text', 'text' => _('Country')),
|
}
|
||||||
array('kind' => 'input', 'name' => 'country', 'type' => 'text', 'value' => $this->attributes['c'][0]),
|
elseif ($this->getAccountContainer()->getAccountModule('inetOrgPerson') != null) {
|
||||||
array('kind' => 'help', 'value' => 'country'));
|
if (!isset($attrsI['userPassword'][0]) || ($attrsI['userPassword'][0] == '')) {
|
||||||
// mailbox server
|
StatusMessage('ERROR', _("Please enter a user password on this page: %s"), '', array($this->getAccountContainer()->getAccountModule('inetOrgPerson')->get_alias()));
|
||||||
if (!isset($this->orig['kolabHomeServer'][0])) { // value currently not set
|
}
|
||||||
$return[] = array(
|
}
|
||||||
array('kind' => 'text', 'text' => _('Mailbox home server') . "*"),
|
|
||||||
array('kind' => 'input', 'name' => 'homeServer', 'type' => 'text', 'value' => $this->attributes['kolabHomeServer'][0]),
|
|
||||||
array('kind' => 'help', 'value' => 'homeServer'));
|
|
||||||
}
|
|
||||||
else { // input is unchangable when set
|
|
||||||
$return[] = array(
|
|
||||||
array('kind' => 'text', 'text' => _('Mailbox home server')),
|
|
||||||
array('kind' => 'text', 'text' => $this->orig['kolabHomeServer'][0]),
|
|
||||||
array('kind' => 'help', 'value' => 'homeServer'));
|
|
||||||
}
|
|
||||||
// Cyrus mail quota
|
|
||||||
$return[] = array(
|
|
||||||
array('kind' => 'text', 'text' => _('Mail quota')),
|
|
||||||
array('kind' => 'input', 'name' => 'quota', 'type' => 'text', 'value' => $this->attributes['cyrus-userquota'][0]),
|
|
||||||
array('kind' => 'help', 'value' => 'quota'));
|
|
||||||
// free/busy future
|
|
||||||
$return[] = array(
|
|
||||||
array('kind' => 'text', 'text' => _('Free/Busy interval')),
|
|
||||||
array('kind' => 'input', 'name' => 'freeBusy', 'type' => 'text', 'value' => $this->attributes['kolabFreeBusyFuture'][0]),
|
|
||||||
array('kind' => 'help', 'value' => 'freeBusy'));
|
|
||||||
// invitation policies
|
|
||||||
$returnPol = array();
|
|
||||||
// default invitation policy
|
|
||||||
$defaultInvPol = $this->invitationPolicies['ACT_MANUAL'];
|
|
||||||
for ($i = 0; $i < sizeof($this->attributes['kolabInvitationPolicy']); $i++) {
|
|
||||||
$parts = split(":", $this->attributes['kolabInvitationPolicy'][$i]);
|
|
||||||
if (sizeof($parts) == 1) {
|
|
||||||
$defaultInvPol = $this->invitationPolicies[$this->attributes['kolabInvitationPolicy'][$i]];
|
|
||||||
unset($this->attributes['kolabInvitationPolicy'][$i]);
|
|
||||||
$this->attributes['kolabInvitationPolicy'] = array_values($this->attributes['kolabInvitationPolicy']);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
if (!$attrsI['mail'][0]) {
|
||||||
$returnPol[] = array(
|
StatusMessage('ERROR', _("Please enter an email address on this page: %s"), '', array($this->getAccountContainer()->getAccountModule('inetOrgPerson')->get_alias()));
|
||||||
array('kind' => 'text', 'text' => _('Anyone')),
|
|
||||||
array('kind' => 'select', 'name' => 'defaultInvPol', 'options' => array_values($this->invitationPolicies), 'options_selected' => $defaultInvPol),
|
|
||||||
array('kind' => 'help', 'value' => 'invPol'));
|
|
||||||
// other invitation policies
|
|
||||||
for ($i = 0; $i < sizeof($this->attributes['kolabInvitationPolicy']); $i++) {
|
|
||||||
$parts = split(":", $this->attributes['kolabInvitationPolicy'][$i]);
|
|
||||||
if (sizeof($parts) == 2) {
|
|
||||||
$returnPol[] = array(
|
|
||||||
array('kind' => 'input', 'name' => 'invPol1' . $i, 'type' => 'text', 'value' => $parts[0]),
|
|
||||||
array('kind' => 'select', 'name' => 'invPol2' . $i, 'options' => array_values($this->invitationPolicies), 'options_selected' => $this->invitationPolicies[$parts[1]]),
|
|
||||||
array('kind' => 'input', 'type' => 'submit', 'name' => 'delInvPol' . $i, 'value' => _("Remove")),
|
|
||||||
array('kind' => 'help', 'value' => 'invPol'));
|
|
||||||
}
|
}
|
||||||
}
|
// check if account is marked for deletion
|
||||||
// input box for new invitation policy
|
if (isset($this->attributes['kolabDeleteflag'])) {
|
||||||
$returnPol[] = array(
|
$return[] = array(
|
||||||
array('kind' => 'input', 'name' => 'invPol1', 'type' => 'text', 'value' => ''),
|
array('kind' => 'text', 'text' => _('This account is marked for deletion.')));
|
||||||
array('kind' => 'select', 'name' => 'invPol2', 'options' => array_values($this->invitationPolicies)),
|
return $return;
|
||||||
array('kind' => 'input', 'type' => 'submit', 'name' => 'addInvPol', 'value' => _("Add")),
|
}
|
||||||
array('kind' => 'help', 'value' => 'invPol'));
|
// country
|
||||||
$returnPol = array(
|
$return[] = array(
|
||||||
array('kind' => 'fieldset', 'legend' => _('Invitation policy'), 'value' => $returnPol, 'td' => array('colspan' => 3))
|
array('kind' => 'text', 'text' => _('Country')),
|
||||||
);
|
array('kind' => 'input', 'name' => 'country', 'type' => 'text', 'value' => $this->attributes['c'][0]),
|
||||||
$return[] = $returnPol;
|
array('kind' => 'help', 'value' => 'country'));
|
||||||
// mail aliases
|
// mailbox server
|
||||||
$returnAliases = array();
|
if (!isset($this->orig['kolabHomeServer'][0])) { // value currently not set
|
||||||
for ($i = 0; $i < sizeof($this->attributes['alias']); $i++) {
|
$return[] = array(
|
||||||
|
array('kind' => 'text', 'text' => _('Mailbox home server') . "*"),
|
||||||
|
array('kind' => 'input', 'name' => 'homeServer', 'type' => 'text', 'value' => $this->attributes['kolabHomeServer'][0]),
|
||||||
|
array('kind' => 'help', 'value' => 'homeServer'));
|
||||||
|
}
|
||||||
|
else { // input is unchangable when set
|
||||||
|
$return[] = array(
|
||||||
|
array('kind' => 'text', 'text' => _('Mailbox home server')),
|
||||||
|
array('kind' => 'text', 'text' => $this->orig['kolabHomeServer'][0]),
|
||||||
|
array('kind' => 'help', 'value' => 'homeServer'));
|
||||||
|
}
|
||||||
|
// Cyrus mail quota
|
||||||
|
$return[] = array(
|
||||||
|
array('kind' => 'text', 'text' => _('Mail quota')),
|
||||||
|
array('kind' => 'input', 'name' => 'quota', 'type' => 'text', 'value' => $this->attributes['cyrus-userquota'][0]),
|
||||||
|
array('kind' => 'help', 'value' => 'quota'));
|
||||||
|
// free/busy future
|
||||||
|
$return[] = array(
|
||||||
|
array('kind' => 'text', 'text' => _('Free/Busy interval')),
|
||||||
|
array('kind' => 'input', 'name' => 'freeBusy', 'type' => 'text', 'value' => $this->attributes['kolabFreeBusyFuture'][0]),
|
||||||
|
array('kind' => 'help', 'value' => 'freeBusy'));
|
||||||
|
// invitation policies
|
||||||
|
$returnPol = array();
|
||||||
|
// default invitation policy
|
||||||
|
$defaultInvPol = $this->invitationPolicies['ACT_MANUAL'];
|
||||||
|
for ($i = 0; $i < sizeof($this->attributes['kolabInvitationPolicy']); $i++) {
|
||||||
|
$parts = split(":", $this->attributes['kolabInvitationPolicy'][$i]);
|
||||||
|
if (sizeof($parts) == 1) {
|
||||||
|
$defaultInvPol = $this->invitationPolicies[$this->attributes['kolabInvitationPolicy'][$i]];
|
||||||
|
unset($this->attributes['kolabInvitationPolicy'][$i]);
|
||||||
|
$this->attributes['kolabInvitationPolicy'] = array_values($this->attributes['kolabInvitationPolicy']);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$returnPol[] = array(
|
||||||
|
array('kind' => 'text', 'text' => _('Anyone')),
|
||||||
|
array('kind' => 'select', 'name' => 'defaultInvPol', 'options' => array_values($this->invitationPolicies), 'options_selected' => $defaultInvPol),
|
||||||
|
array('kind' => 'help', 'value' => 'invPol'));
|
||||||
|
// other invitation policies
|
||||||
|
for ($i = 0; $i < sizeof($this->attributes['kolabInvitationPolicy']); $i++) {
|
||||||
|
$parts = split(":", $this->attributes['kolabInvitationPolicy'][$i]);
|
||||||
|
if (sizeof($parts) == 2) {
|
||||||
|
$returnPol[] = array(
|
||||||
|
array('kind' => 'input', 'name' => 'invPol1' . $i, 'type' => 'text', 'value' => $parts[0]),
|
||||||
|
array('kind' => 'select', 'name' => 'invPol2' . $i, 'options' => array_values($this->invitationPolicies), 'options_selected' => $this->invitationPolicies[$parts[1]]),
|
||||||
|
array('kind' => 'input', 'type' => 'submit', 'name' => 'delInvPol' . $i, 'value' => _("Remove")),
|
||||||
|
array('kind' => 'help', 'value' => 'invPol'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// input box for new invitation policy
|
||||||
|
$returnPol[] = array(
|
||||||
|
array('kind' => 'input', 'name' => 'invPol1', 'type' => 'text', 'value' => ''),
|
||||||
|
array('kind' => 'select', 'name' => 'invPol2', 'options' => array_values($this->invitationPolicies)),
|
||||||
|
array('kind' => 'input', 'type' => 'submit', 'name' => 'addInvPol', 'value' => _("Add")),
|
||||||
|
array('kind' => 'help', 'value' => 'invPol'));
|
||||||
|
$returnPol = array(
|
||||||
|
array('kind' => 'fieldset', 'legend' => _('Invitation policy'), 'value' => $returnPol, 'td' => array('colspan' => 3))
|
||||||
|
);
|
||||||
|
$return[] = $returnPol;
|
||||||
|
// mail aliases
|
||||||
|
$returnAliases = array();
|
||||||
|
for ($i = 0; $i < sizeof($this->attributes['alias']); $i++) {
|
||||||
|
$returnAliases[] = array(
|
||||||
|
array('kind' => 'input', 'name' => 'alias' . $i, 'type' => 'text', 'value' => $this->attributes['alias'][$i]),
|
||||||
|
array('kind' => 'input', 'type' => 'submit', 'name' => 'delAlias' . $i, 'value' => _("Remove")),
|
||||||
|
array('kind' => 'help', 'value' => 'alias'));
|
||||||
|
}
|
||||||
|
// input box for new mail alias
|
||||||
$returnAliases[] = array(
|
$returnAliases[] = array(
|
||||||
array('kind' => 'input', 'name' => 'alias' . $i, 'type' => 'text', 'value' => $this->attributes['alias'][$i]),
|
array('kind' => 'input', 'name' => 'alias', 'type' => 'text', 'value' => ''),
|
||||||
array('kind' => 'input', 'type' => 'submit', 'name' => 'delAlias' . $i, 'value' => _("Remove")),
|
array('kind' => 'input', 'type' => 'submit', 'name' => 'addAlias', 'value' => _("Add")),
|
||||||
array('kind' => 'help', 'value' => 'alias'));
|
array('kind' => 'help', 'value' => 'alias'));
|
||||||
}
|
$returnAliases = array(
|
||||||
// input box for new mail alias
|
array('kind' => 'fieldset', 'legend' => _('EMail aliases'), 'value' => $returnAliases, 'td' => array('colspan' => 3))
|
||||||
$returnAliases[] = array(
|
);
|
||||||
array('kind' => 'input', 'name' => 'alias', 'type' => 'text', 'value' => ''),
|
$return[] = $returnAliases;
|
||||||
array('kind' => 'input', 'type' => 'submit', 'name' => 'addAlias', 'value' => _("Add")),
|
// delegates
|
||||||
array('kind' => 'help', 'value' => 'alias'));
|
$delegates = array();
|
||||||
$returnAliases = array(
|
$delegatesTemp = $_SESSION['cache']->get_cache('mail', 'inetOrgPerson', 'user');
|
||||||
array('kind' => 'fieldset', 'legend' => _('EMail aliases'), 'value' => $returnAliases, 'td' => array('colspan' => 3))
|
if (is_array($delegatesTemp)) {
|
||||||
);
|
$DNs = array_keys($delegatesTemp);
|
||||||
$return[] = $returnAliases;
|
foreach ($DNs as $DN) {
|
||||||
// delegates
|
$delegates[] = $delegatesTemp[$DN][0];
|
||||||
$delegates = array();
|
}
|
||||||
$delegatesTemp = $_SESSION['cache']->get_cache('mail', 'inetOrgPerson', 'user');
|
sort($delegates);
|
||||||
if (is_array($delegatesTemp)) {
|
|
||||||
$DNs = array_keys($delegatesTemp);
|
|
||||||
foreach ($DNs as $DN) {
|
|
||||||
$delegates[] = $delegatesTemp[$DN][0];
|
|
||||||
}
|
}
|
||||||
sort($delegates);
|
$returnDelegates = array();
|
||||||
}
|
for ($i = 0; $i < sizeof($this->attributes['kolabDelegate']); $i++) {
|
||||||
$returnDelegates = array();
|
$returnDelegates[] = array(
|
||||||
for ($i = 0; $i < sizeof($this->attributes['kolabDelegate']); $i++) {
|
array('kind' => 'select', 'name' => 'delegate' . $i, 'options' => $delegates, 'options_selected' => array($this->attributes['kolabDelegate'][$i])),
|
||||||
|
array('kind' => 'input', 'type' => 'submit', 'name' => 'delDelegate' . $i, 'value' => _("Remove")),
|
||||||
|
array('kind' => 'help', 'value' => 'delegate'));
|
||||||
|
}
|
||||||
|
// input box for new delegate
|
||||||
$returnDelegates[] = array(
|
$returnDelegates[] = array(
|
||||||
array('kind' => 'select', 'name' => 'delegate' . $i, 'options' => $delegates, 'options_selected' => array($this->attributes['kolabDelegate'][$i])),
|
array('kind' => 'select', 'name' => 'delegate', 'options' => $delegates),
|
||||||
array('kind' => 'input', 'type' => 'submit', 'name' => 'delDelegate' . $i, 'value' => _("Remove")),
|
array('kind' => 'input', 'type' => 'submit', 'name' => 'addDelegate', 'value' => _("Add")),
|
||||||
array('kind' => 'help', 'value' => 'delegate'));
|
array('kind' => 'help', 'value' => 'delegate'));
|
||||||
|
$returnDelegates = array(
|
||||||
|
array('kind' => 'fieldset', 'legend' => _('Delegates'), 'value' => $returnDelegates, 'td' => array('colspan' => 3))
|
||||||
|
);
|
||||||
|
$return[] = $returnDelegates;
|
||||||
|
// delete flag
|
||||||
|
if (!$this->getAccountContainer()->isNewAccount) {
|
||||||
|
$returnDelete = array(
|
||||||
|
array('kind' => 'input', 'type' => 'submit', 'value' => _('Mark account for deletion'), 'name' => 'form_subpage_kolabUser_deleteUser_open'),
|
||||||
|
array('kind' => 'help', 'value' => 'deleteFlag'));
|
||||||
|
$return[] = array(
|
||||||
|
array('kind' => 'fieldset', 'legend' => _('Delete Kolab account'), 'value' => array($returnDelete), 'td' => array('colspan' => 3))
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// input box for new delegate
|
else {
|
||||||
$returnDelegates[] = array(
|
|
||||||
array('kind' => 'select', 'name' => 'delegate', 'options' => $delegates),
|
|
||||||
array('kind' => 'input', 'type' => 'submit', 'name' => 'addDelegate', 'value' => _("Add")),
|
|
||||||
array('kind' => 'help', 'value' => 'delegate'));
|
|
||||||
$returnDelegates = array(
|
|
||||||
array('kind' => 'fieldset', 'legend' => _('Delegates'), 'value' => $returnDelegates, 'td' => array('colspan' => 3))
|
|
||||||
);
|
|
||||||
$return[] = $returnDelegates;
|
|
||||||
// delete flag
|
|
||||||
if (!$this->getAccountContainer()->isNewAccount) {
|
|
||||||
$returnDelete = array(
|
|
||||||
0 => array('kind' => 'input', 'type' => 'submit', 'value' => _('Mark account for deletion'), 'name' => 'form_subpage_kolabUser_deleteUser_open'),
|
|
||||||
1 => array('kind' => 'help', 'value' => 'deleteFlag'));
|
|
||||||
$return[] = array(
|
$return[] = array(
|
||||||
array('kind' => 'fieldset', 'legend' => _('Delete Kolab account'), 'value' => array($returnDelete), 'td' => array('colspan' => 3))
|
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_kolabUser_attributes_addObjectClass', 'value' => _('Add Kolab extension'))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
@ -436,140 +425,145 @@ class kolabUser extends baseModule {
|
||||||
*/
|
*/
|
||||||
function process_attributes() {
|
function process_attributes() {
|
||||||
$errors = array();
|
$errors = array();
|
||||||
if ($_POST['form_subpage_kolabUser_deleteUser_open']) return array();
|
if (isset($_POST['form_subpage_kolabUser_attributes_addObjectClass'])) {
|
||||||
$this->attributes['kolabInvitationPolicy'] = array();
|
$this->attributes['objectClass'][] = 'kolabInetOrgPerson';
|
||||||
// country
|
|
||||||
if (isset($_POST['country'])) {
|
|
||||||
if (($_POST['country'] == "") || get_preg($_POST['country'], 'country')) {
|
|
||||||
$this->attributes['c'][0] = $_POST['country'];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$message = $this->messages['country'][0];
|
|
||||||
$message[] = $_POST['country'];
|
|
||||||
$errors[] = $message;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// mailbox server
|
else {
|
||||||
if (isset($_POST['homeServer'])) {
|
if ($_POST['form_subpage_kolabUser_deleteUser_open']) return array();
|
||||||
if ($_POST['homeServer'] == "") {
|
$this->attributes['kolabInvitationPolicy'] = array();
|
||||||
$errors[] = $this->messages['homeServer'][2];
|
// country
|
||||||
|
if (isset($_POST['country'])) {
|
||||||
|
if (($_POST['country'] == "") || get_preg($_POST['country'], 'country')) {
|
||||||
|
$this->attributes['c'][0] = $_POST['country'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$message = $this->messages['country'][0];
|
||||||
|
$message[] = $_POST['country'];
|
||||||
|
$errors[] = $message;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elseif (get_preg($_POST['homeServer'], 'DNSname')) {
|
// mailbox server
|
||||||
$this->attributes['kolabHomeServer'][0] = $_POST['homeServer'];
|
if (isset($_POST['homeServer'])) {
|
||||||
|
if ($_POST['homeServer'] == "") {
|
||||||
|
$errors[] = $this->messages['homeServer'][2];
|
||||||
|
}
|
||||||
|
elseif (get_preg($_POST['homeServer'], 'DNSname')) {
|
||||||
|
$this->attributes['kolabHomeServer'][0] = $_POST['homeServer'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$message = $this->messages['homeServer'][0];
|
||||||
|
$message[] = $_POST['homeServer'];
|
||||||
|
$errors[] = $message;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
// check old invitation policies
|
||||||
$message = $this->messages['homeServer'][0];
|
$policies = array_flip($this->invitationPolicies);
|
||||||
$message[] = $_POST['homeServer'];
|
$targets = array();
|
||||||
$errors[] = $message;
|
$i = 0;
|
||||||
}
|
while (isset($_POST['invPol1' . $i])) {
|
||||||
}
|
if (isset($_POST['delInvPol' . $i])) {
|
||||||
// check old invitation policies
|
$i++;
|
||||||
$policies = array_flip($this->invitationPolicies);
|
continue;
|
||||||
$targets = array();
|
}
|
||||||
$i = 0;
|
if (isset($_POST['invPol2' . $i]) && ($_POST['invPol1' . $i] != "") && !in_array($_POST['invPol1' . $i], $targets)) {
|
||||||
while (isset($_POST['invPol1' . $i])) {
|
$targets[] = $_POST['invPol1' . $i];
|
||||||
if (isset($_POST['delInvPol' . $i])) {
|
// check invitation policy
|
||||||
|
if (!get_preg($_POST['invPol1' . $i], 'email')) {
|
||||||
|
$message = $this->messages['invPol'][0];
|
||||||
|
$message[] = $_POST['invPol1' . $i];
|
||||||
|
$errors[] = $message;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->attributes['kolabInvitationPolicy'][] = $_POST['invPol1' . $i] . ':' . $policies[$_POST['invPol2' . $i]];
|
||||||
|
}
|
||||||
|
}
|
||||||
$i++;
|
$i++;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if (isset($_POST['invPol2' . $i]) && ($_POST['invPol1' . $i] != "") && !in_array($_POST['invPol1' . $i], $targets)) {
|
// check new invitation policy
|
||||||
$targets[] = $_POST['invPol1' . $i];
|
if (isset($_POST['invPol1']) && ($_POST['invPol1'] != "") && !in_array($_POST['invPol1'], $targets)) {
|
||||||
// check invitation policy
|
// check new invitation policy
|
||||||
if (!get_preg($_POST['invPol1' . $i], 'email')) {
|
if (!get_preg($_POST['invPol1'], 'email')) {
|
||||||
$message = $this->messages['invPol'][0];
|
$message = $this->messages['invPol'][0];
|
||||||
$message[] = $_POST['invPol1' . $i];
|
$message[] = $_POST['invPol1'];
|
||||||
$errors[] = $message;
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->attributes['kolabInvitationPolicy'][] = $_POST['invPol1' . $i] . ':' . $policies[$_POST['invPol2' . $i]];
|
$this->attributes['kolabInvitationPolicy'][] = $_POST['invPol1'] . ':' . $policies[$_POST['invPol2']];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$i++;
|
// default invitation policy
|
||||||
}
|
if (isset($_POST['defaultInvPol']) && ($_POST['defaultInvPol'] != "")) {
|
||||||
// check new invitation policy
|
$this->attributes['kolabInvitationPolicy'][] = $policies[$_POST['defaultInvPol']];
|
||||||
if (isset($_POST['invPol1']) && ($_POST['invPol1'] != "") && !in_array($_POST['invPol1'], $targets)) {
|
|
||||||
// check new invitation policy
|
|
||||||
if (!get_preg($_POST['invPol1'], 'email')) {
|
|
||||||
$message = $this->messages['invPol'][0];
|
|
||||||
$message[] = $_POST['invPol1'];
|
|
||||||
$errors[] = $message;
|
|
||||||
}
|
}
|
||||||
else {
|
// check old mail aliases
|
||||||
$this->attributes['kolabInvitationPolicy'][] = $_POST['invPol1'] . ':' . $policies[$_POST['invPol2']];
|
$this->attributes['alias'] = array();
|
||||||
}
|
$i = 0;
|
||||||
}
|
while (isset($_POST['alias' . $i])) {
|
||||||
// default invitation policy
|
if (isset($_POST['delAlias' . $i])) {
|
||||||
if (isset($_POST['defaultInvPol']) && ($_POST['defaultInvPol'] != "")) {
|
$i++;
|
||||||
$this->attributes['kolabInvitationPolicy'][] = $policies[$_POST['defaultInvPol']];
|
continue;
|
||||||
}
|
}
|
||||||
// check old mail aliases
|
if (isset($_POST['alias' . $i]) && ($_POST['alias' . $i] != "") && !in_array($_POST['alias' . $i], $this->attributes['alias'])) {
|
||||||
$this->attributes['alias'] = array();
|
// check mail alias
|
||||||
$i = 0;
|
if (!get_preg($_POST['alias' . $i], 'email')) {
|
||||||
while (isset($_POST['alias' . $i])) {
|
$message = $this->messages['alias'][0];
|
||||||
if (isset($_POST['delAlias' . $i])) {
|
$message[] = $_POST['alias' . $i];
|
||||||
|
$errors[] = $message;
|
||||||
|
}
|
||||||
|
$this->attributes['alias'][] = $_POST['alias' . $i];
|
||||||
|
}
|
||||||
$i++;
|
$i++;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if (isset($_POST['alias' . $i]) && ($_POST['alias' . $i] != "") && !in_array($_POST['alias' . $i], $this->attributes['alias'])) {
|
// check new mail alias
|
||||||
// check mail alias
|
if (isset($_POST['alias']) && ($_POST['alias'] != "")) {
|
||||||
if (!get_preg($_POST['alias' . $i], 'email')) {
|
// check new mail alias
|
||||||
|
if (!get_preg($_POST['alias'], 'email')) {
|
||||||
$message = $this->messages['alias'][0];
|
$message = $this->messages['alias'][0];
|
||||||
$message[] = $_POST['alias' . $i];
|
$message[] = $_POST['alias'];
|
||||||
$errors[] = $message;
|
$errors[] = $message;
|
||||||
}
|
}
|
||||||
$this->attributes['alias'][] = $_POST['alias' . $i];
|
else {
|
||||||
|
$this->attributes['alias'][] = $_POST['alias'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$i++;
|
$this->attributes['alias'] = array_unique($this->attributes['alias']);
|
||||||
}
|
// check old delegates
|
||||||
// check new mail alias
|
$this->attributes['kolabDelegate'] = array();
|
||||||
if (isset($_POST['alias']) && ($_POST['alias'] != "")) {
|
$i = 0;
|
||||||
// check new mail alias
|
while (isset($_POST['delegate' . $i])) {
|
||||||
if (!get_preg($_POST['alias'], 'email')) {
|
if (isset($_POST['delDelegate' . $i])) {
|
||||||
$message = $this->messages['alias'][0];
|
$i++;
|
||||||
$message[] = $_POST['alias'];
|
continue;
|
||||||
$errors[] = $message;
|
}
|
||||||
}
|
$this->attributes['kolabDelegate'][] = $_POST['delegate' . $i];
|
||||||
else {
|
|
||||||
$this->attributes['alias'][] = $_POST['alias'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->attributes['alias'] = array_unique($this->attributes['alias']);
|
|
||||||
// check old delegates
|
|
||||||
$this->attributes['kolabDelegate'] = array();
|
|
||||||
$i = 0;
|
|
||||||
while (isset($_POST['delegate' . $i])) {
|
|
||||||
if (isset($_POST['delDelegate' . $i])) {
|
|
||||||
$i++;
|
$i++;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
$this->attributes['kolabDelegate'][] = $_POST['delegate' . $i];
|
// check new delegate
|
||||||
$i++;
|
if (isset($_POST['addDelegate']) && ($_POST['delegate'] != "")) {
|
||||||
}
|
$this->attributes['kolabDelegate'][] = $_POST['delegate'];
|
||||||
// check new delegate
|
|
||||||
if (isset($_POST['addDelegate']) && ($_POST['delegate'] != "")) {
|
|
||||||
$this->attributes['kolabDelegate'][] = $_POST['delegate'];
|
|
||||||
}
|
|
||||||
$this->attributes['kolabDelegate'] = array_unique($this->attributes['kolabDelegate']);
|
|
||||||
// free/busy future
|
|
||||||
if (isset($_POST['freeBusy'])) {
|
|
||||||
if (($_POST['freeBusy'] == "") || get_preg($_POST['freeBusy'], 'digit')) {
|
|
||||||
$this->attributes['kolabFreeBusyFuture'][0] = $_POST['freeBusy'];
|
|
||||||
}
|
}
|
||||||
else {
|
$this->attributes['kolabDelegate'] = array_unique($this->attributes['kolabDelegate']);
|
||||||
$message = $this->messages['freeBusy'][0];
|
// free/busy future
|
||||||
$message[] = $_POST['freeBusy'];
|
if (isset($_POST['freeBusy'])) {
|
||||||
$errors[] = $message;
|
if (($_POST['freeBusy'] == "") || get_preg($_POST['freeBusy'], 'digit')) {
|
||||||
|
$this->attributes['kolabFreeBusyFuture'][0] = $_POST['freeBusy'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$message = $this->messages['freeBusy'][0];
|
||||||
|
$message[] = $_POST['freeBusy'];
|
||||||
|
$errors[] = $message;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
// Cyrus mail quota
|
||||||
// Cyrus mail quota
|
if (isset($_POST['quota'])) {
|
||||||
if (isset($_POST['quota'])) {
|
if (($_POST['quota'] == "") || get_preg($_POST['quota'], 'digit')) {
|
||||||
if (($_POST['quota'] == "") || get_preg($_POST['quota'], 'digit')) {
|
$this->attributes['cyrus-userquota'][0] = $_POST['quota'];
|
||||||
$this->attributes['cyrus-userquota'][0] = $_POST['quota'];
|
}
|
||||||
}
|
else {
|
||||||
else {
|
$message = $this->messages['quota'][0];
|
||||||
$message = $this->messages['quota'][0];
|
$message[] = $_POST['quota'];
|
||||||
$message[] = $_POST['quota'];
|
$errors[] = $message;
|
||||||
$errors[] = $message;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $errors;
|
return $errors;
|
||||||
|
@ -581,12 +575,12 @@ class kolabUser extends baseModule {
|
||||||
function display_html_deleteUser() {
|
function display_html_deleteUser() {
|
||||||
$return = array();
|
$return = array();
|
||||||
$return[] = array(
|
$return[] = array(
|
||||||
0 => array('kind' => 'text', 'text' => _('Do you really want to mark this account for deletion?'), 'td' => array('colspan' => 2)));
|
array('kind' => 'text', 'text' => _('Do you really want to mark this account for deletion?'), 'td' => array('colspan' => 2)));
|
||||||
$return[] = array(
|
$return[] = array(
|
||||||
0 => array('kind' => 'text', 'text' => ' ', 'td' => array('colspan' => 2)));
|
array('kind' => 'text', 'text' => ' ', 'td' => array('colspan' => 2)));
|
||||||
$return[] = array(
|
$return[] = array(
|
||||||
0 => array('kind' => 'input', 'type' => 'submit', 'value' => _('Mark account for deletion'), 'name' => 'form_subpage_kolabUser_attributes_confirm'),
|
array('kind' => 'input', 'type' => 'submit', 'value' => _('Mark account for deletion'), 'name' => 'form_subpage_kolabUser_attributes_confirm'),
|
||||||
1 => array('kind' => 'input', 'type' => 'submit', 'value' => _('Cancel'), 'name' => 'form_subpage_kolabUser_attributes_cancel'));
|
array('kind' => 'input', 'type' => 'submit', 'value' => _('Cancel'), 'name' => 'form_subpage_kolabUser_attributes_cancel'));
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -606,15 +600,17 @@ class kolabUser extends baseModule {
|
||||||
* @return true, if account can be saved
|
* @return true, if account can be saved
|
||||||
*/
|
*/
|
||||||
function module_complete() {
|
function module_complete() {
|
||||||
$attrsI = $this->getAccountContainer()->getAccountModule('inetOrgPerson')->getAttributes();
|
if (isset($this->attributes['objectClass']) && in_array('kolabInetOrgPerson', $this->attributes['objectClass'])) {
|
||||||
$attrsP = $this->getAccountContainer()->getAccountModule('posixAccount')->getAttributes();
|
$attrsI = $this->getAccountContainer()->getAccountModule('inetOrgPerson')->getAttributes();
|
||||||
if (!$attrsI['mail'][0]) return false;
|
$attrsP = $this->getAccountContainer()->getAccountModule('posixAccount')->getAttributes();
|
||||||
if ($this->getAccountContainer()->isNewAccount) {
|
if (!$attrsI['mail'][0]) return false;
|
||||||
if ($this->getAccountContainer()->getAccountModule('posixAccount') != null) {
|
if ($this->getAccountContainer()->isNewAccount) {
|
||||||
if (!$attrsP['userPassword'][0]) return false;
|
if ($this->getAccountContainer()->getAccountModule('posixAccount') != null) {
|
||||||
}
|
if (!$attrsP['userPassword'][0]) return false;
|
||||||
elseif ($this->getAccountContainer()->getAccountModule('inetOrgPerson') != null) {
|
}
|
||||||
if (!$attrsI['userPassword'][0]) return false;
|
elseif ($this->getAccountContainer()->getAccountModule('inetOrgPerson') != null) {
|
||||||
|
if (!$attrsI['userPassword'][0]) return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue