function main(&$backRef, $menuItems, $tableID, $srcId)
 {
     $this->backRef = $backRef;
     $this->beUser = $GLOBALS['BE_USER'];
     $this->LANG = $GLOBALS['LANG'];
     $this->includeLocalLang();
     if (($tableID == 'dragDrop_tt_news_cat' || $tableID == 'tt_news_cat_CM') && $srcId) {
         $table = 'tt_news_cat';
         $rec = BackendUtility::getRecordWSOL($table, $srcId);
         // fetch page record to get editing permissions
         $lCP = $this->beUser->calcPerms(BackendUtility::getRecord('pages', $rec['pid']));
         $doEdit = $lCP & 16;
         //			if ($doEdit && $tableID == 'dragDrop_tt_news_cat') {
         //				$dstId = intval(GeneralUtility::_GP('dstId'));
         //				$menuItems['moveinto'] = $this->dragDrop_moveCategory($srcId,$dstId);
         //				$menuItems['copyinto'] = $this->dragDrop_copyCategory($srcId,$dstId);
         //			}
         if ($tableID == 'tt_news_cat_CM') {
             $menuItems = array();
             if ($doEdit) {
                 $menuItems['edit'] = $this->DB_edit($table, $srcId);
                 $menuItems['new'] = $this->DB_new($table, $rec);
                 $menuItems['newsub'] = $this->DB_new($table, $rec, true);
             }
             $menuItems['info'] = $this->backRef->DB_info($table, $srcId);
             if ($doEdit) {
                 $menuItems['hide'] = $this->DB_hideUnhide($table, $rec, 'hidden');
                 $elInfo = array(GeneralUtility::fixed_lgd_cs(BackendUtility::getRecordTitle('tt_news_cat', $rec), $this->beUser->uc['titleLen']));
                 $menuItems['spacer2'] = 'spacer';
                 $menuItems['delete'] = $this->DB_delete($table, $srcId, $elInfo);
             }
         }
     }
     return $menuItems;
 }
 /**
  * @test
  */
 public function addDataSetsUserPermissionsOnPageForNewContentRecord()
 {
     $input = ['tableName' => 'tt_content', 'command' => 'new', 'vanillaUid' => 123, 'parentPageRow' => ['uid' => 123, 'pid' => 321]];
     $this->beUserProphecy->isAdmin()->willReturn(false);
     $this->beUserProphecy->check('tables_modify', $input['tableName'])->willReturn(true);
     $this->beUserProphecy->calcPerms($input['parentPageRow'])->willReturn(Permission::CONTENT_EDIT);
     $this->beUserProphecy->recordEditAccessInternals($input['tableName'], Argument::cetera())->willReturn(true);
     $result = $this->subject->addData($input);
     $this->assertSame(Permission::CONTENT_EDIT, $result['userPermissionOnPage']);
 }
Пример #3
0
 /**
  * Make 2nd level clickmenu (only for DBmenus)
  *
  * @param string $table Table name
  * @param int $uid UID for the current record.
  * @return string HTML content
  */
 public function printNewDBLevel($table, $uid)
 {
     $localItems = [];
     $uid = (int) $uid;
     // Setting internal record to the table/uid :
     $this->rec = BackendUtility::getRecordWSOL($table, $uid);
     $menuItems = array();
     $root = 0;
     // Rootlevel
     if ($table === 'pages' && $uid === 0) {
         $root = 1;
     }
     // If record was found, check permissions and get menu items.
     if (is_array($this->rec) || $root) {
         $lCP = $this->backendUser->calcPerms(BackendUtility::getRecord('pages', $table === 'pages' ? (int) $this->rec['uid'] : (int) $this->rec['pid']));
         // Edit:
         if (!$root && ($this->backendUser->isPSet($lCP, $table, 'edit') || $this->backendUser->isPSet($lCP, $table, 'editcontent'))) {
             $this->editOK = true;
         }
         $menuItems = $this->processingByExtClassArray($menuItems, $table, $uid);
     }
     $subname = GeneralUtility::_GP('subname');
     if ($subname === 'moreoptions') {
         // If the page can be edited, then show this:
         if ($this->editOK) {
             if (($table === 'pages' || $table === 'tt_content') && !in_array('move_wizard', $this->disabledItems, true)) {
                 $localItems['move_wizard'] = $this->DB_moveWizard($table, $uid, $this->rec);
             }
             if (($table === 'pages' || $table === 'tt_content') && !in_array('new_wizard', $this->disabledItems, true)) {
                 $localItems['new_wizard'] = $this->DB_newWizard($table, $uid, $this->rec);
             }
             if ($table === 'pages' && !in_array('perms', $this->disabledItems, true) && $this->backendUser->check('modules', 'system_BeuserTxPermission')) {
                 $localItems['perms'] = $this->DB_perms($table, $uid, $this->rec);
             }
             if (!in_array('db_list', $this->disabledItems, true) && $this->backendUser->check('modules', 'web_list')) {
                 $localItems['db_list'] = $this->DB_db_list($table, $uid, $this->rec);
             }
         }
         // Temporary mount point item:
         if ($table === 'pages') {
             $localItems['temp_mount_point'] = $this->DB_tempMountPoint($uid);
         }
         // Merge the locally created items into the current menu items passed to this function.
         $menuItems = array_merge($menuItems, $localItems);
     }
     // Return the printed elements:
     if (!is_array($menuItems)) {
         $menuItems = array();
     }
     return $this->printItems($menuItems);
 }