Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lib/BackgroundJob/AdviceDeadlineJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
*/
class AdviceDeadlineJob extends TimedJob
{

/**
* Constructor.
*
Expand Down Expand Up @@ -124,6 +123,6 @@ protected function run($argument): void
],
);
}
}
}//end foreach
}//end run()
}//end class
1 change: 0 additions & 1 deletion lib/Controller/AdviceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
*/
class AdviceController extends Controller
{

/**
* Constructor.
*
Expand Down
1 change: 0 additions & 1 deletion lib/Controller/CaseSharingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,5 +201,4 @@ public function handleTransfer(string $transferId): JSONResponse

return new JSONResponse(['success' => true, 'transfer' => $result]);
}//end handleTransfer()

}//end class
13 changes: 11 additions & 2 deletions lib/Controller/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,23 @@ public function __construct(IRequest $request)
}//end __construct()

/**
* Render the main dashboard page.
* Render the manifest-driven SPA shell.
*
* Bound to both `/` and the catch-all `/{path}` route so deep links
* (e.g. `/apps/procest/cases`) serve the same shell; vue-router resolves
* the actual view client-side in history mode.
*
* @param string $path Sub-path segment from the catch-all route; ignored
* server-side, resolved by vue-router on the client.
*
* @NoAdminRequired
* @NoCSRFRequired
*
* @return TemplateResponse
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function page(): TemplateResponse
public function page(string $path=''): TemplateResponse
{
return new TemplateResponse(Application::APP_ID, 'index');
}//end page()
Expand Down
25 changes: 19 additions & 6 deletions lib/Controller/LhsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,18 @@ public function recommend(): JSONResponse
}

$versionParam = $this->request->getParam('lhsVersion');
$version = ($versionParam === null) ? null : (int) $versionParam;
$inspection = $this->request->getParam('inspection');
$inspectionId = (is_string($inspection) === true && $inspection !== '') ? $inspection : null;
if ($versionParam === null) {
$version = null;
} else {
$version = (int) $versionParam;
}

$inspection = $this->request->getParam('inspection');
if (is_string($inspection) === true && $inspection !== '') {
$inspectionId = $inspection;
} else {
$inspectionId = null;
}

try {
$recommendation = $this->lhsService->recommend(
Expand All @@ -137,7 +146,7 @@ public function recommend(): JSONResponse
['error' => 'LHS-aanbeveling mislukt'],
Http::STATUS_INTERNAL_SERVER_ERROR,
);
}
}//end try

return new JSONResponse($recommendation);
}//end recommend()
Expand Down Expand Up @@ -183,7 +192,11 @@ public function override(): JSONResponse

$declaredRole = (string) $this->request->getParam('userRole', '');
$isManager = $this->groupManager->isAdmin($user->getUID());
$userRole = ($declaredRole === 'manager' && $isManager === true) ? 'manager' : 'inspector';
if ($declaredRole === 'manager' && $isManager === true) {
$userRole = 'manager';
} else {
$userRole = 'inspector';
}

try {
$updated = $this->lhsService->override(
Expand All @@ -206,7 +219,7 @@ public function override(): JSONResponse
['error' => 'LHS-override mislukt'],
Http::STATUS_INTERNAL_SERVER_ERROR,
);
}
}//end try

return new JSONResponse($updated);
}//end override()
Expand Down
30 changes: 15 additions & 15 deletions lib/Controller/ParaferingAuditExportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ class ParaferingAuditExportController extends Controller
/**
* Constructor.
*
* @param string $appName Nextcloud app id
* @param IRequest $request Incoming request
* @param IUserSession $userSession Current user session
* @param IGroupManager $groupManager Group manager (for RBAC check)
* @param AuditTrailService $auditTrailService The audit-trail service
* @param SettingsService $settingsService Procest settings bridge
* @param LoggerInterface $logger PSR-3 logger
* @param string $appName Nextcloud app id
* @param IRequest $request Incoming request
* @param IUserSession $userSession Current user session
* @param IGroupManager $groupManager Group manager (for RBAC check)
* @param AuditTrailService $auditTrailService The audit-trail service
* @param SettingsService $settingsService Procest settings bridge
* @param LoggerInterface $logger PSR-3 logger
*/
public function __construct(
string $appName,
Expand All @@ -69,7 +69,7 @@ public function __construct(
private readonly SettingsService $settingsService,
private readonly LoggerInterface $logger,
) {
parent::__construct($appName, $request);
parent::__construct(appName: $appName, request: $request);
}//end __construct()

/**
Expand All @@ -81,7 +81,7 @@ public function __construct(
* @return JSONResponse
*/
#[NoAdminRequired]
public function export(string $id, string $format = 'json'): JSONResponse
public function export(string $id, string $format='json'): JSONResponse
{
try {
$user = $this->userSession->getUser();
Expand All @@ -92,8 +92,8 @@ public function export(string $id, string $format = 'json'): JSONResponse
);
}

$uid = $user->getUID();
$allowed = false;
$uid = $user->getUID();
$allowed = false;
foreach (self::ALLOWED_GROUPS as $group) {
if ($this->groupManager->isInGroup($uid, $group) === true) {
$allowed = true;
Expand All @@ -120,7 +120,7 @@ public function export(string $id, string $format = 'json'): JSONResponse
);
}

$voorstelOnderwerp = $this->resolveVoorstelOnderwerp($id);
$voorstelOnderwerp = $this->resolveVoorstelOnderwerp(voorstelId: $id);
if ($voorstelOnderwerp === null) {
return new JSONResponse(
['message' => 'Voorstel not found'],
Expand Down Expand Up @@ -182,13 +182,13 @@ private function resolveVoorstelOnderwerp(string $voorstelId): ?string
$array = [];
if (is_array($voorstel) === true) {
$array = $voorstel;
} elseif (is_object($voorstel) === true) {
} else if (is_object($voorstel) === true) {
if (method_exists($voorstel, 'jsonSerialize') === true) {
$serialized = $voorstel->jsonSerialize();
if (is_array($serialized) === true) {
$array = $serialized;
}
} elseif (method_exists($voorstel, 'toArray') === true) {
} else if (method_exists($voorstel, 'toArray') === true) {
$arr = $voorstel->toArray();
if (is_array($arr) === true) {
$array = $arr;
Expand All @@ -204,6 +204,6 @@ private function resolveVoorstelOnderwerp(string $voorstelId): ?string
);

return null;
}
}//end try
}//end resolveVoorstelOnderwerp()
}//end class
2 changes: 1 addition & 1 deletion lib/Controller/PublicShareController.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function uploadDocument(string $token): JSONResponse
);
}

$share = $validation['share'];
$share = $validation['share'];
$permissionLevel = ($share['permissionLevel'] ?? 'bekijken');

if ($permissionLevel !== 'bijdragen' && $permissionLevel !== 'contribute') {
Expand Down
12 changes: 6 additions & 6 deletions lib/Controller/RoutingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ public function reroute(string $id): JSONResponse
);
}

