summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteffen Hansen <steffen@kdab.com>2006-05-17 23:15:32 (GMT)
committerSteffen Hansen <steffen@kdab.com>2006-05-17 23:15:32 (GMT)
commitd928a88932571cf83e7c0fd4aaeedad8dfe66d5c (patch)
treedcb06a454bac0e646ac9c249af3f092c9ddab399
parent15bead80f3603902657f89a4ab8787c360dc4b7c (diff)
downloadkolab-webadmin-d928a88932571cf83e7c0fd4aaeedad8dfe66d5c.tar.gz
patches from wrobel
-rw-r--r--php/admin/include/menu.php18
-rw-r--r--www/admin/domainmaintainer/domainmaintainer.php.in38
-rw-r--r--www/admin/domainmaintainer/index.php.in4
-rw-r--r--www/admin/maintainer/maintainer.php.in11
4 files changed, 53 insertions, 18 deletions
diff --git a/php/admin/include/menu.php b/php/admin/include/menu.php
index 16964ee..5736a68 100644
--- a/php/admin/include/menu.php
+++ b/php/admin/include/menu.php
@@ -41,13 +41,16 @@ if( $auth->group() == "admin" || $auth->group() == "maintainer" || $auth->group(
array( 'name' => _('Vacation'),
'url' => 'vacation.php' )));
}
-if( $auth->group() == "admin" || $auth->group() == "maintainer" || $auth->group() == 'domain-maintainer') {
+if( $auth->group() == "admin" || $auth->group() == "maintainer") {
$menuitems['addressbook'] = array( 'name' => _('Addressbook'),
'url' => $topdir.'/addressbook/',
'title' => _('Manage Address Book'),
'submenu' => array(
array( 'name' => _('Create New vCard'),
'url' => 'addr.php?action=create' )));
+
+}
+if( $auth->group() == "admin" || $auth->group() == "maintainer" || $auth->group() == 'domain-maintainer') {
$menuitems['sf'] = array( 'name' => _('Shared Folder'),
'url' => $topdir.'/sharedfolder/',
'title' => _('Manage Shared Folders'),
@@ -76,8 +79,6 @@ if( $auth->group() == 'admin' ) {
'submenu' => array(
array( 'name' => _('Create New Domain Maintainer'),
'url' => 'domainmaintainer.php?action=create' ) ) );
-}
-if( $auth->group() == 'admin' ) {
$menuitems['maintainer'] = array( 'name' => _('Maintainers'),
'url' => $topdir.'/maintainer/',
'title' => _('Manage Maintainers'),
@@ -89,8 +90,17 @@ if( $auth->group() == 'admin' ) {
$menuitems['maintainer'] = array( 'name' => _('Maintainers'),
'url' => $topdir.'/maintainer/maintainer.php?action=modify&dn='.urlencode($mdn),
'title' => _('Manage Maintainer') );
+ $menuitems['domain-maintainer'] = array( 'name' => _('Domain Maintainers'),
+ 'url' => $topdir.'/domainmaintainer/',
+ 'title' => _('Manage Domain Maintainers'),
+ 'submenu' => array(
+ array( 'name' => _('Create New Domain Maintainer'),
+ 'url' => 'domainmaintainer.php?action=create' ) ) );
} else if( $auth->group() == 'domain-maintainer' ) {
- // Domain maintainer
+ $mdn = $auth->dn();
+ $menuitems['domain-maintainer'] = array( 'name' => _('Domain Maintainers'),
+ 'url' => $topdir.'/domainmaintainer/domainmaintainer.php?action=modify&dn='.urlencode($mdn),
+ 'title' => _('Manage Domain Maintainer') );
}
if( $auth->group() == 'admin' ) {
$menuitems['service'] = array( 'name' => _('Services'),
diff --git a/www/admin/domainmaintainer/domainmaintainer.php.in b/www/admin/domainmaintainer/domainmaintainer.php.in
index 98e4db2..715445b 100644
--- a/www/admin/domainmaintainer/domainmaintainer.php.in
+++ b/www/admin/domainmaintainer/domainmaintainer.php.in
@@ -71,6 +71,7 @@ function checkpw( $form, $key, $value ) {
return '';
}
function fill_form_for_modify( &$form, &$ldap_object ) {
+ global $auth;
global $ldap;
if (is_array($ldap_object['sn'])) $lastname = $ldap_object['sn'][0];
else $lastname = $ldap_object['sn'];
@@ -91,7 +92,12 @@ function fill_form_for_modify( &$form, &$ldap_object ) {
$form->entries['password_1']['value'] = '';
$form->entries['uid']['value'] = $uid;
$form->entries['uid']['attrs'] = 'readonly';
- $form->entries['domains']['value'] = $ldap->domainsForMaintainerUid($uid);
+ if( $auth->group() != 'admin' && $auth->group() != 'maintainer' ) {
+ $form->entries['firstname']['attrs'] = 'readonly';
+ $form->entries['lastname']['attrs'] = 'readonly';
+ } else {
+ $form->entries['domains']['value'] = $ldap->domainsForMaintainerUid($uid);
+ }
}
/**** Authentication etc. ***/
@@ -114,7 +120,7 @@ $dn="";
if (!empty($_REQUEST['dn'])) $dn = trim(urldecode($_REQUEST['dn']));
// Check auth
-if (!$errors && $auth->group() != 'admin' && $auth->group() != 'maintainer' ) {
+if (!$errors && $auth->group() != 'admin' && $auth->group() != 'maintainer' && $auth->group() != 'domain-maintainer' ) {
array_push($errors, _("Error: You don't have the required Permissions"));
}
@@ -143,13 +149,16 @@ $entries = array( 'firstname' => array( 'name' => _('First Name'),
'comment' => $comment_password ),
'uid' => array( 'name' => _('Unique User ID'),
'validation' => 'notempty',
- 'comment' => $comment_mail_0 ),
- 'domains' => array( 'name' => _("Domains"),
- 'type' => "checklist",
- 'comment' => _("Check domains this domain maintainer should be able to maintain"),
- 'options' => $ldap->domains())
+ 'comment' => $comment_mail_0 )
);
+if( $auth->group() == 'admin' || $auth->group() == 'maintainer' ) {
+ $entries['domains'] = array( 'name' => _("Domains"),
+ 'type' => "checklist",
+ 'comment' => _("Check domains this domain maintainer should be able to maintain"),
+ 'options' => $ldap->domains());
+ }
+
$entries['action'] = array( 'name' => 'action',
'type' => 'hidden' );
@@ -225,10 +234,12 @@ switch( $action ) {
$errors[] = sprintf( _("LDAP Error: Could not remove old group entry %s: %s"), $dn,
ldap_error($ldap->connection));
}
- if( !$errors ) {
- $domains = $ldap->domainsForMaintainerDn($dn);
- $ldap->removeFromDomainGroups( $dn, $domains );
- $ldap->addToDomainGroups( $newdn, $_POST['domains'] );
+ if( $auth->group() == 'admin' || $auth->group() == 'maintainer' ) {
+ if( !$errors ) {
+ $domains = $ldap->domainsForMaintainerDn($dn);
+ $ldap->removeFromDomainGroups( $dn, $domains );
+ $ldap->addToDomainGroups( $newdn, $_POST['domains'] );
+ }
}
}
$dn = $newdn;
@@ -250,6 +261,11 @@ switch( $action ) {
$heading = _('Modify Domain Maintainer');
$messages[] = _('Maintainer ').$ldap_object['dn']._(' successfully modified');
$form->setValues();
+ if( $auth->group() != 'admin' && $auth->group() != 'maintainer' ) {
+ $form->entries['firstname']['attrs'] = 'readonly';
+ $form->entries['lastname']['attrs'] = 'readonly';
+ }
+ $form->entries['uid']['attrs'] = 'readonly';
$form->entries['action']['value'] = 'save';
} else {
// firstsave
diff --git a/www/admin/domainmaintainer/index.php.in b/www/admin/domainmaintainer/index.php.in
index e0f1ce3..df57c03 100644
--- a/www/admin/domainmaintainer/index.php.in
+++ b/www/admin/domainmaintainer/index.php.in
@@ -28,7 +28,7 @@ $errors = array();
/**** Authentication etc. ***/
$sidx = 'domain-maintainer';
-if( $auth->group() != 'admin' ) {
+if( $auth->group() != 'admin' && $auth->group() != 'maintainer' ) {
array_push($errors, _("Error: You don't have Permissions to access this Menu"));
}
@@ -52,7 +52,7 @@ if( !$errors ) {
$maintainers = $ldap->groupMembers( "cn=internal,$base_dn", 'domain-maintainer' );
- $filter = "(&(cn=*)(objectclass=inetOrgPerson)(!(uid=manager))(sn=*))";
+ $filter = "(&(cn=*)(objectclass=kolabInetOrgPerson)(!(uid=manager))(sn=*))";
$result = ldap_search($ldap->connection, $base_dn, $filter, array( 'uid', 'sn', 'cn', 'kolabdeleteflag' ));
if( $result ) {
diff --git a/www/admin/maintainer/maintainer.php.in b/www/admin/maintainer/maintainer.php.in
index 4d9d0a9..298a6e8 100644
--- a/www/admin/maintainer/maintainer.php.in
+++ b/www/admin/maintainer/maintainer.php.in
@@ -71,6 +71,7 @@ function checkpw( $form, $key, $value ) {
return '';
}
function fill_form_for_modify( &$form, &$ldap_object ) {
+ global $auth;
if (is_array($ldap_object['sn'])) $lastname = $ldap_object['sn'][0];
else $lastname = $ldap_object['sn'];
if (is_array($ldap_object['cn'])) $cn = $ldap_object['cn'][0];
@@ -90,7 +91,10 @@ function fill_form_for_modify( &$form, &$ldap_object ) {
$form->entries['password_1']['value'] = '';
$form->entries['uid']['value'] = $uid;
$form->entries['uid']['attrs'] = 'readonly';
-
+ if( $auth->group() != 'admin' ) {
+ $form->entries['firstname']['attrs'] = 'readonly';
+ $form->entries['lastname']['attrs'] = 'readonly';
+ }
/*
foreach( array( 'title', 'o', 'ou', 'street', 'postOfficeBox',
'postalCode', 'l', 'c', 'telephoneNumber',
@@ -259,6 +263,11 @@ switch( $action ) {
$heading = _('Modify Maintainer');
$messages[] = _('Maintainer ').$ldap_object['dn']._(' successfully modified');
$form->setValues();
+ if( $auth->group() != 'admin' ) {
+ $form->entries['firstname']['attrs'] = 'readonly';
+ $form->entries['lastname']['attrs'] = 'readonly';
+ }
+ $form->entries['uid']['attrs'] = 'readonly';
$form->entries['action']['value'] = 'save';
$content = $form->outputForm();
break;