Rename permissions in backend

This commit is contained in:
Julius Haertl
2017-01-19 11:03:04 +01:00
parent 5f9e65aa96
commit f936afd972
15 changed files with 93 additions and 95 deletions

View File

@@ -34,21 +34,21 @@ class Acl extends Entity implements \JsonSerializable {
protected $participant;
protected $type;
protected $boardId;
protected $permissionWrite;
protected $permissionInvite;
protected $permissionEdit;
protected $permissionShare;
protected $permissionManage;
protected $owner;
public function __construct() {
$this->addType('id','integer');
$this->addType('boardId','integer');
$this->addType('permissionWrite', 'boolean');
$this->addType('permissionInvite', 'boolean');
$this->addType('permissionEdit', 'boolean');
$this->addType('permissionShare', 'boolean');
$this->addType('permissionManage', 'boolean');
$this->addType('owner', 'boolean');
$this->addRelation('owner');
$this->setPermissionWrite(false);
$this->setPermissionInvite(false);
$this->setPermissionEdit(false);
$this->setPermissionShare(false);
$this->setPermissionManage(false);
}
@@ -57,9 +57,9 @@ class Acl extends Entity implements \JsonSerializable {
case Acl::PERMISSION_READ:
return true;
case Acl::PERMISSION_EDIT:
return $this->getPermissionWrite();
return $this->getPermissionEdit();
case Acl::PERMISSION_SHARE:
return $this->getPermissionInvite();
return $this->getPermissionShare();
case Acl::PERMISSION_MANAGE:
return $this->getPermissionManage();
}
@@ -72,8 +72,8 @@ class Acl extends Entity implements \JsonSerializable {
'participant' => $this->participant,
'type' => $this->type,
'boardId' => $this->boardId,
'permissionWrite' => $this->permissionWrite,
'permissionInvite' => $this->permissionInvite,
'permissionEdit' => $this->permissionEdit,
'permissionShare' => $this->permissionShare,
'permissionManage' => $this->permissionManage,
'owner' => $this->owner
];

View File

@@ -33,7 +33,7 @@ class AclMapper extends DeckMapper implements IPermissionMapper {
}
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);
}

View File

@@ -5,20 +5,20 @@
* @author Julius Härtl <jus@bitgrid.net>
*
* @license GNU AGPL version 3 or any later version
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
*
* 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/>.
*
*
*/
namespace OCA\Deck\Db;
@@ -35,9 +35,9 @@ class Stack extends Entity implements JsonSerializable {
protected $order;
public function __construct() {
$this->addType('id','integer');
$this->addType('boardId','integer');
$this->addType('order','integer');
$this->addType('id', 'integer');
$this->addType('boardId', 'integer');
$this->addType('order', 'integer');
}
public function setCards($cards) {
@@ -45,22 +45,20 @@ class Stack extends Entity implements JsonSerializable {
}
public function jsonSerialize() {
if(!empty($this->cards)) {
return [
'id' => $this->id,
'title' => $this->title,
'order' => $this->order,
'boardId' => $this->boardId,
'cards' => $this->cards
];
} else {
return [
'id' => $this->id,
'title' => $this->title,
'order' => $this->order,
'boardId' => $this->boardId
];
}
if (!empty($this->cards)) {
return [
'id' => $this->id,
'title' => $this->title,
'order' => $this->order,
'boardId' => $this->boardId,
'cards' => $this->cards
];
}
return [
'id' => $this->id,
'title' => $this->title,
'order' => $this->order,
'boardId' => $this->boardId
];
}
}