diff --git a/js/service/BoardService.js b/js/service/BoardService.js index 1ebb9ef3e..d41c024c0 100644 --- a/js/service/BoardService.js +++ b/js/service/BoardService.js @@ -192,8 +192,8 @@ app.factory('BoardService', function(ApiService, $http, $q){ return this.getCurrent().permissions['PERMISSION_EDIT']; }; - BoardService.prototype.canManage = function(board = null) { - if(board !== null) { + BoardService.prototype.canManage = function(board) { + if(board !== null && board !== undefined) { return board.permissions['PERMISSION_MANAGE']; } if(!this.getCurrent() || !this.getCurrent().permissions) { diff --git a/lib/Service/BoardService.php b/lib/Service/BoardService.php index e7037553c..4387ab9eb 100644 --- a/lib/Service/BoardService.php +++ b/lib/Service/BoardService.php @@ -87,6 +87,13 @@ class BoardService { $this->boardMapper->mapAcl($acl); } } + $permissions = $this->permissionService->matchPermissions($board); + $board->setPermissions([ + 'PERMISSION_READ' => $permissions[Acl::PERMISSION_READ], + 'PERMISSION_EDIT' => $permissions[Acl::PERMISSION_EDIT], + 'PERMISSION_MANAGE' => $permissions[Acl::PERMISSION_MANAGE], + 'PERMISSION_SHARE' => $permissions[Acl::PERMISSION_SHARE] + ]); return $board; } diff --git a/templates/part.board.mainView.php b/templates/part.board.mainView.php index e4f400885..2418c45f8 100644 --- a/templates/part.board.mainView.php +++ b/templates/part.board.mainView.php @@ -64,10 +64,7 @@ - -
- -
+
  • t('Sharing')); ?>
  • @@ -90,7 +91,7 @@
    -

    +

    diff --git a/templates/part.boardlist.php b/templates/part.boardlist.php index 35380a435..919ca9746 100644 --- a/templates/part.boardlist.php +++ b/templates/part.boardlist.php @@ -14,7 +14,7 @@ - {{ b.title }} + {{ b.title }}
    @@ -23,7 +23,7 @@
    -
    +
    diff --git a/tests/unit/Db/BoardTest.php b/tests/unit/Db/BoardTest.php index 7cbb11d50..3874003d5 100644 --- a/tests/unit/Db/BoardTest.php +++ b/tests/unit/Db/BoardTest.php @@ -21,6 +21,8 @@ class BoardTest extends \PHPUnit_Framework_TestCase { 'owner' => "admin", 'color' => "000000", 'labels' => array(), + 'permissions' => [], + 'deletedAt' => 0, 'acl' => array(), 'archived' => false ], $board->jsonSerialize()); @@ -35,6 +37,8 @@ class BoardTest extends \PHPUnit_Framework_TestCase { 'owner' => "admin", 'color' => "000000", 'labels' => array("foo", "bar"), + 'permissions' => [], + 'deletedAt' => 0, 'acl' => array(), 'archived' => false ], $board->jsonSerialize()); @@ -56,6 +60,8 @@ class BoardTest extends \PHPUnit_Framework_TestCase { 'owner' => "admin", 'color' => "000000", 'labels' => array(), + 'permissions' => [], + 'deletedAt' => 0, 'acl' => array(), 'archived' => false, 'shared' => 1, diff --git a/tests/unit/Service/BoardServiceTest.php b/tests/unit/Service/BoardServiceTest.php index 7ff2ed004..86922344c 100644 --- a/tests/unit/Service/BoardServiceTest.php +++ b/tests/unit/Service/BoardServiceTest.php @@ -148,10 +148,7 @@ class BoardServiceTest extends \Test\TestCase { $this->boardMapper->expects($this->once()) ->method('find') ->willReturn($board); - $this->boardMapper->expects($this->once()) - ->method('delete') - ->willReturn(1); - $this->assertEquals(1, $this->service->delete(123)); + $this->assertEquals($board, $this->service->delete(123)); } public function testAddAcl() {