Skip to content

Commit

Permalink
[TASK] Remove unused workspace-related methods
Browse files Browse the repository at this point in the history
Due to the removal of branch-based versioning in TYPO3 v8,
there are two methods that can be removed now (as they
have been marked as internal in TYPO3 v10).

* BackendUserAuthentication->workspaceAllowLiveRecordsInPID
* BackendUserAuthentication->workspaceCreateNewRecord

Resolves: #92290
Releases: master
Change-Id: I634fd509847c29b17ad0c9f366557f34222bd5dc
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65702
Tested-by: Oliver Bartsch <bo@cedev.de>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Oliver Bartsch <bo@cedev.de>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Björn Jacob <bjoern.jacob@tritum.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
  • Loading branch information
bmack authored and georgringer committed Sep 11, 2020
1 parent 0f30a0e commit d14c03d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 51 deletions.
Expand Up @@ -988,36 +988,6 @@ public function workspaceCannotEditOfflineVersion($table, $recData)
return 'No record';
}

/**
* Check if "live" records from $table may be created or edited in this PID.
* If the answer is FALSE it means the only valid way to create or edit records in the PID is by versioning
* If the answer is 1 or 2 it means it is OK to create a record, if -1 it means that it is OK in terms
* of versioning because the element was within a versionized branch
* but NOT ok in terms of the state the root point had!
*
* Note: this method is not in use anymore and will likely be deprecated in future TYPO3 versions.
*
* @param int $pid PID value to check for. OBSOLETE!
* @param string $table Table name
* @return mixed Returns FALSE if a live record cannot be created and must be versionized in order to do so. 2 means a) Workspace is "Live" or workspace allows "live edit" of records from non-versionized tables (and the $table is not versionizable). 1 and -1 means the pid is inside a versionized branch where -1 means that the branch-point did NOT allow a new record according to its state.
* @internal should only be used from within TYPO3 Core
*/
public function workspaceAllowLiveRecordsInPID($pid, $table)
{
// Always for Live workspace AND if live-edit is enabled
// and tables are completely without versioning it is ok as well.
if (
$this->workspace === 0
|| $this->workspaceRec['live_edit'] && !BackendUtility::isTableWorkspaceEnabled($table)
|| $GLOBALS['TCA'][$table]['ctrl']['versioningWS_alwaysAllowLiveEdit']
) {
// OK to create for this table.
return 2;
}
// If the answer is FALSE it means the only valid way to create or edit records in the PID is by versioning
return false;
}

/**
* Checks if a record is allowed to be edited in the current workspace.
* This is not bound to an actual record, but to the mere fact if the user is in a workspace
Expand Down Expand Up @@ -1046,26 +1016,6 @@ public function workspaceAllowsLiveEditingInTable(string $table): bool
return false;
}

/**
* Evaluates if a record from $table can be created in $pid
*
* Note: this method is not in use anymore and will likely be deprecated in future TYPO3 versions.
*
* @param int $pid Page id. This value must be the _ORIG_uid if available: So when you have pages versionized as "page" or "element" you must supply the id of the page version in the workspace!
* @param string $table Table name
* @return bool TRUE if OK.
* @internal should only be used from within TYPO3 Core
*/
public function workspaceCreateNewRecord($pid, $table)
{
// If LIVE records cannot be created due to workspace restrictions, prepare creation of placeholder-record
if (!$this->workspaceAllowsLiveEditingInTable($table) && !BackendUtility::isTableWorkspaceEnabled($table)) {
// So, if no live records were allowed, we have to create a new version of this record
return false;
}
return true;
}

/**
* Evaluates if a record from $table can be created. If the table is not set up for versioning,
* and the "live edit" flag of the page is set, return false. In live workspace this is always true,
Expand Down
1 change: 0 additions & 1 deletion typo3/sysext/core/Classes/DataHandling/DataHandler.php
Expand Up @@ -6142,7 +6142,6 @@ public function checkRecordUpdateAccess($table, $id, $data = false, $hookObjects

/**
* Checks if user may insert a record from $insertTable on $pid
* Does not check for workspace, use BE_USER->workspaceAllowLiveRecordsInPID for this in addition to this function call.
*
* @param string $insertTable Tablename to check
* @param int $pid Integer PID
Expand Down

0 comments on commit d14c03d

Please sign in to comment.