本文整理汇总了PHP中TYPO3\CMS\Core\Authentication\BackendUserAuthentication::check方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUserAuthentication::check方法的具体用法?PHP BackendUserAuthentication::check怎么用?PHP BackendUserAuthentication::check使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Authentication\BackendUserAuthentication
的用法示例。
在下文中一共展示了BackendUserAuthentication::check方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addDataWithInlineTypeAndModifyRightsWillAddChildren
/**
* @test
*/
public function addDataWithInlineTypeAndModifyRightsWillAddChildren()
{
$input = ['processedTca' => ['columns' => ['aField' => ['config' => ['type' => 'inline', 'foreign_table' => 'aForeignTableName']]]]];
$this->beUserProphecy->check('tables_modify', $input['processedTca']['columns']['aField']['config']['foreign_table'])->shouldBeCalled()->willReturn(true);
$expected = $this->defaultConfig;
$expected['processedTca']['columns']['aField']['children'] = [];
$this->assertEquals($expected, $this->subject->addData($input));
}
示例2: checkModAccess
/**
* Returns TRUE if the internal BE_USER has access to the module $name with $MCONF (based on security level set for that module)
*
* @param string $name Module name
* @param array $MCONF MCONF array (module configuration array) from the modules conf.php file (contains settings about what access level the module has)
* @return boolean TRUE if access is granted for $this->BE_USER
* @todo Define visibility
*/
public function checkModAccess($name, $MCONF)
{
if ($MCONF['access']) {
$access = strtolower($MCONF['access']);
// Checking if admin-access is required
// If admin-permissions is required then return TRUE if user is admin
if (strstr($access, 'admin')) {
if ($this->BE_USER->isAdmin()) {
return TRUE;
}
}
// This will add modules to the select-lists of user and groups
if (strstr($access, 'user')) {
$this->modListUser[] = $name;
}
if (strstr($access, 'group')) {
$this->modListGroup[] = $name;
}
// This checks if a user is permitted to access the module
if ($this->BE_USER->isAdmin() || $this->BE_USER->check('modules', $name)) {
return TRUE;
}
} else {
return TRUE;
}
}
示例3: addDataThrowsExceptionForNewRecordsOnRootLevelWithoutAdminPermissions
/**
* @test
*/
public function addDataThrowsExceptionForNewRecordsOnRootLevelWithoutAdminPermissions()
{
$input = ['tableName' => 'pages', 'command' => 'new', 'vanillaUid' => 123, 'parentPageRow' => null];
$this->beUserProphecy->isAdmin()->willReturn(false);
$this->beUserProphecy->check('tables_modify', $input['tableName'])->willReturn(true);
$this->setExpectedException(\RuntimeException::class, $this->anything(), 1437745221);
$this->subject->addData($input);
}
示例4: printFileClickMenu
/**
* Make 1st level clickmenu:
*
* @param string $combinedIdentifier The combined identifier
* @return string HTML content
* @see \TYPO3\CMS\Core\Resource\ResourceFactory::retrieveFileOrFolderObject()
*/
public function printFileClickMenu($combinedIdentifier)
{
$identifier = '';
$menuItems = array();
$combinedIdentifier = rawurldecode($combinedIdentifier);
$fileObject = ResourceFactory::getInstance()->retrieveFileOrFolderObject($combinedIdentifier);
if ($fileObject) {
$folder = false;
$isStorageRoot = false;
$isOnline = true;
$userMayViewStorage = false;
$userMayEditStorage = false;
$identifier = $fileObject->getCombinedIdentifier();
if ($fileObject instanceof Folder) {
$folder = true;
if ($fileObject->getIdentifier() === $fileObject->getStorage()->getRootLevelFolder()->getIdentifier()) {
$isStorageRoot = true;
if ($this->backendUser->check('tables_select', 'sys_file_storage')) {
$userMayViewStorage = true;
}
if ($this->backendUser->check('tables_modify', 'sys_file_storage')) {
$userMayEditStorage = true;
}
}
if (!$fileObject->getStorage()->isOnline()) {
$isOnline = false;
}
}
// Hide
if (!in_array('hide', $this->disabledItems, true) && $isStorageRoot && $userMayEditStorage) {
$record = BackendUtility::getRecord('sys_file_storage', $fileObject->getStorage()->getUid());
$menuItems['hide'] = $this->DB_changeFlag('sys_file_storage', $record, 'is_online', $this->label($record['is_online'] ? 'offline' : 'online'));
}
// Edit
if (!in_array('edit', $this->disabledItems, true) && $fileObject->checkActionPermission('write')) {
if (!$folder && !$isStorageRoot && $fileObject->isIndexed() && $this->backendUser->check('tables_modify', 'sys_file_metadata')) {
$metaData = $fileObject->_getMetaData();
$menuItems['edit2'] = $this->DB_edit('sys_file_metadata', $metaData['uid']);
}
if (!$folder && GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $fileObject->getExtension()) && $fileObject->checkActionPermission('write')) {
$menuItems['edit'] = $this->FILE_launch($identifier, 'file_edit', 'editcontent', 'actions-page-open');
} elseif ($isStorageRoot && $userMayEditStorage) {
$menuItems['edit'] = $this->DB_edit('sys_file_storage', $fileObject->getStorage()->getUid());
}
}
// Rename
if (!in_array('rename', $this->disabledItems, true) && !$isStorageRoot && $fileObject->checkActionPermission('rename')) {
$menuItems['rename'] = $this->FILE_launch($identifier, 'file_rename', 'rename', 'actions-edit-rename');
}
// Upload
if (!in_array('upload', $this->disabledItems, true) && $folder && $isOnline && $fileObject->checkActionPermission('write')) {
$menuItems['upload'] = $this->FILE_launch($identifier, 'file_upload', 'upload', 'actions-edit-upload');
}
// New
if (!in_array('new', $this->disabledItems, true) && $folder && $isOnline && $fileObject->checkActionPermission('write')) {
$menuItems['new'] = $this->FILE_launch($identifier, 'file_newfolder', 'new', 'actions-document-new');
}
// Info
if (!in_array('info', $this->disabledItems, true) && $fileObject->checkActionPermission('read')) {
if ($isStorageRoot && $userMayViewStorage) {
$menuItems['info'] = $this->DB_info('sys_file_storage', $fileObject->getStorage()->getUid());
} elseif (!$folder) {
$menuItems['info'] = $this->fileInfo($identifier);
}
}
$menuItems[] = 'spacer';
// Copy:
if (!in_array('copy', $this->disabledItems, true) && !$isStorageRoot && $fileObject->checkActionPermission('read')) {
$menuItems['copy'] = $this->FILE_copycut($identifier, 'copy');
}
// Cut:
if (!in_array('cut', $this->disabledItems, true) && !$isStorageRoot && $fileObject->checkActionPermission('move')) {
$menuItems['cut'] = $this->FILE_copycut($identifier, 'cut');
}
// Paste:
$elFromAllTables = count($this->clipObj->elFromTable('_FILE'));
if (!in_array('paste', $this->disabledItems, true) && $elFromAllTables && $folder && $fileObject->checkActionPermission('write')) {
$elArr = $this->clipObj->elFromTable('_FILE');
$selItem = reset($elArr);
$clickedFileOrFolder = ResourceFactory::getInstance()->retrieveFileOrFolderObject($combinedIdentifier);
$fileOrFolderInClipBoard = ResourceFactory::getInstance()->retrieveFileOrFolderObject($selItem);
$elInfo = array($fileOrFolderInClipBoard->getName(), $clickedFileOrFolder->getName(), $this->clipObj->currentMode());
if (!$fileOrFolderInClipBoard instanceof Folder || !$fileOrFolderInClipBoard->getStorage()->isWithinFolder($fileOrFolderInClipBoard, $clickedFileOrFolder)) {
$menuItems['pasteinto'] = $this->FILE_paste($identifier, $selItem, $elInfo);
}
}
$menuItems[] = 'spacer';
// Delete:
if (!in_array('delete', $this->disabledItems, true) && $fileObject->checkActionPermission('delete')) {
if ($isStorageRoot && $userMayEditStorage) {
$elInfo = array(GeneralUtility::fixed_lgd_cs($fileObject->getStorage()->getName(), $this->backendUser->uc['titleLen']));
$menuItems['delete'] = $this->DB_delete('sys_file_storage', $fileObject->getStorage()->getUid(), $elInfo);
} elseif (!$isStorageRoot) {
//.........这里部分代码省略.........