Rename permissions in backend
This commit is contained in:
@@ -331,12 +331,12 @@
|
|||||||
<length>64</length>
|
<length>64</length>
|
||||||
</field>
|
</field>
|
||||||
<field>
|
<field>
|
||||||
<name>permission_write</name>
|
<name>permission_edit</name>
|
||||||
<type>boolean</type>
|
<type>boolean</type>
|
||||||
<default>false</default>
|
<default>false</default>
|
||||||
</field>
|
</field>
|
||||||
<field>
|
<field>
|
||||||
<name>permission_invite</name>
|
<name>permission_share</name>
|
||||||
<type>boolean</type>
|
<type>boolean</type>
|
||||||
<default>false</default>
|
<default>false</default>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
@@ -130,25 +130,25 @@ class BoardController extends Controller {
|
|||||||
* @param $boardId
|
* @param $boardId
|
||||||
* @param $type
|
* @param $type
|
||||||
* @param $participant
|
* @param $participant
|
||||||
* @param $write
|
* @param $edit
|
||||||
* @param $invite
|
* @param $share
|
||||||
* @param $manage
|
* @param $manage
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
* @return \OCP\AppFramework\Db\Entity
|
||||||
*/
|
*/
|
||||||
public function addAcl($boardId, $type, $participant, $write, $invite, $manage) {
|
public function addAcl($boardId, $type, $participant, $edit, $share, $manage) {
|
||||||
return $this->boardService->addAcl($boardId, $type, $participant, $write, $invite, $manage);
|
return $this->boardService->addAcl($boardId, $type, $participant, $edit, $share, $manage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @NoAdminRequired
|
* @NoAdminRequired
|
||||||
* @param $id
|
* @param $id
|
||||||
* @param $permissionWrite
|
* @param $permissionEdit
|
||||||
* @param $permissionInvite
|
* @param $permissionShare
|
||||||
* @param $permissionManage
|
* @param $permissionManage
|
||||||
* @return \OCP\AppFramework\Db\Entity
|
* @return \OCP\AppFramework\Db\Entity
|
||||||
*/
|
*/
|
||||||
public function updateAcl($id, $permissionWrite, $permissionInvite, $permissionManage) {
|
public function updateAcl($id, $permissionEdit, $permissionShare, $permissionManage) {
|
||||||
return $this->boardService->updateAcl($id, $permissionWrite, $permissionInvite, $permissionManage);
|
return $this->boardService->updateAcl($id, $permissionEdit, $permissionShare, $permissionManage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ class ShareController extends Controller {
|
|||||||
$acl = new Acl();
|
$acl = new Acl();
|
||||||
$acl->setType('group');
|
$acl->setType('group');
|
||||||
$acl->setParticipant($group->getGID());
|
$acl->setParticipant($group->getGID());
|
||||||
$acl->setPermissionWrite(true);
|
$acl->setPermissionEdit(true);
|
||||||
$acl->setPermissionInvite(true);
|
$acl->setPermissionShare(true);
|
||||||
$acl->setPermissionManage(true);
|
$acl->setPermissionManage(true);
|
||||||
$result[] = $acl;
|
$result[] = $acl;
|
||||||
}
|
}
|
||||||
@@ -72,8 +72,8 @@ class ShareController extends Controller {
|
|||||||
$acl = new Acl();
|
$acl = new Acl();
|
||||||
$acl->setType('user');
|
$acl->setType('user');
|
||||||
$acl->setParticipant($user->getUID());
|
$acl->setParticipant($user->getUID());
|
||||||
$acl->setPermissionWrite(true);
|
$acl->setPermissionEdit(true);
|
||||||
$acl->setPermissionInvite(true);
|
$acl->setPermissionShare(true);
|
||||||
$acl->setPermissionManage(true);
|
$acl->setPermissionManage(true);
|
||||||
$result[] = $acl;
|
$result[] = $acl;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,21 +34,21 @@ class Acl extends Entity implements \JsonSerializable {
|
|||||||
protected $participant;
|
protected $participant;
|
||||||
protected $type;
|
protected $type;
|
||||||
protected $boardId;
|
protected $boardId;
|
||||||
protected $permissionWrite;
|
protected $permissionEdit;
|
||||||
protected $permissionInvite;
|
protected $permissionShare;
|
||||||
protected $permissionManage;
|
protected $permissionManage;
|
||||||
protected $owner;
|
protected $owner;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->addType('id','integer');
|
$this->addType('id','integer');
|
||||||
$this->addType('boardId','integer');
|
$this->addType('boardId','integer');
|
||||||
$this->addType('permissionWrite', 'boolean');
|
$this->addType('permissionEdit', 'boolean');
|
||||||
$this->addType('permissionInvite', 'boolean');
|
$this->addType('permissionShare', 'boolean');
|
||||||
$this->addType('permissionManage', 'boolean');
|
$this->addType('permissionManage', 'boolean');
|
||||||
$this->addType('owner', 'boolean');
|
$this->addType('owner', 'boolean');
|
||||||
$this->addRelation('owner');
|
$this->addRelation('owner');
|
||||||
$this->setPermissionWrite(false);
|
$this->setPermissionEdit(false);
|
||||||
$this->setPermissionInvite(false);
|
$this->setPermissionShare(false);
|
||||||
$this->setPermissionManage(false);
|
$this->setPermissionManage(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,9 +57,9 @@ class Acl extends Entity implements \JsonSerializable {
|
|||||||
case Acl::PERMISSION_READ:
|
case Acl::PERMISSION_READ:
|
||||||
return true;
|
return true;
|
||||||
case Acl::PERMISSION_EDIT:
|
case Acl::PERMISSION_EDIT:
|
||||||
return $this->getPermissionWrite();
|
return $this->getPermissionEdit();
|
||||||
case Acl::PERMISSION_SHARE:
|
case Acl::PERMISSION_SHARE:
|
||||||
return $this->getPermissionInvite();
|
return $this->getPermissionShare();
|
||||||
case Acl::PERMISSION_MANAGE:
|
case Acl::PERMISSION_MANAGE:
|
||||||
return $this->getPermissionManage();
|
return $this->getPermissionManage();
|
||||||
}
|
}
|
||||||
@@ -72,8 +72,8 @@ class Acl extends Entity implements \JsonSerializable {
|
|||||||
'participant' => $this->participant,
|
'participant' => $this->participant,
|
||||||
'type' => $this->type,
|
'type' => $this->type,
|
||||||
'boardId' => $this->boardId,
|
'boardId' => $this->boardId,
|
||||||
'permissionWrite' => $this->permissionWrite,
|
'permissionEdit' => $this->permissionEdit,
|
||||||
'permissionInvite' => $this->permissionInvite,
|
'permissionShare' => $this->permissionShare,
|
||||||
'permissionManage' => $this->permissionManage,
|
'permissionManage' => $this->permissionManage,
|
||||||
'owner' => $this->owner
|
'owner' => $this->owner
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class AclMapper extends DeckMapper implements IPermissionMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function findAll($boardId, $limit=null, $offset=null) {
|
public function findAll($boardId, $limit=null, $offset=null) {
|
||||||
$sql = 'SELECT id, board_id, type, participant, permission_write, permission_invite, permission_manage FROM `*PREFIX*deck_board_acl` WHERE `board_id` = ? ';
|
$sql = 'SELECT id, board_id, type, participant, permission_edit, permission_share, permission_manage FROM `*PREFIX*deck_board_acl` WHERE `board_id` = ? ';
|
||||||
return $this->findEntities($sql, [$boardId], $limit, $offset);
|
return $this->findEntities($sql, [$boardId], $limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,20 +5,20 @@
|
|||||||
* @author Julius Härtl <jus@bitgrid.net>
|
* @author Julius Härtl <jus@bitgrid.net>
|
||||||
*
|
*
|
||||||
* @license GNU AGPL version 3 or any later version
|
* @license GNU AGPL version 3 or any later version
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
* License, or (at your option) any later version.
|
* License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OCA\Deck\Db;
|
namespace OCA\Deck\Db;
|
||||||
@@ -35,9 +35,9 @@ class Stack extends Entity implements JsonSerializable {
|
|||||||
protected $order;
|
protected $order;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->addType('id','integer');
|
$this->addType('id', 'integer');
|
||||||
$this->addType('boardId','integer');
|
$this->addType('boardId', 'integer');
|
||||||
$this->addType('order','integer');
|
$this->addType('order', 'integer');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setCards($cards) {
|
public function setCards($cards) {
|
||||||
@@ -45,22 +45,20 @@ class Stack extends Entity implements JsonSerializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function jsonSerialize() {
|
public function jsonSerialize() {
|
||||||
if(!empty($this->cards)) {
|
if (!empty($this->cards)) {
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'title' => $this->title,
|
'title' => $this->title,
|
||||||
'order' => $this->order,
|
'order' => $this->order,
|
||||||
'boardId' => $this->boardId,
|
'boardId' => $this->boardId,
|
||||||
'cards' => $this->cards
|
'cards' => $this->cards
|
||||||
];
|
];
|
||||||
} else {
|
}
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'title' => $this->title,
|
'title' => $this->title,
|
||||||
'order' => $this->order,
|
'order' => $this->order,
|
||||||
'boardId' => $this->boardId
|
'boardId' => $this->boardId
|
||||||
];
|
];
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,23 +104,23 @@ class BoardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function addAcl($boardId, $type, $participant, $write, $invite, $manage) {
|
public function addAcl($boardId, $type, $participant, $edit, $share, $manage) {
|
||||||
$this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_SHARE);
|
$this->permissionService->checkPermission($this->boardMapper, $boardId, Acl::PERMISSION_SHARE);
|
||||||
$acl = new Acl();
|
$acl = new Acl();
|
||||||
$acl->setBoardId($boardId);
|
$acl->setBoardId($boardId);
|
||||||
$acl->setType($type);
|
$acl->setType($type);
|
||||||
$acl->setParticipant($participant);
|
$acl->setParticipant($participant);
|
||||||
$acl->setPermissionWrite($write);
|
$acl->setPermissionEdit($edit);
|
||||||
$acl->setPermissionInvite($invite);
|
$acl->setPermissionShare($share);
|
||||||
$acl->setPermissionManage($manage);
|
$acl->setPermissionManage($manage);
|
||||||
return $this->aclMapper->insert($acl);
|
return $this->aclMapper->insert($acl);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function updateAcl($id, $write, $invite, $manage) {
|
public function updateAcl($id, $edit, $share, $manage) {
|
||||||
$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_SHARE);
|
$this->permissionService->checkPermission($this->boardMapper, $id, Acl::PERMISSION_SHARE);
|
||||||
$acl = $this->aclMapper->find($id);
|
$acl = $this->aclMapper->find($id);
|
||||||
$acl->setPermissionWrite($write);
|
$acl->setPermissionEdit($edit);
|
||||||
$acl->setPermissionInvite($invite);
|
$acl->setPermissionShare($share);
|
||||||
$acl->setPermissionManage($manage);
|
$acl->setPermissionManage($manage);
|
||||||
return $this->aclMapper->update($acl);
|
return $this->aclMapper->update($acl);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,11 +46,11 @@
|
|||||||
<span class="has-tooltip username">
|
<span class="has-tooltip username">
|
||||||
{{ acl.participant }}</span>
|
{{ acl.participant }}</span>
|
||||||
<span class="shareOption" ng-if="boardservice.canManage()">
|
<span class="shareOption" ng-if="boardservice.canManage()">
|
||||||
<input type="checkbox" class="permissions checkbox" id="checkbox-permission-{{ acl.id }}-share" ng-model="acl.permissionInvite" ng-change="aclUpdate(acl)" />
|
<input type="checkbox" class="permissions checkbox" id="checkbox-permission-{{ acl.id }}-share" ng-model="acl.permissionShare" ng-change="aclUpdate(acl)" />
|
||||||
<label for="checkbox-permission-{{ acl.id }}-share"><?php p($l->t('Share')); ?></label>
|
<label for="checkbox-permission-{{ acl.id }}-share"><?php p($l->t('Share')); ?></label>
|
||||||
</span>
|
</span>
|
||||||
<span class="shareOption"ng-if="boardservice.canManage()">
|
<span class="shareOption"ng-if="boardservice.canManage()">
|
||||||
<input type="checkbox" class="permissions checkbox" id="checkbox-permission-{{ acl.id }}-edit" ng-model="acl.permissionWrite" ng-change="aclUpdate(acl)" />
|
<input type="checkbox" class="permissions checkbox" id="checkbox-permission-{{ acl.id }}-edit" ng-model="acl.permissionEdit" ng-change="aclUpdate(acl)" />
|
||||||
<label for="checkbox-permission-{{ acl.id }}-edit"><?php p($l->t('Edit')); ?></label>
|
<label for="checkbox-permission-{{ acl.id }}-edit"><?php p($l->t('Edit')); ?></label>
|
||||||
</span>
|
</span>
|
||||||
<span class="shareOption"ng-if="boardservice.canManage()">
|
<span class="shareOption"ng-if="boardservice.canManage()">
|
||||||
|
|||||||
@@ -66,12 +66,12 @@ class AclMapperTest extends MapperTestUtility {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/** @return Acl */
|
/** @return Acl */
|
||||||
public function getAcl($type='user', $participant='admin', $write=false, $invite=false, $manage=false, $boardId=123) {
|
public function getAcl($type='user', $participant='admin', $edit=false, $share=false, $manage=false, $boardId=123) {
|
||||||
$acl = new Acl();
|
$acl = new Acl();
|
||||||
$acl->setParticipant($participant);
|
$acl->setParticipant($participant);
|
||||||
$acl->setType('user');
|
$acl->setType('user');
|
||||||
$acl->setPermissionWrite($write);
|
$acl->setPermissionEdit($edit);
|
||||||
$acl->setPermissionInvite($invite);
|
$acl->setPermissionShare($share);
|
||||||
$acl->setPermissionManage($manage);
|
$acl->setPermissionManage($manage);
|
||||||
$acl->setBoardId($boardId);
|
$acl->setBoardId($boardId);
|
||||||
return $acl;
|
return $acl;
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ class AclTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$acl->setParticipant("admin");
|
$acl->setParticipant("admin");
|
||||||
$acl->setType("user");
|
$acl->setType("user");
|
||||||
$acl->setBoardId(1);
|
$acl->setBoardId(1);
|
||||||
$acl->setPermissionWrite(1);
|
$acl->setPermissionEdit(1);
|
||||||
$acl->setPermissionInvite(1);
|
$acl->setPermissionShare(1);
|
||||||
$acl->setPermissionManage(1);
|
$acl->setPermissionManage(1);
|
||||||
return $acl;
|
return $acl;
|
||||||
}
|
}
|
||||||
@@ -41,8 +41,8 @@ class AclTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$acl->setParticipant("administrators");
|
$acl->setParticipant("administrators");
|
||||||
$acl->setType("group");
|
$acl->setType("group");
|
||||||
$acl->setBoardId(1);
|
$acl->setBoardId(1);
|
||||||
$acl->setPermissionWrite(1);
|
$acl->setPermissionEdit(1);
|
||||||
$acl->setPermissionInvite(1);
|
$acl->setPermissionShare(1);
|
||||||
$acl->setPermissionManage(1);
|
$acl->setPermissionManage(1);
|
||||||
return $acl;
|
return $acl;
|
||||||
}
|
}
|
||||||
@@ -53,8 +53,8 @@ class AclTest extends \PHPUnit_Framework_TestCase {
|
|||||||
'participant' => 'admin',
|
'participant' => 'admin',
|
||||||
'type' => 'user',
|
'type' => 'user',
|
||||||
'boardId' => 1,
|
'boardId' => 1,
|
||||||
'permissionWrite' => 1,
|
'permissionEdit' => 1,
|
||||||
'permissionInvite' => 1,
|
'permissionShare' => 1,
|
||||||
'permissionManage' => 1,
|
'permissionManage' => 1,
|
||||||
'owner' => 0
|
'owner' => 0
|
||||||
], $acl->jsonSerialize());
|
], $acl->jsonSerialize());
|
||||||
@@ -64,8 +64,8 @@ class AclTest extends \PHPUnit_Framework_TestCase {
|
|||||||
'participant' => 'administrators',
|
'participant' => 'administrators',
|
||||||
'type' => 'group',
|
'type' => 'group',
|
||||||
'boardId' => 1,
|
'boardId' => 1,
|
||||||
'permissionWrite' => 1,
|
'permissionEdit' => 1,
|
||||||
'permissionInvite' => 1,
|
'permissionShare' => 1,
|
||||||
'permissionManage' => 1,
|
'permissionManage' => 1,
|
||||||
'owner' => 0
|
'owner' => 0
|
||||||
], $acl->jsonSerialize());
|
], $acl->jsonSerialize());
|
||||||
@@ -78,8 +78,8 @@ class AclTest extends \PHPUnit_Framework_TestCase {
|
|||||||
'participant' => 'admin',
|
'participant' => 'admin',
|
||||||
'type' => 'user',
|
'type' => 'user',
|
||||||
'boardId' => 1,
|
'boardId' => 1,
|
||||||
'permissionWrite' => 1,
|
'permissionEdit' => 1,
|
||||||
'permissionInvite' => 1,
|
'permissionShare' => 1,
|
||||||
'permissionManage' => 1,
|
'permissionManage' => 1,
|
||||||
'owner' => 1
|
'owner' => 1
|
||||||
], $acl->jsonSerialize());
|
], $acl->jsonSerialize());
|
||||||
@@ -92,8 +92,8 @@ class AclTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$this->assertEquals(true, $acl->getPermission(Acl::PERMISSION_EDIT));
|
$this->assertEquals(true, $acl->getPermission(Acl::PERMISSION_EDIT));
|
||||||
$this->assertEquals(true, $acl->getPermission(Acl::PERMISSION_MANAGE));
|
$this->assertEquals(true, $acl->getPermission(Acl::PERMISSION_MANAGE));
|
||||||
$this->assertEquals(true, $acl->getPermission(Acl::PERMISSION_SHARE));
|
$this->assertEquals(true, $acl->getPermission(Acl::PERMISSION_SHARE));
|
||||||
$acl->setPermissionWrite(0);
|
$acl->setPermissionEdit(0);
|
||||||
$acl->setPermissionInvite(0);
|
$acl->setPermissionShare(0);
|
||||||
$acl->setPermissionManage(0);
|
$acl->setPermissionManage(0);
|
||||||
$this->assertEquals(true, $acl->getPermission(Acl::PERMISSION_READ));
|
$this->assertEquals(true, $acl->getPermission(Acl::PERMISSION_READ));
|
||||||
$this->assertEquals(false, $acl->getPermission(Acl::PERMISSION_EDIT));
|
$this->assertEquals(false, $acl->getPermission(Acl::PERMISSION_EDIT));
|
||||||
|
|||||||
@@ -71,12 +71,12 @@ class BoardMapperTest extends MapperTestUtility {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/** @return Acl */
|
/** @return Acl */
|
||||||
public function getAcl($type='user', $participant='admin', $write=false, $invite=false, $manage=false, $boardId=123) {
|
public function getAcl($type='user', $participant='admin', $edit=false, $share=false, $manage=false, $boardId=123) {
|
||||||
$acl = new Acl();
|
$acl = new Acl();
|
||||||
$acl->setParticipant($participant);
|
$acl->setParticipant($participant);
|
||||||
$acl->setType('user');
|
$acl->setType('user');
|
||||||
$acl->setPermissionWrite($write);
|
$acl->setPermissionEdit($edit);
|
||||||
$acl->setPermissionInvite($invite);
|
$acl->setPermissionShare($share);
|
||||||
$acl->setPermissionManage($manage);
|
$acl->setPermissionManage($manage);
|
||||||
$acl->setBoardId($boardId);
|
$acl->setBoardId($boardId);
|
||||||
return $acl;
|
return $acl;
|
||||||
|
|||||||
@@ -144,8 +144,8 @@ class BoardServiceTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$acl->setBoardId(123);
|
$acl->setBoardId(123);
|
||||||
$acl->setType('user');
|
$acl->setType('user');
|
||||||
$acl->setParticipant('admin');
|
$acl->setParticipant('admin');
|
||||||
$acl->setPermissionWrite(true);
|
$acl->setPermissionEdit(true);
|
||||||
$acl->setPermissionInvite(true);
|
$acl->setPermissionShare(true);
|
||||||
$acl->setPermissionManage(true);
|
$acl->setPermissionManage(true);
|
||||||
$this->aclMapper->expects($this->once())
|
$this->aclMapper->expects($this->once())
|
||||||
->method('insert')
|
->method('insert')
|
||||||
@@ -161,8 +161,8 @@ class BoardServiceTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$acl->setBoardId(123);
|
$acl->setBoardId(123);
|
||||||
$acl->setType('user');
|
$acl->setType('user');
|
||||||
$acl->setParticipant('admin');
|
$acl->setParticipant('admin');
|
||||||
$acl->setPermissionWrite(true);
|
$acl->setPermissionEdit(true);
|
||||||
$acl->setPermissionInvite(true);
|
$acl->setPermissionShare(true);
|
||||||
$acl->setPermissionManage(true);
|
$acl->setPermissionManage(true);
|
||||||
|
|
||||||
$this->aclMapper->expects($this->once())
|
$this->aclMapper->expects($this->once())
|
||||||
@@ -178,8 +178,8 @@ class BoardServiceTest extends \PHPUnit_Framework_TestCase {
|
|||||||
123, false, false, false
|
123, false, false, false
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->assertFalse($result->getPermissionWrite());
|
$this->assertFalse($result->getPermissionEdit());
|
||||||
$this->assertFalse($result->getPermissionInvite());
|
$this->assertFalse($result->getPermissionShare());
|
||||||
$this->assertFalse($result->getPermissionManage());
|
$this->assertFalse($result->getPermissionManage());
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -189,8 +189,8 @@ class BoardServiceTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$acl->setBoardId(123);
|
$acl->setBoardId(123);
|
||||||
$acl->setType('user');
|
$acl->setType('user');
|
||||||
$acl->setParticipant('admin');
|
$acl->setParticipant('admin');
|
||||||
$acl->setPermissionWrite(true);
|
$acl->setPermissionEdit(true);
|
||||||
$acl->setPermissionInvite(true);
|
$acl->setPermissionShare(true);
|
||||||
$acl->setPermissionManage(true);
|
$acl->setPermissionManage(true);
|
||||||
$this->aclMapper->expects($this->once())
|
$this->aclMapper->expects($this->once())
|
||||||
->method('find')
|
->method('find')
|
||||||
|
|||||||
@@ -88,8 +88,8 @@ class PermissionServiceTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$aclUser = new Acl();
|
$aclUser = new Acl();
|
||||||
$aclUser->setType('user');
|
$aclUser->setType('user');
|
||||||
$aclUser->setParticipant('admin');
|
$aclUser->setParticipant('admin');
|
||||||
$aclUser->setPermissionWrite(true);
|
$aclUser->setPermissionEdit(true);
|
||||||
$aclUser->setPermissionInvite(true);
|
$aclUser->setPermissionShare(true);
|
||||||
$aclUser->setPermissionManage(true);
|
$aclUser->setPermissionManage(true);
|
||||||
$this->aclMapper->expects($this->once())
|
$this->aclMapper->expects($this->once())
|
||||||
->method('findAll')
|
->method('findAll')
|
||||||
@@ -150,8 +150,8 @@ class PermissionServiceTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$aclUser = new Acl();
|
$aclUser = new Acl();
|
||||||
$aclUser->setType($type);
|
$aclUser->setType($type);
|
||||||
$aclUser->setParticipant($participant);
|
$aclUser->setParticipant($participant);
|
||||||
$aclUser->setPermissionWrite($edit);
|
$aclUser->setPermissionEdit($edit);
|
||||||
$aclUser->setPermissionInvite($share);
|
$aclUser->setPermissionShare($share);
|
||||||
$aclUser->setPermissionManage($manage);
|
$aclUser->setPermissionManage($manage);
|
||||||
$acls = [
|
$acls = [
|
||||||
$aclUser
|
$aclUser
|
||||||
@@ -257,13 +257,13 @@ class PermissionServiceTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$this->service->checkPermission($mapper, 1234, Acl::PERMISSION_READ);
|
$this->service->checkPermission($mapper, 1234, Acl::PERMISSION_READ);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generateAcl($boardId, $type, $participant, $write, $manage, $share) {
|
private function generateAcl($boardId, $type, $participant, $edit, $manage, $share) {
|
||||||
$acl = new Acl();
|
$acl = new Acl();
|
||||||
$acl->setParticipant($participant);
|
$acl->setParticipant($participant);
|
||||||
$acl->setBoardId($boardId);
|
$acl->setBoardId($boardId);
|
||||||
$acl->setType($type);
|
$acl->setType($type);
|
||||||
$acl->setPermissionWrite($write);
|
$acl->setPermissionEdit($edit);
|
||||||
$acl->setPermissionInvite($share);
|
$acl->setPermissionShare($share);
|
||||||
$acl->setPermissionManage($manage);
|
$acl->setPermissionManage($manage);
|
||||||
return $acl;
|
return $acl;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class CardControllerTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$this->cardService->expects($this->once())->method('reorder');
|
$this->cardService->expects($this->once())->method('reorder');
|
||||||
$this->controller->reorder(1, 2, 3);
|
$this->controller->reorder(1, 2, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRename() {
|
public function testRename() {
|
||||||
$this->cardService->expects($this->once())->method('rename');
|
$this->cardService->expects($this->once())->method('rename');
|
||||||
$this->controller->rename(1, 'test');
|
$this->controller->rename(1, 'test');
|
||||||
|
|||||||
@@ -96,8 +96,8 @@ class ShareControllerTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$acl = new Acl();
|
$acl = new Acl();
|
||||||
$acl->setType('group');
|
$acl->setType('group');
|
||||||
$acl->setParticipant('foo');
|
$acl->setParticipant('foo');
|
||||||
$acl->setPermissionWrite(true);
|
$acl->setPermissionEdit(true);
|
||||||
$acl->setPermissionInvite(true);
|
$acl->setPermissionShare(true);
|
||||||
$acl->setPermissionManage(true);
|
$acl->setPermissionManage(true);
|
||||||
$this->assertEquals([$acl], $actual);
|
$this->assertEquals([$acl], $actual);
|
||||||
}
|
}
|
||||||
@@ -122,8 +122,8 @@ class ShareControllerTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$acl = new Acl();
|
$acl = new Acl();
|
||||||
$acl->setType('user');
|
$acl->setType('user');
|
||||||
$acl->setParticipant('foo');
|
$acl->setParticipant('foo');
|
||||||
$acl->setPermissionWrite(true);
|
$acl->setPermissionEdit(true);
|
||||||
$acl->setPermissionInvite(true);
|
$acl->setPermissionShare(true);
|
||||||
$acl->setPermissionManage(true);
|
$acl->setPermissionManage(true);
|
||||||
$this->assertEquals([$acl], $actual);
|
$this->assertEquals([$acl], $actual);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user