Transfer deck ownership even if target user already participant of a board
https://github.com/nextcloud/deck/pull/1955#issuecomment-640392715 Signed-off-by: Sergey Shliakhov <husband.sergey@gmail.com>
This commit is contained in:
committed by
Julius Härtl
parent
a0f93a81d2
commit
bdf4631504
@@ -154,10 +154,17 @@ class AssignmentMapper extends QBMapper implements IPermissionMapper {
|
||||
*/
|
||||
public function transferOwnership($ownerId, $newOwnerId) {
|
||||
$params = [
|
||||
'owner' => $ownerId,
|
||||
'newOwner' => $newOwnerId,
|
||||
'type' => AssignedUsers::TYPE_USER
|
||||
];
|
||||
$sql = "DELETE FROM `{$this->tableName}` WHERE `participant` = :newOwner AND `type`= :type";
|
||||
$stmt = $this->execute($sql, $params);
|
||||
$stmt->closeCursor();
|
||||
$params = [
|
||||
'owner' => $ownerId,
|
||||
'newOwner' => $newOwnerId,
|
||||
'type' => AssignedUsers::TYPE_USER
|
||||
];
|
||||
$sql = "UPDATE `{$this->tableName}` SET `participant` = :newOwner WHERE `participant` = :owner AND `type`= :type";
|
||||
$stmt = $this->execute($sql, $params);
|
||||
$stmt->closeCursor();
|
||||
|
||||
Reference in New Issue
Block a user