Add server check for category adding
This commit is contained in:
parent
f1c5db2ced
commit
82463ea423
1 changed files with 6 additions and 0 deletions
|
|
@ -666,6 +666,12 @@ proc executeLike(c: TForumData, postId: int) =
|
||||||
exec(db, crud(crCreate, "like", "author", "post"), c.userid, postId)
|
exec(db, crud(crCreate, "like", "author", "post"), c.userid, postId)
|
||||||
|
|
||||||
proc executeNewCategory(c: TForumData, name, color, description: string): int64 =
|
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:
|
if name.len == 0:
|
||||||
raise newForumError("Category name must not be empty!", @["name"])
|
raise newForumError("Category name must not be empty!", @["name"])
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue