From 82463ea42370aed7fc1edc0b648e337f11d4dd1b Mon Sep 17 00:00:00 2001 From: Joey Yakimowich-Payne Date: Wed, 8 Aug 2018 19:09:54 +0900 Subject: [PATCH] Add server check for category adding --- src/forum.nim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/forum.nim b/src/forum.nim index ac67c51..6e35d03 100644 --- a/src/forum.nim +++ b/src/forum.nim @@ -666,6 +666,12 @@ proc executeLike(c: TForumData, postId: int) = exec(db, crud(crCreate, "like", "author", "post"), c.userid, postId) proc executeNewCategory(c: TForumData, name, color, description: string): int64 = + + let canAdd = c.rank == Admin + + if not canAdd: + raise newForumError("You do not have permissions to add a category.") + if name.len == 0: raise newForumError("Category name must not be empty!", @["name"])