Changed permission for deleting,

This commit is contained in:
Ben Arc 2021-04-21 16:00:11 +01:00
parent 39561efe38
commit 71a6d90283
2 changed files with 6 additions and 3 deletions

View file

@ -155,12 +155,15 @@
><span class="text-blue">GET</span> ><span class="text-blue">GET</span>
/api/v1/copilot/ws/&lt;copilot_id&gt;/&lt;comment&gt;/&lt;data&gt;</code /api/v1/copilot/ws/&lt;copilot_id&gt;/&lt;comment&gt;/&lt;data&gt;</code
> >
<h5 class="text-caption q-mt-sm q-mb-none">Headers</h5>
<code>{"X-Api-Key": &lt;admin_key&gt;}</code><br />
<h5 class="text-caption q-mt-sm q-mb-none">Returns 200</h5> <h5 class="text-caption q-mt-sm q-mb-none">Returns 200</h5>
<code></code> <code></code>
<h5 class="text-caption q-mt-sm q-mb-none">Curl example</h5> <h5 class="text-caption q-mt-sm q-mb-none">Curl example</h5>
<code <code
>curl -X GET {{ request.url_root }}/api/v1/copilot/ws/&lt;string, >curl -X GET {{ request.url_root }}/api/v1/copilot/ws/&lt;string,
copilot_id&gt;/&lt;string, comment&gt;/&lt;string, gif name&gt; copilot_id&gt;/&lt;string, comment&gt;/&lt;string, gif name&gt; -H
"X-Api-Key: {{ g.user.wallets[0].adminkey }}"
</code> </code>
</q-card-section> </q-card-section>
</q-card> </q-card>

View file

@ -82,7 +82,7 @@ async def api_copilot_retrieve(copilot_id):
@copilot_ext.route("/api/v1/copilot/<copilot_id>", methods=["DELETE"]) @copilot_ext.route("/api/v1/copilot/<copilot_id>", methods=["DELETE"])
@api_check_wallet_key("invoice") @api_check_wallet_key("admin")
async def api_copilot_delete(copilot_id): async def api_copilot_delete(copilot_id):
copilot = await get_copilot(copilot_id) copilot = await get_copilot(copilot_id)
@ -95,11 +95,11 @@ async def api_copilot_delete(copilot_id):
@copilot_ext.route("/api/v1/copilot/ws/<copilot_id>/<comment>/<data>", methods=["GET"]) @copilot_ext.route("/api/v1/copilot/ws/<copilot_id>/<comment>/<data>", methods=["GET"])
@api_check_wallet_key("admin")
async def api_copilot_ws_relay(copilot_id, comment, data): async def api_copilot_ws_relay(copilot_id, comment, data):
copilot = await get_copilot(copilot_id) copilot = await get_copilot(copilot_id)
if not copilot: if not copilot:
return jsonify({"message": "copilot does not exist"}), HTTPStatus.NOT_FOUND return jsonify({"message": "copilot does not exist"}), HTTPStatus.NOT_FOUND
await updater(data, comment, copilot_id) await updater(data, comment, copilot_id)
print(comment)
return "", HTTPStatus.OK return "", HTTPStatus.OK