Index: branches/5.2.x/core/kernel/application.php =================================================================== diff -u -r14811 -r14856 --- branches/5.2.x/core/kernel/application.php (.../application.php) (revision 14811) +++ branches/5.2.x/core/kernel/application.php (.../application.php) (revision 14856) @@ -1,6 +1,6 @@ GetVar('admin') ) { - // viewing front-end through admin's frame $admin_session =& $this->recallObject('Session.admin'); /* @var $admin_session Session */ - $user = (int)$admin_session->RecallVar('user_id'); // in case, when no valid admin session found + // store Admin Console User's ID to Front-End's session for cross-session permission checks + $this->StoreVar('admin_user_id', (int)$admin_session->RecallVar('user_id')); - $perm_helper =& $this->recallObject('PermissionsHelper'); - /* @var $perm_helper kPermissionsHelper */ - - if ( $perm_helper->CheckUserPermission($user, 'CATEGORY.MODIFY', 0, $this->getBaseCategory()) ) { - // user can edit cms blocks + if ( $this->CheckAdminPermission('CATEGORY.MODIFY', 0, $this->getBaseCategory()) ) { + // user can edit cms blocks (when viewing front-end through admin's frame) $editing_mode = $this->GetVar('editing_mode'); define('EDITING_MODE', $editing_mode ? $editing_mode : EDITING_MODE_BROWSE); } @@ -2411,6 +2408,22 @@ return $perm_helper->CheckPermission($name, $type, $cat_id); } + /** + * Check current admin permissions based on it's group permissions in specified category + * + * @param string $name permission name + * @param int $cat_id category id, current used if not specified + * @param int $type permission type {1 - system, 0 - per category} + * @return int + */ + function CheckAdminPermission($name, $type = 1, $cat_id = null) + { + $perm_helper =& $this->recallObject('PermissionsHelper'); + /* @var $perm_helper kPermissionsHelper */ + + return $perm_helper->CheckAdminPermission($name, $type, $cat_id); + } + /** * Set's any field of current visit *