99
1010namespace OCA \DAV \Controller ;
1111
12+ use NCU \AppFramework \Http \Attribute \TokenScope ;
1213use OCA \DAV \AppInfo \Application ;
1314use OCA \DAV \CalDAV \Federation \FederatedCalendarEntity ;
1415use OCA \DAV \CalDAV \Federation \FederatedCalendarInvitationService ;
1516use OCA \DAV \CalDAV \Federation \FederatedCalendarMapper ;
1617use OCA \DAV \ResponseDefinitions ;
18+ use OCA \DAV \TokenScopes ;
1719use OCP \AppFramework \Db \DoesNotExistException ;
1820use OCP \AppFramework \Http ;
1921use OCP \AppFramework \Http \Attribute \NoAdminRequired ;
@@ -44,6 +46,7 @@ public function __construct(
4446 * 401: When the user is not logged in
4547 */
4648 #[NoAdminRequired]
49+ #[TokenScope(scope: TokenScopes::CALENDAR_READ )]
4750 public function getPending (): DataResponse {
4851 if ($ this ->userId === null ) {
4952 return new DataResponse (null , Http::STATUS_UNAUTHORIZED );
@@ -76,6 +79,7 @@ public function getPending(): DataResponse {
7679 * 200: Invitation accepted successfully
7780 */
7881 #[NoAdminRequired]
82+ #[TokenScope(scope: TokenScopes::CALENDAR_WRITE )]
7983 public function accept (int $ id ): DataResponse {
8084 $ this ->invitationService ->accept ($ this ->getPendingCalendar ($ id ));
8185 return new DataResponse (null );
@@ -91,6 +95,7 @@ public function accept(int $id): DataResponse {
9195 * 200: Invitation declined successfully
9296 */
9397 #[NoAdminRequired]
98+ #[TokenScope(scope: TokenScopes::CALENDAR_WRITE )]
9499 public function decline (int $ id ): DataResponse {
95100 $ this ->invitationService ->decline ($ this ->getPendingCalendar ($ id ));
96101 return new DataResponse (null );
0 commit comments