99use OCA \Files_Sharing \External \Manager ;
1010use OCA \Files_Sharing \ResponseDefinitions ;
1111use OCP \AppFramework \Http ;
12+ use OCP \AppFramework \Http \Attribute \NoAdminRequired ;
1213use OCP \AppFramework \Http \DataResponse ;
1314use OCP \AppFramework \OCS \OCSForbiddenException ;
1415use OCP \AppFramework \OCS \OCSNotFoundException ;
2122 */
2223class RemoteController extends OCSController {
2324 /**
24- * @NoAdminRequired
25- *
2625 * Remote constructor.
2726 *
2827 * @param string $appName
@@ -39,21 +38,18 @@ public function __construct(
3938 }
4039
4140 /**
42- * @NoAdminRequired
43- *
4441 * Get list of pending remote shares
4542 *
4643 * @return DataResponse<Http::STATUS_OK, Files_SharingRemoteShare[], array{}>
4744 *
4845 * 200: Pending remote shares returned
4946 */
47+ #[NoAdminRequired]
5048 public function getOpenShares () {
5149 return new DataResponse ($ this ->externalManager ->getOpenShares ());
5250 }
5351
5452 /**
55- * @NoAdminRequired
56- *
5753 * Accept a remote share
5854 *
5955 * @param int $id ID of the share
@@ -62,6 +58,7 @@ public function getOpenShares() {
6258 *
6359 * 200: Share accepted successfully
6460 */
61+ #[NoAdminRequired]
6562 public function acceptShare ($ id ) {
6663 if ($ this ->externalManager ->acceptShare ($ id )) {
6764 return new DataResponse ();
@@ -74,8 +71,6 @@ public function acceptShare($id) {
7471 }
7572
7673 /**
77- * @NoAdminRequired
78- *
7974 * Decline a remote share
8075 *
8176 * @param int $id ID of the share
@@ -84,6 +79,7 @@ public function acceptShare($id) {
8479 *
8580 * 200: Share declined successfully
8681 */
82+ #[NoAdminRequired]
8783 public function declineShare ($ id ) {
8884 if ($ this ->externalManager ->declineShare ($ id )) {
8985 return new DataResponse ();
@@ -117,14 +113,13 @@ private static function extendShareInfo($share) {
117113 }
118114
119115 /**
120- * @NoAdminRequired
121- *
122116 * Get a list of accepted remote shares
123117 *
124118 * @return DataResponse<Http::STATUS_OK, Files_SharingRemoteShare[], array{}>
125119 *
126120 * 200: Accepted remote shares returned
127121 */
122+ #[NoAdminRequired]
128123 public function getShares () {
129124 $ shares = $ this ->externalManager ->getAcceptedShares ();
130125 $ shares = array_map ('self::extendShareInfo ' , $ shares );
@@ -133,8 +128,6 @@ public function getShares() {
133128 }
134129
135130 /**
136- * @NoAdminRequired
137- *
138131 * Get info of a remote share
139132 *
140133 * @param int $id ID of the share
@@ -143,6 +136,7 @@ public function getShares() {
143136 *
144137 * 200: Share returned
145138 */
139+ #[NoAdminRequired]
146140 public function getShare ($ id ) {
147141 $ shareInfo = $ this ->externalManager ->getShare ($ id );
148142
@@ -155,8 +149,6 @@ public function getShare($id) {
155149 }
156150
157151 /**
158- * @NoAdminRequired
159- *
160152 * Unshare a remote share
161153 *
162154 * @param int $id ID of the share
@@ -166,6 +158,7 @@ public function getShare($id) {
166158 *
167159 * 200: Share unshared successfully
168160 */
161+ #[NoAdminRequired]
169162 public function unshare ($ id ) {
170163 $ shareInfo = $ this ->externalManager ->getShare ($ id );
171164
0 commit comments