1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2026-01-09 09:29:16 +00:00

add per-user option to enable access to API

This commit is contained in:
Andrew Dolgov
2009-12-16 14:36:59 +03:00
parent f5a5bae463
commit 3a216db45c
7 changed files with 25 additions and 7 deletions

View File

@@ -44,11 +44,10 @@
return;
}
/* TODO: add pref key to disable/enable API
if ($_SESSION["uid"] && !get_pref($link, 'API_ENABLED')) {
if ($_SESSION["uid"] && $op != "logout" && !get_pref($link, 'ENABLE_API_ACCESS')) {
print json_encode(array("error" => 'API_DISABLED'));
return;
} */
}
switch ($op) {
case "getVersion":
@@ -62,7 +61,7 @@
if (authenticate_user($link, $login, $password)) {
print json_encode(array("uid" => $_SESSION["uid"]));
} else {
print json_encode(array("uid" => 0));
print json_encode(array("error" => "LOGIN_ERROR"));
}
break;