aboutsummaryrefslogtreecommitdiffstats
path: root/apps/weather_status/lib
diff options
context:
space:
mode:
authorprovokateurin <kate@provokateurin.de>2024-07-25 13:14:51 +0200
committerprovokateurin <kate@provokateurin.de>2024-07-27 21:36:04 +0200
commitb1b6b51c111e70b4f09700bdab604e2f5ac74afa (patch)
treed01d1b0bac3540b0c07d01bf09eca56d83f39b35 /apps/weather_status/lib
parent212a621697cd32b65ea78fa90015cec9d9d1dfe3 (diff)
downloadnextcloud-server-b1b6b51c111e70b4f09700bdab604e2f5ac74afa.tar.gz
nextcloud-server-b1b6b51c111e70b4f09700bdab604e2f5ac74afa.zip
refactor(weather_status): Replace security annotations with respective attributes
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'apps/weather_status/lib')
-rw-r--r--apps/weather_status/lib/Controller/WeatherStatusController.php22
1 files changed, 8 insertions, 14 deletions
diff --git a/apps/weather_status/lib/Controller/WeatherStatusController.php b/apps/weather_status/lib/Controller/WeatherStatusController.php
index 8f3ceaa36ae..953e09f2f2d 100644
--- a/apps/weather_status/lib/Controller/WeatherStatusController.php
+++ b/apps/weather_status/lib/Controller/WeatherStatusController.php
@@ -11,6 +11,7 @@ namespace OCA\WeatherStatus\Controller;
use OCA\WeatherStatus\ResponseDefinitions;
use OCA\WeatherStatus\Service\WeatherStatusService;
use OCP\AppFramework\Http;
+use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
use OCP\IRequest;
@@ -33,21 +34,18 @@ class WeatherStatusController extends OCSController {
}
/**
- * @NoAdminRequired
- *
* Try to use the address set in user personal settings as weather location
*
* @return DataResponse<Http::STATUS_OK, WeatherStatusLocationWithSuccess, array{}>
*
* 200: Address updated
*/
+ #[NoAdminRequired]
public function usePersonalAddress(): DataResponse {
return new DataResponse($this->service->usePersonalAddress());
}
/**
- * @NoAdminRequired
- *
* Change the weather status mode. There are currently 2 modes:
* - ask the browser
* - use the user defined address
@@ -57,13 +55,12 @@ class WeatherStatusController extends OCSController {
*
* 200: Weather status mode updated
*/
+ #[NoAdminRequired]
public function setMode(int $mode): DataResponse {
return new DataResponse($this->service->setMode($mode));
}
/**
- * @NoAdminRequired
- *
* Set address and resolve it to get coordinates
* or directly set coordinates and get address with reverse geocoding
*
@@ -74,28 +71,26 @@ class WeatherStatusController extends OCSController {
*
* 200: Location updated
*/
+ #[NoAdminRequired]
public function setLocation(?string $address, ?float $lat, ?float $lon): DataResponse {
$currentWeather = $this->service->setLocation($address, $lat, $lon);
return new DataResponse($currentWeather);
}
/**
- * @NoAdminRequired
- *
* Get stored user location
*
* @return DataResponse<Http::STATUS_OK, WeatherStatusLocationWithMode, array{}>
*
* 200: Location returned
*/
+ #[NoAdminRequired]
public function getLocation(): DataResponse {
$location = $this->service->getLocation();
return new DataResponse($location);
}
/**
- * @NoAdminRequired
- *
* Get forecast for current location
*
* @return DataResponse<Http::STATUS_OK, WeatherStatusForecast[]|array{error: string}, array{}>|DataResponse<Http::STATUS_NOT_FOUND, WeatherStatusSuccess, array{}>
@@ -103,6 +98,7 @@ class WeatherStatusController extends OCSController {
* 200: Forecast returned
* 404: Forecast not found
*/
+ #[NoAdminRequired]
public function getForecast(): DataResponse {
$forecast = $this->service->getForecast();
if (isset($forecast['success']) && $forecast['success'] === false) {
@@ -113,21 +109,18 @@ class WeatherStatusController extends OCSController {
}
/**
- * @NoAdminRequired
- *
* Get favorites list
*
* @return DataResponse<Http::STATUS_OK, string[], array{}>
*
* 200: Favorites returned
*/
+ #[NoAdminRequired]
public function getFavorites(): DataResponse {
return new DataResponse($this->service->getFavorites());
}
/**
- * @NoAdminRequired
- *
* Set favorites list
*
* @param string[] $favorites Favorite addresses
@@ -135,6 +128,7 @@ class WeatherStatusController extends OCSController {
*
* 200: Favorites updated
*/
+ #[NoAdminRequired]
public function setFavorites(array $favorites): DataResponse {
return new DataResponse($this->service->setFavorites($favorites));
}