2929use OCA \Deck \Service \PermissionService ;
3030use OCA \Deck \Service \SessionService ;
3131use OCP \AppFramework \Db \DoesNotExistException ;
32+ use OCP \AppFramework \Http \Attribute \NoAdminRequired ;
33+ use OCP \AppFramework \Http \Attribute \NoCSRFRequired ;
3234use OCP \AppFramework \Http \DataResponse ;
3335use OCP \AppFramework \OCSController ;
3436use OCP \IRequest ;
@@ -43,9 +45,7 @@ public function __construct($appName,
4345 parent ::__construct ($ appName , $ request );
4446 }
4547
46- /**
47- * @NoAdminRequired
48- */
48+ #[NoAdminRequired]
4949 public function create (int $ boardId ): DataResponse {
5050 $ this ->permissionService ->checkPermission ($ this ->boardMapper , $ boardId , Acl::PERMISSION_READ );
5151
@@ -55,11 +55,7 @@ public function create(int $boardId): DataResponse {
5555 ]);
5656 }
5757
58- /**
59- * notifies the server that the session is still active
60- * @NoAdminRequired
61- * @param $boardId
62- */
58+ #[NoAdminRequired]
6359 public function sync (int $ boardId , string $ token ): DataResponse {
6460 $ this ->permissionService ->checkPermission ($ this ->boardMapper , $ boardId , Acl::PERMISSION_READ );
6561 try {
@@ -70,13 +66,12 @@ public function sync(int $boardId, string $token): DataResponse {
7066 }
7167 }
7268
73- /**
74- * delete a session if existing
75- * @NoAdminRequired
76- * @NoCSRFRequired
77- * @param $boardId
78- */
79- public function close (int $ boardId , string $ token ) {
69+ #[NoAdminRequired]
70+ #[NoCSRFRequired]
71+ public function close (int $ boardId , string $ token = null ): DataResponse {
72+ if ($ token === null ) {
73+ return new DataResponse ();
74+ }
8075 $ this ->permissionService ->checkPermission ($ this ->boardMapper , $ boardId , Acl::PERMISSION_READ );
8176 $ this ->sessionService ->closeSession ($ boardId , $ token );
8277 return new DataResponse ();
0 commit comments