$register = $this->settingsService->getConfigValue('register');
$caseSchema = $this->settingsService->getConfigValue('case_schema');
$workflowSlug = $this->settingsService->getConfigValue('workflow_template_schema');
$register = $this->settingsService->getConfigValue('register');
$caseSchema = $this->settingsService->getConfigValue('case_schema');
$workflowSlug = $this->settingsService->getConfigValue('workflow_template_schema');

$case = $this->toArray(value: $objectService->findObject($register, $caseSchema, $id));

Expand All @@ -136,8 +136,8 @@ public function reroute(string $id): JSONResponse
continue;
}

$assignees = $this->resolver->resolve($rule, $case);
$affected[] = [
$assignees = $this->resolver->resolve($rule, $case);
$affected[] = [
'stepId' => (string) ($step['id'] ?? ''),
'order' => (int) ($step['order'] ?? 0),
'assignees' => $assignees,
Expand All @@ -158,7 +158,7 @@ public function reroute(string $id): JSONResponse
['error' => 'Herberekening mislukt'],
Http::STATUS_INTERNAL_SERVER_ERROR,
);
}
}//end try
}//end reroute()

/**
Expand Down
29 changes: 20 additions & 9 deletions lib/Controller/StatusTransitionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
*/
class StatusTransitionController extends Controller
{

/**
* Constructor.
*
Expand Down Expand Up @@ -107,9 +106,13 @@ public function available(string $caseId): JSONResponse
*/
public function execute(string $caseId): JSONResponse
{
$body = $this->readJsonBody();
$transitionId = (string) ($body['transitionId'] ?? '');
$comment = isset($body['comment']) === true ? (string) $body['comment'] : null;
$body = $this->readJsonBody();
$transitionId = (string) ($body['transitionId'] ?? '');
if (isset($body['comment']) === true) {
$comment = (string) $body['comment'];
} else {
$comment = null;
}

if ($transitionId === '') {
return new JSONResponse(
Expand All @@ -131,12 +134,13 @@ public function execute(string $caseId): JSONResponse
Http::STATUS_CONFLICT,
);
} catch (RuntimeException $e) {
$code = $e->getMessage();
$status = match ($code) {
$code = $e->getMessage();
$status = match ($code) {
'case_not_found', 'transition_not_found' => Http::STATUS_NOT_FOUND,
'forbidden_admin_only' => Http::STATUS_FORBIDDEN,
default => Http::STATUS_BAD_REQUEST,
};

$this->logger->info('StatusTransitionController: execute rejected', ['code' => $code]);
return new JSONResponse(['error' => 'Could not execute transition'], $status);
} catch (\Throwable $e) {
Expand All @@ -148,7 +152,7 @@ public function execute(string $caseId): JSONResponse
['error' => 'Could not execute transition'],
Http::STATUS_INTERNAL_SERVER_ERROR,
);
}
}//end try
}//end execute()

