From a9e7935190d8fc112e674add05e86b8d0152e8df Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Mon, 30 Mar 2020 15:28:55 +0200 Subject: [PATCH] Fix pronlems edit by admins --- client/src/parameters.js.dist | 5 ++++- client/src/views/News.vue | 7 ++++--- client/src/views/Problems.vue | 4 ++-- server/config/parameters.js.dist | 3 +++ server/models/Problem.js | 12 ++++++++---- server/routes/news.js | 14 ++++++++++---- server/routes/problems.js | 5 +++-- 7 files changed, 34 insertions(+), 16 deletions(-) diff --git a/client/src/parameters.js.dist b/client/src/parameters.js.dist index 2e47407e..b7f0899b 100644 --- a/client/src/parameters.js.dist +++ b/client/src/parameters.js.dist @@ -7,7 +7,10 @@ const Parameters = serverUrl: "http://localhost:3000", // "include" if the server is at a different address - credentials: "same-origin" + credentials: "same-origin", + + // IDs of users allowed to post news and edit any problem + devs: [] }; export default Parameters; diff --git a/client/src/views/News.vue b/client/src/views/News.vue index 97f0eb84..37bd3cae 100644 --- a/client/src/views/News.vue +++ b/client/src/views/News.vue @@ -17,7 +17,7 @@ main .row .col-sm-12.col-md-10.col-md-offset-1.col-lg-8.col-lg-offset-2 button#writeNewsBtn( - v-if="devs.includes(st.user.id)" + v-if="devTeam" @click="showModalNews" ) | {{ st.tr["Write news"] }} @@ -27,7 +27,7 @@ main :class="{margintop:idx>0}" ) span.ndt {{ formatDatetime(n.added) }} - .dev-buttons(v-if="devs.includes(st.user.id)") + .dev-buttons(v-if="devTeam") button(@click="editNews(n)") {{ st.tr["Edit"] }} button(@click="deleteNews(n)") {{ st.tr["Delete"] }} button(@click="gotoPrevNext(n, 1)") {{ st.tr["Previous_n"] }} @@ -43,14 +43,15 @@ main