Index: trunk/core/kernel/db/db_event_handler.php =================================================================== diff -u -r4679 -r4689 --- trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 4679) +++ trunk/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 4689) @@ -57,16 +57,24 @@ */ function CheckPermission(&$event) { - if ((substr($event->Name, 0, 9) == 'OnPreSave') || ($event->Name == 'OnSave')) { - $section = $event->getSection(); - if ($this->isNewItemCreate($event)) { - return $this->Application->CheckPermission($section.'.add'); + $section = $event->getSection(); + if (!preg_match('/^CATEGORY:(.*)/', $section)) { + // only if not category item events + if ((substr($event->Name, 0, 9) == 'OnPreSave') || ($event->Name == 'OnSave')) { + if ($this->isNewItemCreate($event)) { + return $this->Application->CheckPermission($section.'.add', 1); + } + else { + return $this->Application->CheckPermission($section.'.add', 1) || $this->Application->CheckPermission($section.'.edit', 1); + } } - else { - return $this->Application->CheckPermission($section.'.add', 1) || $this->Application->CheckPermission($section.'.edit', 1); - } } + if ($event->Name == 'OnPreCreate') { + // save category_id before item create (for item category selector not to destroy permission checking category) + $this->Application->LinkVar('m_cat_id'); + } + return parent::CheckPermission($event); } @@ -78,7 +86,7 @@ { parent::mapPermissions(); $permissions = Array( - 'OnNew' => Array('self' => 'add', 'subitem' => 'add'), + 'OnNew' => Array('self' => 'add', 'subitem' => 'add|edit'), 'OnCreate' => Array('self' => 'add', 'subitem' => 'add|edit'), 'OnUpdate' => Array('self' => 'edit', 'subitem' => 'add|edit'), 'OnSetPrimary' => Array('self' => 'add|edit', 'subitem' => 'add|edit'), @@ -944,7 +952,7 @@ function OnEdit(&$event) { $this->StoreSelectedIDs($event); - + $temp =& $this->Application->recallObject($event->getPrefixSpecial().'_TempHandler', 'kTempTablesHandler'); $temp->PrepareEdit(); @@ -1114,7 +1122,7 @@ $this->Application->setUnitOption($event->Prefix,'AutoLoad',false); $object =& $event->getObject(); - + $temp =& $this->Application->recallObject($event->Prefix.'_TempHandler', 'kTempTablesHandler'); $temp->PrepareEdit();