diff --git a/lib/Controller/TicketApiController.php b/lib/Controller/TicketApiController.php index 04c46ce..bdaefb3 100644 --- a/lib/Controller/TicketApiController.php +++ b/lib/Controller/TicketApiController.php @@ -43,11 +43,17 @@ class TicketApiController extends ApiController }); } + /** + * @NoAdminRequired + */ public function create(string $title, string $content): DataResponse { return new DataResponse($this->service->create($title, $content, $this->userId)); } + /** + * @NoAdminRequired + */ public function update(int $id, string $title, string $content): DataResponse { return $this->handleNotFound(function () use ($id, $title, $content) { diff --git a/lib/Migration/Version000000Date20210918151800.php b/lib/Migration/Version000000Date20210918151800.php index 010dbe7..1516f65 100644 --- a/lib/Migration/Version000000Date20210918151800.php +++ b/lib/Migration/Version000000Date20210918151800.php @@ -63,7 +63,7 @@ class Version000000Date20210918151800 extends SimpleMigrationStep { ]); $table->addColumn('user_id', 'string', [ 'notnull' => true, - 'length' => 200, + 'length' => 64, ]); $table->addColumn('matrix_user', 'string', [ 'notnull' => true, @@ -77,7 +77,7 @@ class Version000000Date20210918151800 extends SimpleMigrationStep { $table->setPrimaryKey(['id']); $table->addUniqueConstraint(['user_id'], 'upschooling_mx_user_nc_uniq'); $table->addUniqueConstraint(['matrix_user'], 'upschooling_mx_user_mx_uniq'); - $table->addForeignKeyConstraint('users', ['user_id'], ['id'], [], 'upschooling_mx_user_nc_fk'); + $table->addForeignKeyConstraint('users', ['user_id'], ['uid'], [], 'upschooling_mx_user_nc_fk'); } return $schema; } diff --git a/lib/Service/MatrixService.php b/lib/Service/MatrixService.php index d62406c..4ca0aed 100644 --- a/lib/Service/MatrixService.php +++ b/lib/Service/MatrixService.php @@ -114,7 +114,8 @@ class MatrixService null, [], [], - '/_synapse/admin/v1', true + '/_synapse/admin/v1', + true ); $randUsername = trim(str_replace(["/", "+"], ".", base64_encode(random_bytes(6))), "="); $username = "upschooling_" . $randUsername; @@ -134,7 +135,8 @@ class MatrixService ), [], [], - '/_synapse/admin/v1', true + '/_synapse/admin/v1', + true ); $matrixUser = new MatrixUser(); diff --git a/lib/Service/TicketService.php b/lib/Service/TicketService.php index 917a62d..55d3787 100644 --- a/lib/Service/TicketService.php +++ b/lib/Service/TicketService.php @@ -48,6 +48,8 @@ class TicketService { // id is to be set from the remote support-platform Nextcloud "title" => $title, "description" => $content, + "status" => "open", + "version" => "1", )); $ticket = new MatrixTicket(); $ticket->setMatrixRoom($roomId);