Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 2 additions & 1 deletion .license-overrides.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"mydash": "Own package - EUPL-1.2 licensed — approved 2026-03-15"
"mydash": "Own package - EUPL-1.2 licensed — approved 2026-03-15",
"apexcharts": "MIT — license-checker misreports as 'Custom: …apexcharts-logo.png' from a stray HTTP URL in the package's README. Upstream project is MIT-licensed (https://github.com/apexcharts/apexcharts.js/blob/main/LICENSE). Approved 2026-05-01."
}
64 changes: 32 additions & 32 deletions lib/Controller/DashboardShareApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Http\JSONResponse;
use OCP\IRequest;

/**
Expand Down Expand Up @@ -65,13 +65,13 @@ public function __construct(
*
* @param int $id The dashboard ID.
*
* @return DataResponse The list of shares.
* @return JSONResponse The list of shares.
*/
#[NoAdminRequired]
public function index(int $id): DataResponse
public function index(int $id): JSONResponse
{
if ($this->userId === null) {
return new DataResponse(
return new JSONResponse(
data: ['error' => 'Not logged in'],
statusCode: Http::STATUS_UNAUTHORIZED
);
Expand All @@ -86,15 +86,15 @@ public function index(int $id): DataResponse
callback: static fn($s) => $s->jsonSerialize(),
array: $shares
);
return new DataResponse(data: $serialized);
return new JSONResponse(data: $serialized);
} catch (DoesNotExistException) {
return new DataResponse(
return new JSONResponse(
data: ['error' => 'Dashboard not found'],
statusCode: Http::STATUS_NOT_FOUND
);
} catch (Exception) {
// ADR-005: do not leak raw exception messages to clients.
return new DataResponse(
return new JSONResponse(
data: ['error' => 'Forbidden'],
statusCode: Http::STATUS_FORBIDDEN
);
Expand All @@ -109,17 +109,17 @@ public function index(int $id): DataResponse
* @param string|null $shareWith The recipient.
* @param string|null $permissionLevel The permission level.
*
* @return DataResponse The created/updated share.
* @return JSONResponse The created/updated share.
*/
#[NoAdminRequired]
public function create(
int $id,
?string $shareType=null,
?string $shareWith=null,
?string $permissionLevel=null
): DataResponse {
): JSONResponse {
if ($this->userId === null) {
return new DataResponse(
return new JSONResponse(
data: ['error' => 'Not logged in'],
statusCode: Http::STATUS_UNAUTHORIZED
);
Expand All @@ -133,24 +133,24 @@ public function create(
permissionLevel: (string) $permissionLevel,
callerId: $this->userId
);
return new DataResponse(
return new JSONResponse(
data: $share->jsonSerialize(),
statusCode: Http::STATUS_CREATED
);
} catch (InvalidArgumentException) {
// ADR-005: do not leak raw exception messages to clients.
return new DataResponse(
return new JSONResponse(
data: ['error' => 'Invalid request'],
statusCode: Http::STATUS_BAD_REQUEST
);
} catch (DoesNotExistException) {
return new DataResponse(
return new JSONResponse(
data: ['error' => 'Dashboard not found'],
statusCode: Http::STATUS_NOT_FOUND
);
} catch (Exception) {
// ADR-005: do not leak raw exception messages to clients.
return new DataResponse(
return new JSONResponse(
data: ['error' => 'Forbidden'],
statusCode: Http::STATUS_FORBIDDEN
);
Expand All @@ -162,13 +162,13 @@ public function create(
*
* @param int $shareId The share ID.
*
* @return DataResponse Empty 204 on success.
* @return JSONResponse Empty 204 on success.
*/
#[NoAdminRequired]
public function destroy(int $shareId): DataResponse
public function destroy(int $shareId): JSONResponse
{
if ($this->userId === null) {
return new DataResponse(
return new JSONResponse(
data: ['error' => 'Not logged in'],
statusCode: Http::STATUS_UNAUTHORIZED
);
Expand All @@ -179,15 +179,15 @@ public function destroy(int $shareId): DataResponse
shareId: $shareId,
callerId: $this->userId
);
return new DataResponse(data: [], statusCode: Http::STATUS_NO_CONTENT);
return new JSONResponse(data: [], statusCode: Http::STATUS_NO_CONTENT);
} catch (DoesNotExistException) {
return new DataResponse(
return new JSONResponse(
data: ['error' => 'Share not found'],
statusCode: Http::STATUS_NOT_FOUND
);
} catch (Exception) {
// ADR-005: do not leak raw exception messages to clients.
return new DataResponse(
return new JSONResponse(
data: ['error' => 'Forbidden'],
statusCode: Http::STATUS_FORBIDDEN
);
Expand All @@ -200,13 +200,13 @@ public function destroy(int $shareId): DataResponse
* @param int $id The dashboard ID.
* @param array|null $shares The new share list.
*
* @return DataResponse The new full share list.
* @return JSONResponse The new full share list.
*/
#[NoAdminRequired]
public function replace(int $id, ?array $shares=null): DataResponse
public function replace(int $id, ?array $shares=null): JSONResponse
{
if ($this->userId === null) {
return new DataResponse(
return new JSONResponse(
data: ['error' => 'Not logged in'],
statusCode: Http::STATUS_UNAUTHORIZED
);
Expand All @@ -226,21 +226,21 @@ public function replace(int $id, ?array $shares=null): DataResponse
callback: static fn($s) => $s->jsonSerialize(),
array: $newShares
);
return new DataResponse(data: $serialized);
return new JSONResponse(data: $serialized);
} catch (InvalidArgumentException) {
// ADR-005: do not leak raw exception messages to clients.
return new DataResponse(
return new JSONResponse(
data: ['error' => 'Invalid request'],
statusCode: Http::STATUS_BAD_REQUEST
);
} catch (DoesNotExistException) {
return new DataResponse(
return new JSONResponse(
data: ['error' => 'Dashboard not found'],
statusCode: Http::STATUS_NOT_FOUND
);
} catch (Exception) {
// ADR-005: do not leak raw exception messages to clients.
return new DataResponse(
return new JSONResponse(
data: ['error' => 'Forbidden'],
statusCode: Http::STATUS_FORBIDDEN
);
Expand All @@ -254,15 +254,15 @@ public function replace(int $id, ?array $shares=null): DataResponse
* @param string $shareType The share type.
* @param string $shareWith The recipient user/group ID.
*
* @return DataResponse The count of deleted rows.
* @return JSONResponse The count of deleted rows.
*/
#[NoAdminRequired]
public function revokeForRecipient(
string $shareType,
string $shareWith
): DataResponse {
): JSONResponse {
if ($this->userId === null) {
return new DataResponse(
return new JSONResponse(
data: ['error' => 'Not logged in'],
statusCode: Http::STATUS_UNAUTHORIZED
);
Expand All @@ -274,10 +274,10 @@ public function revokeForRecipient(
shareWith: $shareWith,
callerId: $this->userId
);
return new DataResponse(data: ['deleted' => $count]);
return new JSONResponse(data: ['deleted' => $count]);
} catch (InvalidArgumentException) {
// ADR-005: do not leak raw exception messages to clients.
return new DataResponse(
return new JSONResponse(
data: ['error' => 'Invalid request'],
statusCode: Http::STATUS_BAD_REQUEST
);
Expand Down
1 change: 0 additions & 1 deletion lib/Service/AdminTemplateService.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ public static function pickFirstMatch(
return null;
}//end pickFirstMatch()


/**
* Generate a UUID v4.
*
Expand Down
Loading