Skip to content

Commit 561d309

Browse files
authored
appapi-2.0.3-api-scopes (#216)
Ref: nextcloud/app_api#220 No more "optional API Scopes", lets make all simpler :) Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
1 parent 0a183e7 commit 561d309

File tree

19 files changed

+31
-122
lines changed

19 files changed

+31
-122
lines changed

docs/NextcloudApp.rst

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,8 @@ First of all, we modernize info.ixml, add the API groups we need for this to wor
151151
.. code-block:: xml
152152
153153
<scopes>
154-
<required>
155-
<value>FILES</value>
156-
<value>NOTIFICATIONS</value>
157-
</required>
158-
<optional>
159-
</optional>
154+
<value>FILES</value>
155+
<value>NOTIFICATIONS</value>
160156
</scopes>
161157
162158
.. note:: Full list of avalaible API scopes can be found `here <https://cloud-py-api.github.io/app_api/tech_details/ApiScopes.html>`_.

docs/NextcloudTalkBot.rst

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,8 @@ The first step is to add the **TALK_BOT** and **TALK** scopes to your `info.xml`
1313
.. code-block:: xml
1414
1515
<scopes>
16-
<required>
17-
<value>TALK</value>
18-
<value>TALK_BOT</value>
19-
</required>
20-
<optional>
21-
</optional>
16+
<value>TALK</value>
17+
<value>TALK_BOT</value>
2218
</scopes>
2319
2420
The TALK_BOT scope enables your application to register the bot within the Nextcloud system, while the TALK scope permits access to Talk's endpoints.

docs/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
nitpick_ignore_regex = [
6868
(r"py:class", r"starlette\.requests\.Request"),
6969
(r"py:class", r"starlette\.requests\.HTTPConnection"),
70+
(r"py:class", r"ComputedFieldInfo"),
7071
(r"py:.*", r"httpx.*"),
7172
]
7273

examples/as_app/skeleton/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,19 @@ run:
6969
register27:
7070
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
7171
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register skeleton manual_install --json-info \
72-
"{\"appid\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":{\"required\":[],\"optional\":[]},\"system_app\":0}" \
72+
"{\"appid\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":[],\"system_app\":0}" \
7373
--force-scopes --wait-finish
7474

7575
.PHONY: register28
7676
register28:
7777
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
7878
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:register skeleton manual_install --json-info \
79-
"{\"appid\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":{\"required\":[],\"optional\":[]},\"system_app\":0}" \
79+
"{\"appid\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":[],\"system_app\":0}" \
8080
--force-scopes --wait-finish
8181

8282
.PHONY: register
8383
register:
8484
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
8585
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register skeleton manual_install --json-info \
86-
"{\"appid\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":{\"required\":[],\"optional\":[]},\"system_app\":0}" \
86+
"{\"appid\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":[],\"system_app\":0}" \
8787
--force-scopes --wait-finish

examples/as_app/skeleton/appinfo/info.xml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<bugs>https://github.com/cloud-py-api/nc_py_api/issues</bugs>
1717
<repository type="git">https://github.com/cloud-py-api/nc_py_api</repository>
1818
<dependencies>
19-
<nextcloud min-version="27" max-version="29"/>
19+
<nextcloud min-version="27" max-version="30"/>
2020
</dependencies>
2121
<external-app>
2222
<docker-install>
@@ -25,10 +25,6 @@
2525
<image-tag>latest</image-tag>
2626
</docker-install>
2727
<scopes>
28-
<required>
29-
</required>
30-
<optional>
31-
</optional>
3228
</scopes>
3329
<system>false</system>
3430
</external-app>

examples/as_app/talk_bot/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ run27:
5454
register:
5555
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister talk_bot --silent --force || true
5656
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register talk_bot manual_install --json-info \
57-
"{\"appid\":\"talk_bot\",\"name\":\"TalkBot\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9032,\"scopes\":{\"required\":[\"TALK\", \"TALK_BOT\"],\"optional\":[]},\"system_app\":0}" \
57+
"{\"appid\":\"talk_bot\",\"name\":\"TalkBot\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9032,\"scopes\":[\"TALK\", \"TALK_BOT\"],\"system_app\":0}" \
5858
--force-scopes --wait-finish
5959

6060
.PHONY: register27
6161
register27:
6262
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister talk_bot --force || true
6363
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register talk_bot manual_install --json-info \
64-
"{\"appid\":\"talk_bot\",\"name\":\"TalkBot\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9032,\"scopes\":{\"required\":[\"TALK\", \"TALK_BOT\"],\"optional\":[]},\"system_app\":0}" \
64+
"{\"appid\":\"talk_bot\",\"name\":\"TalkBot\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9032,\"scopes\":[\"TALK\", \"TALK_BOT\"],\"system_app\":0}" \
6565
--force-scopes --wait-finish

examples/as_app/talk_bot/appinfo/info.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,8 @@
2525
<image-tag>latest</image-tag>
2626
</docker-install>
2727
<scopes>
28-
<required>
29-
<value>TALK</value>
30-
<value>TALK_BOT</value>
31-
</required>
32-
<optional>
33-
</optional>
28+
<value>TALK</value>
29+
<value>TALK_BOT</value>
3430
</scopes>
3531
<system>false</system>
3632
</external-app>

examples/as_app/talk_bot_ai/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ run27:
5454
register:
5555
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister talk_bot_ai --silent --force || true
5656
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register talk_bot_ai manual_install --json-info \
57-
"{\"appid\":\"talk_bot_ai\",\"name\":\"TalkBotAI\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9034,\"scopes\":{\"required\":[\"TALK\", \"TALK_BOT\"],\"optional\":[]},\"system_app\":0}" \
57+
"{\"appid\":\"talk_bot_ai\",\"name\":\"TalkBotAI\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9034,\"scopes\":[\"TALK\", \"TALK_BOT\"],\"system_app\":0}" \
5858
--force-scopes --wait-finish
5959

6060
.PHONY: register27
6161
register27:
6262
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister talk_bot_ai --silent --force || true
6363
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register talk_bot_ai manual_install --json-info \
64-
"{\"appid\":\"talk_bot_ai\",\"name\":\"TalkBotAI\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9034,\"scopes\":{\"required\":[\"TALK\", \"TALK_BOT\"],\"optional\":[]},\"system_app\":0}" \
64+
"{\"appid\":\"talk_bot_ai\",\"name\":\"TalkBotAI\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9034,\"scopes\":[\"TALK\", \"TALK_BOT\"],\"system_app\":0}" \
6565
--force-scopes --wait-finish

examples/as_app/talk_bot_ai/appinfo/info.xml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,8 @@
2525
<image-tag>latest</image-tag>
2626
</docker-install>
2727
<scopes>
28-
<required>
29-
<value>TALK</value>
30-
<value>TALK_BOT</value>
31-
</required>
32-
<optional>
33-
</optional>
28+
<value>TALK</value>
29+
<value>TALK_BOT</value>
3430
</scopes>
3531
<system>false</system>
3632
</external-app>

examples/as_app/to_gif/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,19 @@ run:
6969
register27:
7070
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister to_gif --silent --force || true
7171
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register to_gif manual_install --json-info \
72-
"{\"appid\":\"to_gif\",\"name\":\"to_gif\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9031,\"scopes\":{\"required\":[\"FILES\", \"NOTIFICATIONS\"],\"optional\":[]},\"system_app\":0}" \
72+
"{\"appid\":\"to_gif\",\"name\":\"to_gif\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9031,\"scopes\":[\"FILES\", \"NOTIFICATIONS\"],\"system_app\":0}" \
7373
--force-scopes --wait-finish
7474

7575
.PHONY: register28
7676
register28:
7777
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:unregister to_gif --silent --force || true
7878
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:register to_gif manual_install --json-info \
79-
"{\"appid\":\"to_gif\",\"name\":\"to_gif\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9031,\"scopes\":{\"required\":[\"FILES\", \"NOTIFICATIONS\"],\"optional\":[]},\"system_app\":0}" \
79+
"{\"appid\":\"to_gif\",\"name\":\"to_gif\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9031,\"scopes\":[\"FILES\", \"NOTIFICATIONS\"],\"system_app\":0}" \
8080
--force-scopes --wait-finish
8181

8282
.PHONY: register
8383
register:
8484
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister to_gif --silent --force || true
8585
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register to_gif manual_install --json-info \
86-
"{\"appid\":\"to_gif\",\"name\":\"to_gif\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9031,\"scopes\":{\"required\":[\"FILES\", \"NOTIFICATIONS\"],\"optional\":[]},\"system_app\":0}" \
86+
"{\"appid\":\"to_gif\",\"name\":\"to_gif\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9031,\"scopes\":[\"FILES\", \"NOTIFICATIONS\"],\"system_app\":0}" \
8787
--force-scopes --wait-finish

0 commit comments

Comments
 (0)