Skip to content
Snippets Groups Projects
Commit ec7c18e3 authored by Markus Klein's avatar Markus Klein Committed by Susanne Moog
Browse files

[BUGFIX] Allow editing of shortcuts for non-admin users

Resolves: #60254
Releases: master, 6.2
Change-Id: Ie5e65ab761e8ce018a4d71daa39495fae3ad3572
Reviewed-on: http://review.typo3.org/41714


Reviewed-by: default avatarFrederic Gaus <frederic.gaus@flagbit.de>
Reviewed-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: default avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: default avatarSusanne Moog <typo3@susannemoog.de>
Tested-by: default avatarSusanne Moog <typo3@susannemoog.de>
parent 4248fb83
Branches
Tags
......@@ -573,23 +573,21 @@ class ShortcutToolbarItem implements ToolbarItemInterface {
$shortcutId = (int)GeneralUtility::_POST('shortcutId');
$shortcutName = strip_tags(GeneralUtility::_POST('shortcutTitle'));
$shortcutGroupId = (int)GeneralUtility::_POST('shortcutGroup');
if ($shortcutGroupId > 0 || $backendUser->isAdmin()) {
// Users can delete only their own shortcuts (except admins)
$addUserWhere = !$backendUser->isAdmin() ? ' AND userid=' . (int)$backendUser->user['uid'] : '';
$fieldValues = array(
'description' => $shortcutName,
'sc_group' => $shortcutGroupId
);
if ($fieldValues['sc_group'] < 0 && !$backendUser->isAdmin()) {
$fieldValues['sc_group'] = 0;
}
$databaseConnection->exec_UPDATEquery('sys_be_shortcuts', 'uid=' . $shortcutId . $addUserWhere, $fieldValues);
$affectedRows = $databaseConnection->sql_affected_rows();
if ($affectedRows == 1) {
$ajaxObj->addContent('shortcut', $shortcutName);
} else {
$ajaxObj->addContent('shortcut', 'failed');
}
// Users can only modify their own shortcuts (except admins)
$addUserWhere = !$backendUser->isAdmin() ? ' AND userid=' . (int)$backendUser->user['uid'] : '';
$fieldValues = array(
'description' => $shortcutName,
'sc_group' => $shortcutGroupId
);
if ($fieldValues['sc_group'] < 0 && !$backendUser->isAdmin()) {
$fieldValues['sc_group'] = 0;
}
$databaseConnection->exec_UPDATEquery('sys_be_shortcuts', 'uid=' . $shortcutId . $addUserWhere, $fieldValues);
$affectedRows = $databaseConnection->sql_affected_rows();
if ($affectedRows == 1) {
$ajaxObj->addContent('shortcut', $shortcutName);
} else {
$ajaxObj->addContent('shortcut', 'failed');
}
$ajaxObj->setContentFormat('plain');
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment