diff --git a/config/config.php.example b/config/config.php.example
index 7a7fdff..55a5e3f 100644
--- a/config/config.php.example
+++ b/config/config.php.example
@@ -79,38 +79,55 @@
/* Command availability ; if you don't authorize a command the command
links will not be shown and the command action will not be permitted.
For better security, set also ACL in your ldap directory. */
-
/*
-$config->custom->commands['all'] = array(
- 'home' => true,
- 'external_links' => array('feature' => true,
- 'forum' => true,
- 'bug' => true,
- 'donation' => true,
- 'help' => true,
- 'credits' => true),
- 'purge' => true,
- 'schema' => true,
- 'import' => true,
- 'export' => true,
- 'logout' => true,
- 'search' => array('simple_search' => true,
- 'predefined_search' => true,
- 'advanced_search' => true),
- 'server_refresh' => true,
- 'server_info' => true,
- 'entry_refresh' => true,
- 'entry_move' => true,
- 'entry_internal_attributes_show' => true,
- 'entry_delete' => array('simple_delete' => true,
- 'mass_delete' => false),
- 'entry_rename' => true,
- 'entry_compare' => true,
- 'entry_create' => true,
- 'attribute_add' => true,
- 'attribute_add_value' => true,
- 'attribute_delete' => true,
- 'attribute_delete_value' => true);
+$config->custom->commands['cmd'] = array(
+ 'entry_internal_attributes_show' => true,
+ 'entry_refresh' => true,
+ 'oslinks' => true,
+ 'switch_template' => true
+ );
+
+$config->custom->commands['script'] = array(
+ 'add_attr_form' => true,
+ 'add_oclass_form' => true,
+ 'add_value_form' => true,
+ 'collapse' => true,
+ 'compare' => true,
+ 'compare_form' => true,
+ 'copy' => true,
+ 'copy_form' => true,
+ 'create' => true,
+ 'create_confirm' => true,
+ 'delete' => true,
+ 'delete_attr' => true,
+ 'delete_form' => true,
+ 'draw_tree_node' => true,
+ 'expand' => true,
+ 'export' => true,
+ 'export_form' => true,
+ 'import' => true,
+ 'import_form' => true,
+ 'login' => true,
+ 'logout' => true,
+ 'login_form' => true,
+ 'mass_delete' => true,
+ 'mass_edit' => true,
+ 'mass_update' => true,
+ 'modify_member_form' => true,
+ 'monitor' => true,
+ 'purge_cache' => true,
+ 'query_engine' => true,
+ 'rename' => true,
+ 'rename_form' => true,
+ 'rdelete' => true,
+ 'refresh' => true,
+ 'schema' => true,
+ 'server_info' => true,
+ 'show_cache' => true,
+ 'template_engine' => true,
+ 'update_confirm' => true,
+ 'update' => true
+);
*/
/*********************************************/
diff --git a/htdocs/add_value_form.php b/htdocs/add_value_form.php
index e4b1685..7b98c7c 100644
--- a/htdocs/add_value_form.php
+++ b/htdocs/add_value_form.php
@@ -31,13 +31,6 @@ $request['template'] = $request['page']->getTemplate();
/*
if ($request['attribute']->isReadOnly())
error(sprintf(_('The attribute (%s) is in readonly mode.'),$request['attr']),'error','index.php');
-
-# Check our permissions
-if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add_value'))
- error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('add attribute value')),'error','index.php');
-
-if (($request['attribute']->getValueCount() == 0) && ! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_add'))
- error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('add attribute')),'error','index.php');
*/
# Render the form
diff --git a/htdocs/copy.php b/htdocs/copy.php
index 5c98370..2769908 100644
--- a/htdocs/copy.php
+++ b/htdocs/copy.php
@@ -23,9 +23,6 @@ $ldap['SRC'] = $_SESSION[APPCONFIG]->getServer(get_request('server_id_src'));
$ldap['DST'] = $_SESSION[APPCONFIG]->getServer(get_request('server_id_dst'));
# Error checking
-if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_move'))
- error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('copy entry')),'error','index.php');
-
if (! trim($request['dnDST']))
error(_('You left the destination DN blank.'),'error','index.php');
diff --git a/htdocs/create.php b/htdocs/create.php
index 7d65d7f..f07767c 100644
--- a/htdocs/create.php
+++ b/htdocs/create.php
@@ -19,9 +19,6 @@ if (get_request('cancel','REQUEST')) {
die();
}
-if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_create'))
- error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('create entry')),'error','index.php');
-
$request = array();
$request['redirect'] = get_request('redirect','POST',false,false);
diff --git a/htdocs/create_confirm.php b/htdocs/create_confirm.php
index 1276126..763b4bb 100644
--- a/htdocs/create_confirm.php
+++ b/htdocs/create_confirm.php
@@ -13,9 +13,6 @@
require './common.php';
-if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_create'))
- error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('create entry')),'error','index.php');
-
$request = array();
$request['redirect'] = get_request('redirect','POST',false,false);
diff --git a/htdocs/delete.php b/htdocs/delete.php
index c2134d6..b40a137 100644
--- a/htdocs/delete.php
+++ b/htdocs/delete.php
@@ -20,9 +20,6 @@ $request['dn'] = get_request('dn','REQUEST',true);
if (! $app['server']->dnExists($request['dn']))
error(sprintf('%s (%s)',_('No such entry.'),''.pretty_print_dn($request['dn']).''),'error','index.php');
-if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete','simple_delete'))
- error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('delete entry')),'error','index.php');
-
# Delete the entry.
$result = $app['server']->delete($request['dn']);
diff --git a/htdocs/delete_attr.php b/htdocs/delete_attr.php
index 217de86..82c0a55 100644
--- a/htdocs/delete_attr.php
+++ b/htdocs/delete_attr.php
@@ -13,9 +13,6 @@
require './common.php';
-if (! $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete'))
- error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('delete attribute')),'error','index.php');
-
$request = array();
$request['dn'] = get_request('dn','REQUEST',true);
$request['attr'] = get_request('attr','REQUEST',true);
diff --git a/htdocs/export.php b/htdocs/export.php
index c975097..cbb0081 100755
--- a/htdocs/export.php
+++ b/htdocs/export.php
@@ -14,9 +14,6 @@
require './common.php';
require LIBDIR.'export_functions.php';
-if (! $_SESSION[APPCONFIG]->isCommandAvailable('export'))
- error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('export')),'error','index.php');
-
# Prevent script from bailing early for long search
@set_time_limit(0);
diff --git a/htdocs/import.php b/htdocs/import.php
index 2ff5484..6e3b05b 100644
--- a/htdocs/import.php
+++ b/htdocs/import.php
@@ -14,9 +14,6 @@
require './common.php';
require LIBDIR.'import_functions.php';
-if (! $_SESSION[APPCONFIG]->isCommandAvailable('import'))
- error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('import')),'error','index.php');
-
$request = array();
$request['importer'] = new Importer($app['server']->getIndex(),'LDIF');
$request['import'] = $request['importer']->getTemplate();
diff --git a/htdocs/rdelete.php b/htdocs/rdelete.php
index 09ccb74..fe7826d 100644
--- a/htdocs/rdelete.php
+++ b/htdocs/rdelete.php
@@ -13,9 +13,6 @@
require './common.php';
-if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete','simple_delete'))
- error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('delete entry')),'error','index.php');
-
$request = array();
$request['dn'] = get_request('dn','REQUEST',true);
diff --git a/htdocs/rename.php b/htdocs/rename.php
index 68ec31a..883f13a 100644
--- a/htdocs/rename.php
+++ b/htdocs/rename.php
@@ -20,9 +20,6 @@ $request['rdnDST'] = get_request('new_rdn','REQUEST');
$request['container'] = $app['server']->getContainer($request['dnSRC']);
# Error checking
-if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_rename'))
- error(sprintf('%s: %s',_('This operation is not permitted by the configuration'),_('rename entry')),'error','index.php');
-
if (! $app['server']->isBranchRenameEnabled()) {
# We search all children, not only the visible children in the tree
$children = $app['server']->getContainerContents($request['dnSRC'],null,0,'(objectClass=*)',LDAP_DEREF_NEVER);
diff --git a/htdocs/welcome.php b/htdocs/welcome.php
index 051d205..379e6ad 100644
--- a/htdocs/welcome.php
+++ b/htdocs/welcome.php
@@ -20,23 +20,10 @@ echo '
';
echo _('Use the menu to the left to navigate');
echo '
';
-$links = '';
-
-if ($_SESSION[APPCONFIG]->isCommandAvailable('external_links','credits'))
- $links .= sprintf('%s',get_href('credits'),_('Credits'));
-
-if ($_SESSION[APPCONFIG]->isCommandAvailable('external_links','help')) {
- if ($links) $links .= ' | ';
- $links .= sprintf('%s',get_href('documentation'),_('Documentation'));
-}
-
-if ($_SESSION[APPCONFIG]->isCommandAvailable('external_links','donation')) {
- if ($links) $links .= ' | ';
- $links .= sprintf('%s',get_href('donate'),_('Donate'));
-}
-
-if ($links) {
- echo $links;
+if ($_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks')) {
+ printf('%s',get_href('credits'),_('Credits'));
+ printf(' | %s',get_href('documentation'),_('Documentation'));
+ printf(' | %s',get_href('donate'),_('Donate'));
echo '
';
}
diff --git a/lib/HTMLTree.php b/lib/HTMLTree.php
index 72c8faa..69a9d83 100644
--- a/lib/HTMLTree.php
+++ b/lib/HTMLTree.php
@@ -207,6 +207,7 @@ class HTMLTree extends Tree {
$menu['title'] = _('View schema for');
$menu['img'] = 'schema-big.png';
$menu['name'] = _('schema');
+
break;
case 'search':
@@ -219,6 +220,7 @@ class HTMLTree extends Tree {
$menu['title'] = _('Search');
$menu['img'] = 'search-big.png';
$menu['name'] = _('search');
+
break;
case 'refresh':
@@ -232,6 +234,7 @@ class HTMLTree extends Tree {
$menu['title'] = _('Refresh');
$menu['img'] = 'refresh-big.png';
$menu['name'] = _('refresh');
+
break;
case 'server_info':
@@ -244,6 +247,7 @@ class HTMLTree extends Tree {
$menu['title'] = _('Info');
$menu['img'] = 'info-big.png';
$menu['name'] = _('info');
+
break;
case 'monitor':
@@ -260,10 +264,11 @@ class HTMLTree extends Tree {
$menu['title'] = _('Monitor');
$menu['img'] = 'monitorserver-big.png';
$menu['name'] = _('monitor');
+
break;
case 'import':
- if (! $_SESSION[APPCONFIG]->isCommandAvailable('script','import') || $server->isReadOnly())
+ if (! $_SESSION[APPCONFIG]->isCommandAvailable('script','import_form') || ! $_SESSION[APPCONFIG]->isCommandAvailable('script','import') || $server->isReadOnly())
return '';
$menu['cmd'] = 'import_form';
@@ -272,10 +277,11 @@ class HTMLTree extends Tree {
$menu['title'] = _('Import');
$menu['img'] = 'import-big.png';
$menu['name'] = _('import');
+
break;
case 'export':
- if (! $_SESSION[APPCONFIG]->isCommandAvailable('script','export'))
+ if (! $_SESSION[APPCONFIG]->isCommandAvailable('script','export_form') || ! $_SESSION[APPCONFIG]->isCommandAvailable('script','export'))
return '';
$menu['cmd'] = 'export_form';
@@ -284,10 +290,11 @@ class HTMLTree extends Tree {
$menu['title'] = _('Export');
$menu['img'] = 'export-big.png';
$menu['name'] = _('export');
+
break;
case 'logout':
- if (in_array($server->getAuthType(),array('config','http','proxy')))
+ if (! $_SESSION[APPCONFIG]->isCommandAvailable('script','logout') || in_array($server->getAuthType(),array('config','http','proxy')))
return '';
$href = sprintf('cmd.php?cmd=logout&server_id=%s',$server->getIndex());
diff --git a/lib/PageRender.php b/lib/PageRender.php
index e2fef63..d2882f5 100644
--- a/lib/PageRender.php
+++ b/lib/PageRender.php
@@ -623,7 +623,7 @@ class PageRender extends Visitor {
echo '
';
- if (! $attribute->isReadOnly() && $_SESSION[APPCONFIG]->isCommandAvailable('attribute_delete'))
+ if (! $attribute->isReadOnly() && $_SESSION[APPCONFIG]->isCommandAvailable('script','delete_attr'))
printf(' %s',
$attribute->getName(),$attribute->getFriendlyName(),$i,IMGDIR,_('delete attribute'));
diff --git a/lib/QueryRender.php b/lib/QueryRender.php
index abd05b7..6fdc773 100644
--- a/lib/QueryRender.php
+++ b/lib/QueryRender.php
@@ -561,7 +561,7 @@ var deon=0;
printf('
- * $config->custom->commands['all'] = array('entry_delete' => array('mass_delete' => true));
- *
- * Notice that mass deletes are not enabled on a per-server basis, but this
- * function checks that the server is not in a read-only state as well.
- *
- * @return boolean
- */
- function isMassDeleteEnabled() {
- if (DEBUG_ENABLED)
- debug_log('Entered with ()',17,__FILE__,__LINE__,__METHOD__);
-
- if ($this->connect(false) && $this->haveAuthInfo() && ! $this->isReadOnly() &&
- $_SESSION[APPCONFIG]->isCommandAvailable('entry_delete', 'mass_delete'))
-
- return true;
-
- else
- return false;
- }
-
/**
* Gets whether the admin has configured phpLDAPadmin to show the "Create New" link in the tree viewer.
*
@@ -166,7 +141,7 @@ class ldap_pla extends ldap {
if (DEBUG_ENABLED)
debug_log('Entered with ()',17,__FILE__,__LINE__,__METHOD__);
- if (! $_SESSION[APPCONFIG]->isCommandAvailable('entry_create'))
+ if (! $_SESSION[APPCONFIG]->isCommandAvailable('script','create'))
return false;
else
return $this->getValue('appearance','show_create');
diff --git a/lib/functions.php b/lib/functions.php
index 58fb60a..8c89f87 100644
--- a/lib/functions.php
+++ b/lib/functions.php
@@ -358,50 +358,60 @@ function cmd_control_pane($type) {
return array(
'home'=>array(
'title'=>_('Home'),
+ 'enable'=>true,
'link'=>sprintf('href="index.php" title="%s"',_('Home')),
'image'=>sprintf('',IMGDIR,_('Home'))),
'purge'=>array(
'title'=>_('Purge caches'),
+ 'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('script','purge_cache'),
'link'=>sprintf('href="cmd.php?cmd=purge_cache" onclick="return displayAJ(\'BODY\',\'cmd=purge_cache\',\'%s\');" title="%s"',
_('Clearing cache'),_('Purge caches')),
'image'=>sprintf('',IMGDIR,_('Purge caches'))),
- 'appearance:hide_debug_info'=>array(
+ 'hide_debug_info'=>array(
'title'=>_('Show Cache'),
+ 'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('script','show_cache'),
'link'=>sprintf('href="cmd.php?cmd=show_cache" onclick="return displayAJ(\'BODY\',\'cmd=show_cache\',\'%s\');" title="%s"',
_('Loading'),_('Show Cache'),_('Show Cache')),
'image'=>sprintf('',IMGDIR,_('Show Cache'))),
);
+
break;
case 'top' :
return array(
- 'external_links:forum'=>array(
+ 'forum'=>array(
'title'=>_('Forum'),
+ 'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks'),
'link'=>sprintf('href="%s" title="%s" target="_blank"',get_href('forum'),_('Forum')),
'image'=>sprintf('',IMGDIR,_('Forum'))),
- 'external_links:feature'=>array(
+ 'feature'=>array(
'title'=>_('Request feature'),
+ 'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks'),
'link'=>sprintf('href="%s" title="%s" target="_blank"',get_href('add_rfe'),_('Request feature')),
'image'=>sprintf('',IMGDIR,_('Request feature'))),
- 'external_links:bug'=>array(
+ 'bug'=>array(
'title'=>_('Report a bug'),
+ 'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks'),
'link'=>sprintf('href="%s" title="%s" target="_blank"',get_href('add_bug'),_('Report a bug')),
'image'=>sprintf('',IMGDIR,_('Report a bug'))),
- 'external_links:donation'=>array(
+ 'donation'=>array(
'title'=>_('Donate'),
+ 'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks'),
'link'=>sprintf('href="%s" title="%s" target="_blank"',get_href('donate'),_('Donate')),
'image'=>sprintf('',IMGDIR,_('Donate'))),
- 'external_links:help'=>array(
+ 'help'=>array(
'title'=>_('Help'),
+ 'enable'=>$_SESSION[APPCONFIG]->isCommandAvailable('cmd','oslinks'),
'link'=>sprintf('href="%s" title="%s" target="_blank"',get_href('documentation'),_('Help')),
'image'=>sprintf('',IMGDIR,_('Help')))
);
+
break;
}
}
diff --git a/lib/page.php b/lib/page.php
index 321b963..bc62cf8 100644
--- a/lib/page.php
+++ b/lib/page.php
@@ -154,24 +154,19 @@ class page {
echo '';
$empty = true;
if (function_exists('cmd_control_pane'))
- foreach (cmd_control_pane('top') as $cmd => $cmddetails) {
- $cmds = explode(':',$cmd);
+ foreach (cmd_control_pane('top') as $cmddetails)
+ if ((isset($cmddetails['enable']) && $cmddetails['enable']) || ! isset($cmddetails['enable'])) {
+ if (! $empty)
+ echo ' ';
- if (defined('APPCONFIG') && isset($_SESSION[APPCONFIG]) && method_exists($_SESSION[APPCONFIG],'isCommandAvailable'))
- if ($_SESSION[APPCONFIG]->isCommandAvailable('all',$cmds)) {
- if ((isset($cmddetails['enable']) && trim($cmddetails['enable'])) || ! isset($cmddetails['enable'])) {
- if (! $empty)
- echo ' ';
+ printf('%s',$cmddetails['link'],$cmddetails['image']);
- printf('%s',$cmddetails['link'],$cmddetails['image']);
-
- $empty = false;
- }
- }
- }
+ $empty = false;
+ }
if ($empty)
echo ' ';
+
echo ' ';
echo '';
echo '';
@@ -187,22 +182,16 @@ class page {
$empty = true;
if (function_exists('cmd_control_pane'))
- foreach (cmd_control_pane('main') as $cmd => $cmddetails) {
- $cmds = explode(':',$cmd);
-
- if (defined('APPCONFIG') && isset($_SESSION[APPCONFIG]) && method_exists($_SESSION[APPCONFIG],'isCommandAvailable'))
- if ($_SESSION[APPCONFIG]->isCommandAvailable('all',$cmds)) {
- if ((isset($cmddetails['enable']) && trim($cmddetails['enable'])) || ! isset($cmddetails['enable'])) {
- if (! $empty)
+ foreach (cmd_control_pane('main') as $cmddetails)
+ if ((isset($cmddetails['enable']) && trim($cmddetails['enable'])) || ! isset($cmddetails['enable'])) {
+ if (! $empty)
echo ' | ';
- printf('%s',$cmddetails['link'],
- $_SESSION[APPCONFIG]->getValue('appearance','control_icons') ? $cmddetails['image'] : $cmddetails['title']);
+ printf('%s',$cmddetails['link'],
+ $_SESSION[APPCONFIG]->getValue('appearance','control_icons') ? $cmddetails['image'] : $cmddetails['title']);
- $empty = false;
- }
- }
- }
+ $empty = false;
+ }
echo '';
if ($empty)