mirror of
https://github.com/Karaka-Management/oms-Tasks.git
synced 2026-01-11 15:38:40 +00:00
bug fixes and permission tests
This commit is contained in:
parent
187ccc3622
commit
feb6c119b8
|
|
@ -303,5 +303,41 @@
|
|||
"foreignKey": "tag_id"
|
||||
}
|
||||
}
|
||||
},
|
||||
"task_seen": {
|
||||
"name": "task_seen",
|
||||
"fields": {
|
||||
"task_seen_id": {
|
||||
"name": "task_seen_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"task_seen_at": {
|
||||
"name": "task_seen_at",
|
||||
"type": "DATETIME",
|
||||
"null": false
|
||||
},
|
||||
"task_seen_flag": {
|
||||
"name": "task_seen_flag",
|
||||
"type": "TINYINT",
|
||||
"null": false
|
||||
},
|
||||
"task_seen_by": {
|
||||
"name": "task_seen_by",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "account",
|
||||
"foreignKey": "account_id"
|
||||
},
|
||||
"task_seen_task": {
|
||||
"name": "task_seen_task",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "task",
|
||||
"foreignKey": "task_id"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
|||
namespace Modules\Tasks\Controller;
|
||||
|
||||
use Modules\Dashboard\Models\DashboardElementInterface;
|
||||
use Modules\Media\Models\MediaMapper;
|
||||
use Modules\Tasks\Models\PermissionState;
|
||||
use Modules\Tasks\Models\TaskMapper;
|
||||
use Modules\Tasks\Views\TaskView;
|
||||
|
|
@ -134,6 +135,10 @@ final class BackendController extends Controller implements DashboardElementInte
|
|||
{
|
||||
$view = new TaskView($this->app->l11nManager, $request, $response);
|
||||
|
||||
$profileImage = $this->app->appSettings->get(names: 'default_profile_image', module: 'Profile');
|
||||
$image = MediaMapper::get()->where('id', (int) $profileImage->content)->execute();
|
||||
$view->defaultProfileImage = $image;
|
||||
|
||||
if (!TaskMapper::hasReadingPermission($request->header->account, (int) $request->getData('id'))) {
|
||||
$response->header->status = RequestStatusCode::R_403;
|
||||
$view->setTemplate('/Web/Backend/Error/403');
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ final class SearchController extends Controller
|
|||
|
||||
$tags = [];
|
||||
|
||||
// @todo: probably cleanup return for link generation + sort by best match
|
||||
$response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true);
|
||||
|
||||
$response->set($request->uri->__toString(), $tags);
|
||||
|
|
|
|||
73
Models/TaskSeen.php
Normal file
73
Models/TaskSeen.php
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package Modules\Tasks\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Tasks\Models;
|
||||
|
||||
/**
|
||||
* Null model
|
||||
*
|
||||
* @package Modules\Tasks\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class TaskSeen
|
||||
{
|
||||
/**
|
||||
* Seen ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected int $id = 0;
|
||||
|
||||
public \DateTime $seenAt;
|
||||
|
||||
public int $seenBy = 0;
|
||||
|
||||
public int $task = 0;
|
||||
|
||||
/**
|
||||
* The flag allows to set a task as not seen even it was already seen.
|
||||
*
|
||||
* This is helpful for changes to a task or forwarding which should be signaled to the user.
|
||||
* Another situation could be if a user wants to mark a task as unseen in order to check it out later on again.
|
||||
*
|
||||
* @var bool
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public bool $flag = false;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->seenAt = new \DateTime('now');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function getId() : int
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
58
Models/TaskSeenMapper.php
Normal file
58
Models/TaskSeenMapper.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 8.0
|
||||
*
|
||||
* @package Modules\Tasks\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link https://orange-management.org
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Tasks\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
|
||||
/**
|
||||
* Tasks mapper class.
|
||||
*
|
||||
* @package Modules\Tasks\Models
|
||||
* @license OMS License 1.0
|
||||
* @link https://orange-management.org
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class TaskSeenMapper extends DataMapperFactory
|
||||
{
|
||||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const COLUMNS = [
|
||||
'task_seen_id' => ['name' => 'task_seen_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'task_seen_at' => ['name' => 'task_seen_at', 'type' => 'DateTime', 'internal' => 'seenAt'],
|
||||
'task_seen_task' => ['name' => 'task_seen_task', 'type' => 'int', 'internal' => 'task'],
|
||||
'task_seen_by' => ['name' => 'task_seen_by', 'type' => 'int', 'internal' => 'seenBy'],
|
||||
'task_seen_flag' => ['name' => 'task_seen_flag', 'type' => 'bool', 'internal' => 'flag'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const TABLE = 'task_seen';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const PRIMARYFIELD ='task_seen_id';
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user