summaryrefslogtreecommitdiff
path: root/www/admin/user/user.php.in
diff options
context:
space:
mode:
authorSteffen Hansen <steffen@kdab.com>2006-12-08 22:02:35 (GMT)
committerSteffen Hansen <steffen@kdab.com>2006-12-08 22:02:35 (GMT)
commitc9e14bf07cd2924d6b3b6132b8daebe1da8d95b3 (patch)
tree1036fe98db90477128a7def786482f6a8df00ebb /www/admin/user/user.php.in
parent5f72d471dbf1a9dae6272b18811b6c5266dcc250 (diff)
downloadkolab-webadmin-c9e14bf07cd2924d6b3b6132b8daebe1da8d95b3.tar.gz
Fix for issue1418 (Field customisation issue)
Diffstat (limited to 'www/admin/user/user.php.in')
-rw-r--r--www/admin/user/user.php.in112
1 files changed, 60 insertions, 52 deletions
diff --git a/www/admin/user/user.php.in b/www/admin/user/user.php.in
index 73fb6d2..eaa4158 100644
--- a/www/admin/user/user.php.in
+++ b/www/admin/user/user.php.in
@@ -188,6 +188,7 @@ function apply_attributeaccess( &$entries ) {
if( $attributeaccess[$akey] == 'ro' ) {
$entries[$key]['attrs'] = 'readonly';
} else if( $attributeaccess[$akey] == 'hidden' ) {
+ //$entries[$key]['attrs'] = 'hidden';
unset($entries[$key]);
} else if( $attributeaccess[$akey] == 'mandatory' ) {
if( isset( $entries[$key]['validation'] ) ) {
@@ -221,68 +222,74 @@ function fill_form_for_modify( &$form, $dn, &$ldap_object ) {
else $mail = $ldap_object['mail'];
if (is_array($ldap_object['uid'])) $uid = $ldap_object['uid'][0];
else $uid = $ldap_object['uid'];
- $form->entries['givenname']['value'] = $givenname;
- $form->entries['sn']['value'] = $sn;
- $form->entries['password_0']['value'] = '';
- $form->entries['password_1']['value'] = '';
- $form->entries['mail']['value'] = $mail;
- $form->entries['mail']['attrs'] = 'readonly';
- $form->entries['uid']['value'] = $uid;
-
+ if(array_key_exists('givenname',$form->entries)) $form->entries['givenname']['value'] = $givenname;
+ if(array_key_exists('sn',$form->entries)) $form->entries['sn']['value'] = $sn;
+ if(array_key_exists('password_0',$form->entries)) $form->entries['password_0']['value'] = '';
+ if(array_key_exists('password_1',$form->entries)) $form->entries['password_1']['value'] = '';
+ if(array_key_exists('mail',$form->entries)) $form->entries['mail']['value'] = $mail;
+ if(array_key_exists('mail',$form->entries)) $form->entries['mail']['attrs'] = 'readonly';
+ if(array_key_exists('uid',$form->entries)) $form->entries['uid']['value'] = $uid;
// accttype
$dncomp = split( ',', $dn );
- if( in_array('cn=groups',$dncomp) ) {
- $form->entries['accttype']['value'] = 2;
- } else if( in_array('cn=resources',$dncomp) ) {
- $form->entries['accttype']['value'] = 3;
- } else if( in_array('cn=internal',$dncomp) ) {
- $form->entries['accttype']['value'] = 1;
- } else {
- $form->entries['accttype']['value'] = 0;
+ if(array_key_exists('acctype',$form->entries)) {
+ if( in_array('cn=groups',$dncomp) ) {
+ $form->entries['accttype']['value'] = 2;
+ } else if( in_array('cn=resources',$dncomp) ) {
+ $form->entries['accttype']['value'] = 3;
+ } else if( in_array('cn=internal',$dncomp) ) {
+ $form->entries['accttype']['value'] = 1;
+ } else {
+ $form->entries['accttype']['value'] = 0;
+ }
+ if( $auth->group() == 'user' ) $form->entries['accttype']['attrs'] = 'readonly';
}
- if( $auth->group() == 'user' ) $form->entries['accttype']['attrs'] = 'readonly';
// Automatic invitation handling
- $policies = array();
- for( $i = 0; $i < $ldap_object['kolabInvitationPolicy']['count']; $i++ ) {
- $resact = $ldap_object['kolabInvitationPolicy'][$i];
- debug("resact=$resact");
- if( ereg( '(.*):(.*)', trim($resact), $regs ) ) {
- $user = trim($regs[1]);
- $pol = trim($regs[2]);
- if( empty($user) ) continue;
- } else {
- $user = 'anyone';
- $pol = trim($resact);
- }
- if( $form->entries['accttype']['value'] == 1 ) {
- // default for groups
- $pol = policy2number( $pol, 3 /*ACT_MANUAL_IF_CONFLICTS*/ );
- } else {
- // default for resources
- $pol = policy2number( $pol, 2 /*ACT_REJECT_IF_CONFLICTS*/ );
- }
- $policies[$user] = $pol;
+ if(array_key_exists('kolabinvitationpolicy',$form->entries)) {
+ $policies = array();
+ for( $i = 0; $i < $ldap_object['kolabInvitationPolicy']['count']; $i++ ) {
+ $resact = $ldap_object['kolabInvitationPolicy'][$i];
+ debug("resact=$resact");
+ if( ereg( '(.*):(.*)', trim($resact), $regs ) ) {
+ $user = trim($regs[1]);
+ $pol = trim($regs[2]);
+ if( empty($user) ) continue;
+ } else {
+ $user = 'anyone';
+ $pol = trim($resact);
+ }
+ if( $form->entries['accttype']['value'] == 1 ) {
+ // default for groups
+ $pol = policy2number( $pol, 3 /*ACT_MANUAL_IF_CONFLICTS*/ );
+ } else {
+ // default for resources
+ $pol = policy2number( $pol, 2 /*ACT_REJECT_IF_CONFLICTS*/ );
+ }
+ $policies[$user] = $pol;
+ }
+ if( !isset( $policies['anyone'] ) ) $policies['anyone'] = 4 /*ACT_MANUAL*/;
+ $form->entries['kolabinvitationpolicy']['policies'] = $policies;
}
- if( !isset( $policies['anyone'] ) ) $policies['anyone'] = 4 /*ACT_MANUAL*/;
- $form->entries['kolabinvitationpolicy']['policies'] = $policies;
foreach( array( 'title', 'o', 'ou', 'roomNumber', 'street',
'postOfficeBox', 'postalCode', 'l', 'c',
'telephoneNumber', 'facsimileTelephoneNumber' ) as $attr ) {
+ if(!array_key_exists($attr.'_0',$form->entries)) continue;
if (is_array($ldap_object[$attr])) $v = $ldap_object[$attr][0];
else $v = $ldap_object[$attr];
$form->entries[$attr.'_0']['value'] = $v;
}
// alias
- if (is_array($ldap_object['alias'])) {
- $arr = $ldap_object['alias'];
- unset( $arr['count'] );
- $v = join("\n", $arr );
+ if(array_key_exists('alias',$form->entries)) {
+ if (is_array($ldap_object['alias'])) {
+ $arr = $ldap_object['alias'];
+ unset( $arr['count'] );
+ $v = join("\n", $arr );
+ }
+ else $v = "";
+ $form->entries['alias']['value'] = $v;
}
- else $v = "";
- $form->entries['alias']['value'] = $v;
// kolabdelegate
if (is_array($ldap_object['kolabDelegate'])) {
@@ -291,14 +298,15 @@ function fill_form_for_modify( &$form, $dn, &$ldap_object ) {
$v = join("\n", $arr );
}
else $v = "";
- $form->entries['kolabdelegate']['value'] = $v;
+ if(array_key_exists('kolabdelegate',$form->entries)) $form->entries['kolabdelegate']['value'] = $v;
// kolabhomeserver
- if( is_array($ldap_object['kolabHomeServer']) ) {
- $form->entries['kolabhomeserver']['value'] = $ldap_object['kolabHomeServer'][0];
+ if(array_key_exists('kolabhomeserver',$form->entries)) {
+ if( is_array($ldap_object['kolabHomeServer']) ) {
+ $form->entries['kolabhomeserver']['value'] = $ldap_object['kolabHomeServer'][0];
+ }
+ $form->entries['kolabhomeserver']['attrs'] = 'readonly';
}
- $form->entries['kolabhomeserver']['attrs'] = 'readonly';
-
$form->entries['action']['value'] = 'save';
// userquota
@@ -317,8 +325,8 @@ function fill_form_for_modify( &$form, $dn, &$ldap_object ) {
if( is_array( $ldap_object['kolabFreeBusyFuture'] ) )
$freebusyfuture = $ldap_object['kolabFreeBusyFuture'][0];
else $freebusyfuture = $ldap_object['kolabFreeBusyFuture'];
+ $form->entries['kolabFreeBusyFuture_0']['value'] = $freebusyfuture;
}
- $form->entries['kolabFreeBusyFuture_0']['value'] = $freebusyfuture;
}
/**** Authentication etc. ***/
@@ -528,7 +536,7 @@ switch( $action ) {
}
if ($count > 0) $ldap_object[$attr] = $args;
elseif (!empty($_POST[$key])) $ldap_object[$attr] = $_POST[$key];
- else $ldap_object[$attr] = array();
+ else/*if (in_array($key,$_POST))*/ $ldap_object[$attr] = array();
}
{
// Handle group/resource policies