Make queries work with the new base mapper
Signed-off-by: Julius Härtl <jus@bitgrid.net> fix: conflicts
This commit is contained in:
@@ -63,19 +63,18 @@ class AclMapper extends DeckMapper implements IPermissionMapper {
|
||||
* @param $newOwnerId
|
||||
* @return void
|
||||
*/
|
||||
public function transferOwnership($ownerId, $newOwnerId) {
|
||||
public function transferOwnership($boardId, $ownerId, $newOwnerId) {
|
||||
$params = [
|
||||
'owner' => $ownerId,
|
||||
'newOwner' => $newOwnerId,
|
||||
'type' => Acl::PERMISSION_TYPE_USER
|
||||
'type' => Acl::PERMISSION_TYPE_USER,
|
||||
'boardId' => $boardId
|
||||
];
|
||||
|
||||
// Drop existing ACL rules for the new owner
|
||||
$sql = "DELETE FROM `{$this->tableName}`
|
||||
WHERE `participant` = :newOwner
|
||||
AND `type` = :type
|
||||
AND EXISTS (SELECT `id` FROM (SELECT `id` FROM `{$this->tableName}`
|
||||
WHERE `participant` = :newOwner AND `type` = :type) as tmp)";
|
||||
AND `board_id` = :boardId";
|
||||
$stmt = $this->execute($sql, $params);
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
|
||||
@@ -157,16 +157,17 @@ class AssignmentMapper extends QBMapper implements IPermissionMapper {
|
||||
'newOwner' => $newOwnerId,
|
||||
'type' => AssignedUsers::TYPE_USER
|
||||
];
|
||||
$sql = "DELETE FROM `{$this->tableName}` WHERE `participant` = :newOwner AND `type`= :type";
|
||||
$stmt = $this->execute($sql, $params);
|
||||
$qb = $this->db->getQueryBuilder();
|
||||
$sql = "DELETE FROM `*PREFIX*{$this->tableName}` WHERE `participant` = :newOwner AND `type`= :type";
|
||||
$stmt = $this->db->executeQuery($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);
|
||||
$sql = "UPDATE `*PREFIX*{$this->tableName}` SET `participant` = :newOwner WHERE `participant` = :owner AND `type`= :type";
|
||||
$stmt = $this->db->executeQuery($sql, $params);
|
||||
$stmt->closeCursor();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user