org -> unit change, some new functionality

This commit is contained in:
Dennis Eichhorn 2023-01-26 21:54:13 +01:00
parent 7b1a688b0f
commit cb508cee45
6 changed files with 19 additions and 4 deletions

View File

@ -14,6 +14,11 @@
"type": "VARCHAR(255)",
"null": false
},
"kanban_board_color": {
"color": "kanban_board_color",
"type": "VARCHAR(9)",
"null": false
},
"kanban_board_desc": {
"name": "kanban_board_desc",
"type": "TEXT",

View File

@ -294,6 +294,7 @@ final class ApiController extends Controller
{
$board = new KanbanBoard();
$board->name = (string) $request->getData('title');
$board->color = (string) ($request->getData('color') ?? '');
$board->description = Markdown::parse((string) ($request->getData('plain') ?? ''));
$board->descriptionRaw = (string) ($request->getData('plain') ?? '');
$board->order = (int) ($request->getData('order') ?? 1);

View File

@ -118,7 +118,7 @@ final class BackendController extends Controller
if ($board->createdBy->getId() !== $accountId
&& !$this->app->accountManager->get($accountId)->hasPermission(
PermissionType::READ, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::BOARD, $board->getId())
PermissionType::READ, $this->app->unitId, $this->app->appName, self::NAME, PermissionCategory::BOARD, $board->getId())
) {
$view->setTemplate('/Web/Backend/Error/403_inline');
$response->header->status = RequestStatusCode::R_403;
@ -183,7 +183,7 @@ final class BackendController extends Controller
$accountId = $request->header->account;
if (!$this->app->accountManager->get($accountId)->hasPermission(
PermissionType::CREATE, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::BOARD)
PermissionType::CREATE, $this->app->unitId, $this->app->appName, self::NAME, PermissionCategory::BOARD)
) {
$view->setTemplate('/Web/Backend/Error/403_inline');
$response->header->status = RequestStatusCode::R_403;
@ -229,7 +229,7 @@ final class BackendController extends Controller
if ($card->createdBy->getId() !== $accountId
&& !$this->app->accountManager->get($accountId)->hasPermission(
PermissionType::READ, $this->app->orgId, $this->app->appName, self::NAME, PermissionCategory::CARD, $card->getId())
PermissionType::READ, $this->app->unitId, $this->app->appName, self::NAME, PermissionCategory::CARD, $card->getId())
) {
$view->setTemplate('/Web/Backend/Error/403_inline');
$response->header->status = RequestStatusCode::R_403;

View File

@ -45,6 +45,14 @@ class KanbanBoard implements \JsonSerializable
*/
public string $name = '';
/**
* Color.
*
* @var string
* @since 1.0.0
*/
public string $color = '';
/**
* Board status.
*

View File

@ -37,6 +37,7 @@ final class KanbanBoardMapper extends DataMapperFactory
public const COLUMNS = [
'kanban_board_id' => ['name' => 'kanban_board_id', 'type' => 'int', 'internal' => 'id'],
'kanban_board_name' => ['name' => 'kanban_board_name', 'type' => 'string', 'internal' => 'name'],
'kanban_board_color' => ['name' => 'kanban_board_color', 'type' => 'string', 'internal' => 'color'],
'kanban_board_desc' => ['name' => 'kanban_board_desc', 'type' => 'string', 'internal' => 'description'],
'kanban_board_descraw' => ['name' => 'kanban_board_descraw', 'type' => 'string', 'internal' => 'descriptionRaw'],
'kanban_board_status' => ['name' => 'kanban_board_status', 'type' => 'int', 'internal' => 'status'],

View File

@ -55,7 +55,7 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
};
$this->app->dbPool = $GLOBALS['dbpool'];
$this->app->orgId = 1;
$this->app->unitId = 1;
$this->app->accountManager = new AccountManager($GLOBALS['session']);
$this->app->appSettings = new CoreSettings();
$this->app->moduleManager = new ModuleManager($this->app, __DIR__ . '/../../../Modules/');