committed by
Julius Härtl
parent
691abb02d8
commit
9403fb1759
@@ -27,6 +27,8 @@ use OCA\Deck\Db\Acl;
|
|||||||
use OCA\Deck\Service\BoardService;
|
use OCA\Deck\Service\BoardService;
|
||||||
use OCA\Deck\Service\PermissionService;
|
use OCA\Deck\Service\PermissionService;
|
||||||
use OCP\AppFramework\ApiController;
|
use OCP\AppFramework\ApiController;
|
||||||
|
use OCP\AppFramework\Http;
|
||||||
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
class BoardController extends ApiController {
|
class BoardController extends ApiController {
|
||||||
@@ -163,7 +165,11 @@ class BoardController extends ApiController {
|
|||||||
* @param $newOwner
|
* @param $newOwner
|
||||||
* * @return null|void
|
* * @return null|void
|
||||||
*/
|
*/
|
||||||
public function transferOwner($boardId, $owner, $newOwner) {
|
public function transferOwner(int $boardId, string $newOwner): DataResponse {
|
||||||
return $this->boardService->transferOwnership($owner, $newOwner);
|
if ($this->permissionService->userIsBoardOwner($boardId, $this->userId)) {
|
||||||
|
return new DataResponse($this->boardService->transferBoardOwnership($boardId, $newOwner), HTTP::STATUS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new DataResponse([], HTTP::STATUS_UNAUTHORIZED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -743,12 +743,6 @@ class BoardService {
|
|||||||
$this->boardsCache = null;
|
$this->boardsCache = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getBoardOwner($boardId) {
|
|
||||||
$board = $this->boardMapper->find($boardId);
|
|
||||||
|
|
||||||
return $board->getOwner();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clean a given board data from the Cache
|
* Clean a given board data from the Cache
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
<ActionCheckbox v-if="canManage" :checked="acl.permissionManage" @change="clickManageAcl(acl)">
|
<ActionCheckbox v-if="canManage" :checked="acl.permissionManage" @change="clickManageAcl(acl)">
|
||||||
{{ t('deck', 'Can manage') }}
|
{{ t('deck', 'Can manage') }}
|
||||||
</ActionCheckbox>
|
</ActionCheckbox>
|
||||||
<ActionCheckbox v-if="canManage" :checked="acl.owner" @change="clickTranserOwner(acl.participant.uid)">
|
<ActionCheckbox v-if="isCurrentUser(board.owner.uid)" :checked="acl.owner" @change="clickTransferOwner(acl.participant.uid)">
|
||||||
{{ t('deck', 'Owner') }}
|
{{ t('deck', 'Owner') }}
|
||||||
</ActionCheckbox>
|
</ActionCheckbox>
|
||||||
<ActionButton v-if="canManage" icon="icon-delete" @click="clickDeleteAcl(acl)">
|
<ActionButton v-if="canManage" icon="icon-delete" @click="clickDeleteAcl(acl)">
|
||||||
@@ -198,7 +198,7 @@ export default {
|
|||||||
clickDeleteAcl(acl) {
|
clickDeleteAcl(acl) {
|
||||||
this.$store.dispatch('deleteAclFromCurrentBoard', acl)
|
this.$store.dispatch('deleteAclFromCurrentBoard', acl)
|
||||||
},
|
},
|
||||||
clickTranserOwner(newOwner) {
|
clickTransferOwner(newOwner) {
|
||||||
OC.dialogs.confirmDestructive(
|
OC.dialogs.confirmDestructive(
|
||||||
t('deck', 'Are you sure you want to transfer the board {title} for {user} ?', { title: this.board.title, user: newOwner }),
|
t('deck', 'Are you sure you want to transfer the board {title} for {user} ?', { title: this.board.title, user: newOwner }),
|
||||||
t('deck', 'Transfer the board.'),
|
t('deck', 'Transfer the board.'),
|
||||||
@@ -214,8 +214,7 @@ export default {
|
|||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
await this.$store.dispatch('transferOwnership', {
|
await this.$store.dispatch('transferOwnership', {
|
||||||
boardId: this.board.id,
|
boardId: this.board.id,
|
||||||
newOwner,
|
newOwner
|
||||||
owner: this.board.owner.uid,
|
|
||||||
})
|
})
|
||||||
const successMessage = t('deck', 'Transfer the board for {user} successfully', { user: newOwner })
|
const successMessage = t('deck', 'Transfer the board for {user} successfully', { user: newOwner })
|
||||||
showSuccess(successMessage)
|
showSuccess(successMessage)
|
||||||
|
|||||||
Reference in New Issue
Block a user