本文整理汇总了PHP中TYPO3\CMS\Core\Authentication\BackendUserAuthentication::calcPerms方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUserAuthentication::calcPerms方法的具体用法?PHP BackendUserAuthentication::calcPerms怎么用?PHP BackendUserAuthentication::calcPerms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Authentication\BackendUserAuthentication
的用法示例。
在下文中一共展示了BackendUserAuthentication::calcPerms方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
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;
}
示例2: addDataSetsUserPermissionsOnPageForNewContentRecord
/**
* @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: printNewDBLevel
/**
* 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);
}