Fix runtime errors as a result of not encoding privileges as a JSON value.

This commit is contained in:
Jordan Bancino 2023-11-08 08:34:24 -05:00
parent a1bcbcf454
commit 647778ef82
2 changed files with 2 additions and 2 deletions

View file

@ -124,7 +124,7 @@ ROUTE_IMPL(RoutePrivileges, path, argp)
/* Fall through */
case HTTP_GET:
response = HashMapCreate();
HashMapSet(response, "privileges", UserEncodePrivileges(UserGetPrivileges(user)));
HashMapSet(response, "privileges", JsonValueArray(UserEncodePrivileges(UserGetPrivileges(user))));
break;
default:
HttpResponseStatus(args->context, HTTP_BAD_REQUEST);

View file

@ -749,7 +749,7 @@ UserGetPrivileges(User * user)
return USER_NONE;
}
return UserDecodePrivileges(HashMapGet(DbJson(user->ref), "privileges"));
return UserDecodePrivileges(JsonValueAsArray(HashMapGet(DbJson(user->ref), "privileges")));
}
int