[TYPO3-dev] Extending sys_file_metadata/permission problems

Frank Schüßler typo3 at frankschuessler.de
Mon Apr 27 21:51:40 CEST 2015


Hi David,

after spending a bit more time in investigating the cause of that problem i did find a suitable solution for me. 
But i patched the core what worked for me in this project. I would rather have used a hook or xclass, but the file i have modified did not offer an mechanism for that if I am not mistaken...

In the end the problem is part of creating inline Elements in root node as i have expected in my first post which is done in class /typo3/sysext/backend/Classes/Form/Element/InlineElement.php.
I did wrote a special config Flag for userTsConfig which is called "options.sysFileReference.enableOnRootPage=1" and modified two functions in that class:
Somewehre around line 2113:
[code]
	public function checkAccess($cmd, $table, $theUid) {
		// Checking if the user has permissions? (Only working as a precaution, because the final permission check is always down in TCE. But it's good to notify the user on beforehand...)
		// First, resetting flags.
		$hasAccess = 0;
		// Admin users always have access:
		if ($GLOBALS['BE_USER']->isAdmin()||$GLOBALS['BE_USER']->userTS['options.']['sysFileReference.']['enableOnRootPage']) {
			return TRUE;
		}
// ---8<-- snip---
[/code]
and around line 651: 
[code]
	public function renderForeignRecordHeaderControl($parentUid, $foreign_table, $rec, $config = array(), $isVirtualRecord = FALSE) {
		// Initialize:
		$cells = array();
		$isNewItem = substr($rec['uid'], 0, 3) == 'NEW';
		$isParentExisting = MathUtility::canBeInterpretedAsInteger($parentUid);
		$tcaTableCtrl = &$GLOBALS['TCA'][$foreign_table]['ctrl'];
		$tcaTableCols = &$GLOBALS['TCA'][$foreign_table]['columns'];
		$isPagesTable = $foreign_table == 'pages' ? TRUE : FALSE;
		$isOnSymmetricSide = RelationHandler::isOnSymmetricSide($parentUid, $config, $rec);
		$enableManualSorting = $tcaTableCtrl['sortby'] || $config['MM'] || !$isOnSymmetricSide && $config['foreign_sortby'] || $isOnSymmetricSide && $config['symmetric_sortby'] ? TRUE : FALSE;
		$nameObject = $this->inlineNames['object'];
		$nameObjectFt = $nameObject . self::Structure_Separator . $foreign_table;
		$nameObjectFtId = $nameObjectFt . self::Structure_Separator . $rec['uid'];
		/**
		 * Patch for getting sys_file_references working
		 * Setting User Rights to admin if config is set!
		 * @TODO
		 */
		if($GLOBALS['BE_USER']->userTS['options.']['sysFileReference.']['enableOnRootPage']==1){
			$calcPerms = 31;
		}else {
			$calcPerms = $GLOBALS['BE_USER']->calcPerms(BackendUtility::readPageAccess($rec['pid'], $GLOBALS['BE_USER']->getPagePermsClause(1)));
		}
// ---8<-- snip---
[/code]

As you can see i did set the permissions to admin rights in that case...

Hope  that helps for you,
cheers,
Frank


Quote: David Zeiler (krayt23) wrote on Mon, 27 April 2015 19:02
----------------------------------------------------
> Hi,
> 
> i have the same problem. Did you find a solution?
> 
> 
> 
> --
> View this message in context: http://typo3.3.n7.nabble.com/Extending-sys-file-metadata-permission-problems-tp272771p274647.html
> Sent from the TYPO3 Dev mailing list archive at Nabble.com.
----------------------------------------------------




More information about the TYPO3-dev mailing list