Only admins can add or delete tags

This commit is contained in:
Alex Ling
2020-12-30 11:12:39 +00:00
parent 981a1f0226
commit 93f745aecb
3 changed files with 12 additions and 11 deletions

View File

@@ -715,7 +715,8 @@ class APIRouter < Router
Koa.describe "Adds a new tag to a title"
Koa.path "tid", desc: "A title ID"
Koa.response 200, ref: "$result"
put "/api/tags/:tid/:tag" do |env|
Koa.tag "admin"
put "/api/admin/tags/:tid/:tag" do |env|
begin
title = (@context.library.get_title env.params.url["tid"]).not_nil!
tag = env.params.url["tag"]
@@ -737,7 +738,8 @@ class APIRouter < Router
Koa.describe "Deletes a tag from a title"
Koa.path "tid", desc: "A title ID"
Koa.response 200, ref: "$result"
delete "/api/tags/:tid/:tag" do |env|
Koa.tag "admin"
delete "/api/admin/tags/:tid/:tag" do |env|
begin
title = (@context.library.get_title env.params.url["tid"]).not_nil!
tag = env.params.url["tag"]