update admin permission

This commit is contained in:
Tony Yang 2019-09-25 16:47:05 +08:00
parent 69089cc2eb
commit 1e14100610
Signed by: t510599
GPG Key ID: D88388851C28715D

View File

@ -33,6 +33,10 @@ if ($_SERVER["REQUEST_METHOD"] == "PATCH" || $_SERVER["REQUEST_METHOD"] == "POST
// create new user, but user exists
send_error(409, "userexists");
}
// you cannot modify data of those with higher permission than you
if ($target_user->level > $user->level) {
send_error(403, "nopermission");
}
} catch (NoUserException $e) {
if ($_SERVER["REQUEST_METHOD"] == "PATCH") {
// modify one that not exist -> error