/**
Expand All @@ -172,7 +176,11 @@ public function freeform(string $caseId): JSONResponse

$body = $this->readJsonBody();
$toStatusId = (string) ($body['toStatusId'] ?? '');
$comment = isset($body['comment']) === true ? (string) $body['comment'] : null;
if (isset($body['comment']) === true) {
$comment = (string) $body['comment'];
} else {
$comment = null;
}

if ($toStatusId === '') {
return new JSONResponse(
Expand All @@ -195,6 +203,7 @@ public function freeform(string $caseId): JSONResponse
'case_not_found', 'case_type_not_found' => Http::STATUS_NOT_FOUND,
default => Http::STATUS_BAD_REQUEST,
};

$this->logger->info('StatusTransitionController: freeform rejected', ['code' => $code]);
return new JSONResponse(['error' => 'Could not execute free-form transition'], $status);
} catch (\Throwable $e) {
Expand All @@ -206,7 +215,7 @@ public function freeform(string $caseId): JSONResponse
['error' => 'Could not execute free-form transition'],
Http::STATUS_INTERNAL_SERVER_ERROR,
);
}
}//end try
}//end freeform()

/**
Expand Down Expand Up @@ -246,10 +255,12 @@ private function readJsonBody(): array
if ($content === '' || $content === false) {
return [];
}

$decoded = json_decode($content, true);
if (is_array($decoded) === true) {
return $decoded;
}

return [];
}//end readJsonBody()
}//end class
11 changes: 3 additions & 8 deletions lib/Controller/WmsWfsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,12 @@
*/
class WmsWfsController extends Controller
{


/**
* Constructor for WmsWfsController.
*
* @param string $appName The application name
* @param IRequest $request The request object
* @param WmsWfsService $wmsWfsService The WMS/WFS service
* @param string $appName The application name
* @param IRequest $request The request object
* @param WmsWfsService $wmsWfsService The WMS/WFS service
*
* @return void
*/
Expand All @@ -57,7 +55,6 @@ public function __construct(
parent::__construct(appName: $appName, request: $request);
}//end __construct()


/**
* Proxy a request to a configured wmsLayer's upstream endpoint.
*
Expand Down Expand Up @@ -121,6 +118,4 @@ public function proxy(): JSONResponse
);
}
}//end proxy()


}//end class
Loading
Loading