Skip to content

Commit 5b5d11b

Browse files
committed
Merge branch 'pu/pm/DelegatedUpdateCreateRightFromTbToAdb' into '2024.11'
tweak(TB/Adb) move right upgrade update/create from TB to Adb controller See merge request tine20/tine20!5380
2 parents b0ddd96 + cb19271 commit 5b5d11b

File tree

2 files changed

+24
-14
lines changed

2 files changed

+24
-14
lines changed

tine20/Addressbook/Controller/Contact.php

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @subpackage Controller
77
* @license http://www.gnu.org/licenses/agpl.html AGPL Version 3
88
* @author Lars Kneschke <[email protected]>
9-
* @copyright Copyright (c) 2007-2023 Metaways Infosystems GmbH (http://www.metaways.de)
9+
* @copyright Copyright (c) 2007-2024 Metaways Infosystems GmbH (http://www.metaways.de)
1010
*
1111
*/
1212

@@ -1689,4 +1689,27 @@ public static function modelConfigHook(array &$_fields, Tinebase_ModelConfigurat
16891689
}
16901690
$mc->setJsonExpander($expanderDef);
16911691
}
1692+
1693+
protected function _checkDelegatedGrant(Tinebase_Record_Interface $_record,
1694+
string $_action,
1695+
bool $_throw,
1696+
string $_errorMessage,
1697+
?Tinebase_Record_Interface $_oldRecord): bool
1698+
{
1699+
$tead = null;
1700+
try {
1701+
if (parent::_checkDelegatedGrant($_record, $_action, $_throw, $_errorMessage, $_oldRecord)) {
1702+
return true;
1703+
}
1704+
} catch (Tinebase_Exception_AccessDenied $tead) {}
1705+
1706+
if ($_action === self::ACTION_CREATE) {
1707+
return parent::_checkDelegatedGrant($_record, self::ACTION_UPDATE, $_throw, $_errorMessage, $_oldRecord);
1708+
}
1709+
1710+
if (null !== $tead) {
1711+
throw $tead;
1712+
}
1713+
return false;
1714+
}
16921715
}

tine20/Tinebase/Controller/Record/Abstract.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2598,19 +2598,6 @@ protected function _checkDelegatedGrant(Tinebase_Record_Interface $_record,
25982598
}
25992599
return false;
26002600
}
2601-
if ($_action === self::ACTION_CREATE) {
2602-
// check CREATE - if it does not suffice, UPDATE is ok, too
2603-
if ($ctrl->checkGrant(
2604-
$_record->{$mc->delegateAclField} instanceof Tinebase_Record_Interface ?
2605-
$_record->{$mc->delegateAclField} :
2606-
$ctrl->get($_record->{$mc->delegateAclField}),
2607-
$_action, false, $_errorMessage, $_oldRecord?->{$mc->delegateAclField}
2608-
)) {
2609-
return true;
2610-
} else {
2611-
$_action = self::ACTION_UPDATE;
2612-
}
2613-
}
26142601

26152602
return $ctrl->checkGrant(
26162603
$_record->{$mc->delegateAclField} instanceof Tinebase_Record_Interface ?

0 commit comments

Comments
 (0)