Index: trunk/core/units/config_search/config_search_event_handler.php
===================================================================
diff -u -N -r4625 -r4670
--- trunk/core/units/config_search/config_search_event_handler.php (.../config_search_event_handler.php) (revision 4625)
+++ trunk/core/units/config_search/config_search_event_handler.php (.../config_search_event_handler.php) (revision 4670)
@@ -3,6 +3,20 @@
class ConfigSearchEventHandler extends InpDBEventHandler {
/**
+ * Changes permission section to one from REQUEST, not from config
+ *
+ * @param kEvent $event
+ */
+ function CheckPermission(&$event)
+ {
+ $module = $this->Application->GetVar('module');
+ $main_prefix = $this->Application->findModule('Name', $module, 'Var');
+ $section = $this->Application->getUnitOption($main_prefix.'.search', 'PermSection');
+ $event->setEventParam('PermSection', $section);
+ return parent::CheckPermission($event);
+ }
+
+ /**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
@@ -54,15 +68,10 @@
{
$custom_field =& $event->MasterEvent->getObject();
if ($custom_field->GetDBField('Type') == 6 || $custom_field->GetDBField('IsSystem') == 1) {
- // user custom fields are not searchable
+ // user & system custom fields are not searchable
return false;
}
- $sql = 'SELECT Module
- FROM '.TABLE_PREFIX.'ItemTypes
- WHERE ItemType = '.$custom_field->GetDBField('Type');
- $module_name = $this->Conn->GetOne($sql);
-
$object =& $event->getObject( Array('skip_autoload' => true) );
$custom_id = $custom_field->GetID();
@@ -79,7 +88,13 @@
$cf_search['Description'] = $custom_field->GetDBField('Prompt');
$cf_search['ConfigHeader'] = $custom_field->GetDBField('Heading'); // 'la_Text_CustomFields';
$cf_search['TableName'] = 'CustomField';
- $cf_search['ModuleName'] = $module_name;
+
+ $sql = 'SELECT Module
+ FROM '.TABLE_PREFIX.'ItemTypes
+ WHERE ItemType = '.$custom_field->GetDBField('Type');
+
+ $cf_search['ModuleName'] = $this->Conn->GetOne($sql);
+
$object->SetFieldsFromHash($cf_search);
$result = $object->isLoaded() ? $object->Update() : $object->Create();
Index: trunk/kernel/units/custom_fields/custom_fields_event_handler.php
===================================================================
diff -u -N -r4380 -r4670
--- trunk/kernel/units/custom_fields/custom_fields_event_handler.php (.../custom_fields_event_handler.php) (revision 4380)
+++ trunk/kernel/units/custom_fields/custom_fields_event_handler.php (.../custom_fields_event_handler.php) (revision 4670)
@@ -2,6 +2,25 @@
class CustomFieldsEventHandler extends InpDBEventHandler {
/**
+ * Changes permission section to one from REQUEST, not from config
+ *
+ * @param kEvent $event
+ */
+ function CheckPermission(&$event)
+ {
+ $sql = 'SELECT Prefix
+ FROM '.TABLE_PREFIX.'ItemTypes
+ WHERE ItemType = '.$this->Conn->qstr( $this->Application->GetVar('cf_type') );
+ $main_prefix = $this->Conn->GetOne($sql);
+
+ $section = $this->Application->getUnitOption($main_prefix.'.custom', 'PermSection');
+ $event->setEventParam('PermSection', $section);
+ return parent::CheckPermission($event);
+
+
+ }
+
+ /**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
Index: trunk/core/units/custom_fields/custom_fields_event_handler.php
===================================================================
diff -u -N -r4380 -r4670
--- trunk/core/units/custom_fields/custom_fields_event_handler.php (.../custom_fields_event_handler.php) (revision 4380)
+++ trunk/core/units/custom_fields/custom_fields_event_handler.php (.../custom_fields_event_handler.php) (revision 4670)
@@ -2,6 +2,25 @@
class CustomFieldsEventHandler extends InpDBEventHandler {
/**
+ * Changes permission section to one from REQUEST, not from config
+ *
+ * @param kEvent $event
+ */
+ function CheckPermission(&$event)
+ {
+ $sql = 'SELECT Prefix
+ FROM '.TABLE_PREFIX.'ItemTypes
+ WHERE ItemType = '.$this->Conn->qstr( $this->Application->GetVar('cf_type') );
+ $main_prefix = $this->Conn->GetOne($sql);
+
+ $section = $this->Application->getUnitOption($main_prefix.'.custom', 'PermSection');
+ $event->setEventParam('PermSection', $section);
+ return parent::CheckPermission($event);
+
+
+ }
+
+ /**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
Index: trunk/core/units/groups/groups_config.php
===================================================================
diff -u -N -r4636 -r4670
--- trunk/core/units/groups/groups_config.php (.../groups_config.php) (revision 4636)
+++ trunk/core/units/groups/groups_config.php (.../groups_config.php) (revision 4670)
@@ -42,7 +42,7 @@
'groups_select' => Array('prefixes' => Array('g_List'), 'format' => "!la_title_Groups! (#g_recordcount#) - !la_title_SelectGroup!"),
),
- 'PermSection' => 'in-portal:user_groups',
+ 'PermSection' => Array('main' => 'in-portal:user_groups'),
'Sections' => Array(
'in-portal:user_groups' => Array(
Index: trunk/core/units/categories/categories_config.php
===================================================================
diff -u -N -r4665 -r4670
--- trunk/core/units/categories/categories_config.php (.../categories_config.php) (revision 4665)
+++ trunk/core/units/categories/categories_config.php (.../categories_config.php) (revision 4670)
@@ -52,7 +52,9 @@
'tree_site' => Array('format' => '!la_selecting_categories!'),
),
-
+
+ 'PermSection' => Array(/*'search' => 'in-portal:configuration_search',*/ 'custom' => 'in-portal:configuration_custom'),
+
'Sections' => Array(
// "Structure & Data" section
'in-portal:site' => Array(
@@ -130,7 +132,7 @@
'parent' => 'in-portal:site',
'icon' => 'settings_custom',
'label' => 'la_tab_ConfigCustom',
- 'url' => Array('t' => 'custom_fields/custom_fields_list', 'cf_type' => 1, 'pass' => 'm,cf'),
+ 'url' => Array('t' => 'custom_fields/custom_fields_list', 'cf_type' => 1, 'pass_section' => true, 'pass' => 'm,cf'),
'permissions' => Array('view', 'add', 'edit', 'delete'),
'priority' => 7,
'type' => stTREE,
Index: trunk/core/units/admin/admin_config.php
===================================================================
diff -u -N -r4665 -r4670
--- trunk/core/units/admin/admin_config.php (.../admin_config.php) (revision 4665)
+++ trunk/core/units/admin/admin_config.php (.../admin_config.php) (revision 4670)
@@ -108,7 +108,7 @@
'icon' => 'conf_general',
'label' => 'la_tab_General',
'url' => Array('t' => 'config/config_universal', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view'),
+ 'permissions' => Array('view', 'edit'),
'priority' => 1,
'type' => stTREE,
),
Index: trunk/kernel/units/groups/groups_config.php
===================================================================
diff -u -N -r4636 -r4670
--- trunk/kernel/units/groups/groups_config.php (.../groups_config.php) (revision 4636)
+++ trunk/kernel/units/groups/groups_config.php (.../groups_config.php) (revision 4670)
@@ -42,7 +42,7 @@
'groups_select' => Array('prefixes' => Array('g_List'), 'format' => "!la_title_Groups! (#g_recordcount#) - !la_title_SelectGroup!"),
),
- 'PermSection' => 'in-portal:user_groups',
+ 'PermSection' => Array('main' => 'in-portal:user_groups'),
'Sections' => Array(
'in-portal:user_groups' => Array(
Index: trunk/kernel/units/categories/categories_config.php
===================================================================
diff -u -N -r4665 -r4670
--- trunk/kernel/units/categories/categories_config.php (.../categories_config.php) (revision 4665)
+++ trunk/kernel/units/categories/categories_config.php (.../categories_config.php) (revision 4670)
@@ -52,7 +52,9 @@
'tree_site' => Array('format' => '!la_selecting_categories!'),
),
-
+
+ 'PermSection' => Array(/*'search' => 'in-portal:configuration_search',*/ 'custom' => 'in-portal:configuration_custom'),
+
'Sections' => Array(
// "Structure & Data" section
'in-portal:site' => Array(
@@ -130,7 +132,7 @@
'parent' => 'in-portal:site',
'icon' => 'settings_custom',
'label' => 'la_tab_ConfigCustom',
- 'url' => Array('t' => 'custom_fields/custom_fields_list', 'cf_type' => 1, 'pass' => 'm,cf'),
+ 'url' => Array('t' => 'custom_fields/custom_fields_list', 'cf_type' => 1, 'pass_section' => true, 'pass' => 'm,cf'),
'permissions' => Array('view', 'add', 'edit', 'delete'),
'priority' => 7,
'type' => stTREE,
Index: trunk/kernel/units/admin/admin_config.php
===================================================================
diff -u -N -r4665 -r4670
--- trunk/kernel/units/admin/admin_config.php (.../admin_config.php) (revision 4665)
+++ trunk/kernel/units/admin/admin_config.php (.../admin_config.php) (revision 4670)
@@ -108,7 +108,7 @@
'icon' => 'conf_general',
'label' => 'la_tab_General',
'url' => Array('t' => 'config/config_universal', 'pass_section' => true, 'pass' => 'm'),
- 'permissions' => Array('view'),
+ 'permissions' => Array('view', 'edit'),
'priority' => 1,
'type' => stTREE,
),
Index: trunk/core/units/languages/languages_config.php
===================================================================
diff -u -N -r4663 -r4670
--- trunk/core/units/languages/languages_config.php (.../languages_config.php) (revision 4663)
+++ trunk/core/units/languages/languages_config.php (.../languages_config.php) (revision 4670)
@@ -88,7 +88,7 @@
'format' => "#lang_status# '#lang_titlefield#' - !la_title_EditingEmailEvent! '#emailmessages_titlefield#'"),
),
- 'PermSection' => 'in-portal:configure_lang',
+ 'PermSection' => Array('main' => 'in-portal:configure_lang'),
'Sections' => Array(
'in-portal:configure_lang' => Array(
Index: trunk/kernel/units/languages/languages_config.php
===================================================================
diff -u -N -r4663 -r4670
--- trunk/kernel/units/languages/languages_config.php (.../languages_config.php) (revision 4663)
+++ trunk/kernel/units/languages/languages_config.php (.../languages_config.php) (revision 4670)
@@ -88,7 +88,7 @@
'format' => "#lang_status# '#lang_titlefield#' - !la_title_EditingEmailEvent! '#emailmessages_titlefield#'"),
),
- 'PermSection' => 'in-portal:configure_lang',
+ 'PermSection' => Array('main' => 'in-portal:configure_lang'),
'Sections' => Array(
'in-portal:configure_lang' => Array(
Index: trunk/core/units/general/general_config.php
===================================================================
diff -u -N -r3310 -r4670
--- trunk/core/units/general/general_config.php (.../general_config.php) (revision 3310)
+++ trunk/core/units/general/general_config.php (.../general_config.php) (revision 4670)
@@ -18,6 +18,8 @@
'TableName' => TABLE_PREFIX.'Category',
'PortalStyleEnv' => true,
- );
+ 'PermSection' => Array('search' => 'in-portal:configuration_search', 'custom' => 'in-portal:configuration_custom'),
+ );
+
?>
\ No newline at end of file
Index: trunk/core/units/users/users_config.php
===================================================================
diff -u -N -r4665 -r4670
--- trunk/core/units/users/users_config.php (.../users_config.php) (revision 4665)
+++ trunk/core/units/users/users_config.php (.../users_config.php) (revision 4670)
@@ -81,7 +81,7 @@
),
- 'PermSection' => 'in-portal:user_list',
+ 'PermSection' => Array('main' => 'in-portal:user_list', 'custom' => 'in-portal:user_custom'),
'Sections' => Array(
'in-portal:users' => Array(
@@ -128,8 +128,8 @@
'parent' => 'in-portal:users',
'icon' => 'settings_custom',
'label' => 'la_tab_ConfigCustom',
- 'url' => Array('t' => 'custom_fields/custom_fields_list', 'cf_type' => 6, 'pass' => 'm,cf'),
- 'permissions' => Array('view', 'add', 'edit'),
+ 'url' => Array('t' => 'custom_fields/custom_fields_list', 'cf_type' => 6, 'pass_section' => true, 'pass' => 'm,cf'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete'),
'priority' => 5,
'type' => stTREE,
),
Index: trunk/kernel/units/users/users_config.php
===================================================================
diff -u -N -r4665 -r4670
--- trunk/kernel/units/users/users_config.php (.../users_config.php) (revision 4665)
+++ trunk/kernel/units/users/users_config.php (.../users_config.php) (revision 4670)
@@ -81,7 +81,7 @@
),
- 'PermSection' => 'in-portal:user_list',
+ 'PermSection' => Array('main' => 'in-portal:user_list', 'custom' => 'in-portal:user_custom'),
'Sections' => Array(
'in-portal:users' => Array(
@@ -128,8 +128,8 @@
'parent' => 'in-portal:users',
'icon' => 'settings_custom',
'label' => 'la_tab_ConfigCustom',
- 'url' => Array('t' => 'custom_fields/custom_fields_list', 'cf_type' => 6, 'pass' => 'm,cf'),
- 'permissions' => Array('view', 'add', 'edit'),
+ 'url' => Array('t' => 'custom_fields/custom_fields_list', 'cf_type' => 6, 'pass_section' => true, 'pass' => 'm,cf'),
+ 'permissions' => Array('view', 'add', 'edit', 'delete'),
'priority' => 5,
'type' => stTREE,
),
Index: trunk/kernel/units/general/general_config.php
===================================================================
diff -u -N -r3310 -r4670
--- trunk/kernel/units/general/general_config.php (.../general_config.php) (revision 3310)
+++ trunk/kernel/units/general/general_config.php (.../general_config.php) (revision 4670)
@@ -18,6 +18,8 @@
'TableName' => TABLE_PREFIX.'Category',
'PortalStyleEnv' => true,
- );
+ 'PermSection' => Array('search' => 'in-portal:configuration_search', 'custom' => 'in-portal:configuration_custom'),
+ );
+
?>
\ No newline at end of file
Index: trunk/core/kernel/utility/event.php
===================================================================
diff -u -N -r4653 -r4670
--- trunk/core/kernel/utility/event.php (.../event.php) (revision 4653)
+++ trunk/core/kernel/utility/event.php (.../event.php) (revision 4670)
@@ -288,7 +288,7 @@
}
$main_prefix = $this->Application->GetTopmostPrefix($this->Prefix);
- $section = $this->Application->getUnitOption($main_prefix, 'PermSection');
+ $section = $this->Application->getUnitOption($main_prefix.'.main', 'PermSection');
if (!$section) {
trigger_error('Permission section not specified for prefix '.$main_prefix.'', E_USER_ERROR);
Index: trunk/kernel/units/config_search/config_search_event_handler.php
===================================================================
diff -u -N -r4625 -r4670
--- trunk/kernel/units/config_search/config_search_event_handler.php (.../config_search_event_handler.php) (revision 4625)
+++ trunk/kernel/units/config_search/config_search_event_handler.php (.../config_search_event_handler.php) (revision 4670)
@@ -3,6 +3,20 @@
class ConfigSearchEventHandler extends InpDBEventHandler {
/**
+ * Changes permission section to one from REQUEST, not from config
+ *
+ * @param kEvent $event
+ */
+ function CheckPermission(&$event)
+ {
+ $module = $this->Application->GetVar('module');
+ $main_prefix = $this->Application->findModule('Name', $module, 'Var');
+ $section = $this->Application->getUnitOption($main_prefix.'.search', 'PermSection');
+ $event->setEventParam('PermSection', $section);
+ return parent::CheckPermission($event);
+ }
+
+ /**
* Apply any custom changes to list's sql query
*
* @param kEvent $event
@@ -54,15 +68,10 @@
{
$custom_field =& $event->MasterEvent->getObject();
if ($custom_field->GetDBField('Type') == 6 || $custom_field->GetDBField('IsSystem') == 1) {
- // user custom fields are not searchable
+ // user & system custom fields are not searchable
return false;
}
- $sql = 'SELECT Module
- FROM '.TABLE_PREFIX.'ItemTypes
- WHERE ItemType = '.$custom_field->GetDBField('Type');
- $module_name = $this->Conn->GetOne($sql);
-
$object =& $event->getObject( Array('skip_autoload' => true) );
$custom_id = $custom_field->GetID();
@@ -79,7 +88,13 @@
$cf_search['Description'] = $custom_field->GetDBField('Prompt');
$cf_search['ConfigHeader'] = $custom_field->GetDBField('Heading'); // 'la_Text_CustomFields';
$cf_search['TableName'] = 'CustomField';
- $cf_search['ModuleName'] = $module_name;
+
+ $sql = 'SELECT Module
+ FROM '.TABLE_PREFIX.'ItemTypes
+ WHERE ItemType = '.$custom_field->GetDBField('Type');
+
+ $cf_search['ModuleName'] = $this->Conn->GetOne($sql);
+
$object->SetFieldsFromHash($cf_search);
$result = $object->isLoaded() ? $object->Update() : $object->Create();