From 40108e73df02d828d85cf4c90202277e400f550b Mon Sep 17 00:00:00 2001 From: marcus Date: Wed, 24 Sep 2008 14:02:25 +0000 Subject: Added remove_api_user function git-svn-id: https://code.elgg.org/elgg/trunk@2111 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/api.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'engine/lib/api.php') diff --git a/engine/lib/api.php b/engine/lib/api.php index 3b84e9341..ac4e5edbd 100644 --- a/engine/lib/api.php +++ b/engine/lib/api.php @@ -647,7 +647,7 @@ } /** - * Find an API User's details based on the provided public api key. + * Find an API User's details based on the provided public api key. These users are not users in the traditional sense. * * @param int $site_guid The GUID of the site. * @param string $api_key The API Key @@ -663,6 +663,23 @@ return get_data_row("SELECT * from {$CONFIG->dbprefix}api_users where api_key='$api_key' and site_guid=$site_guid and active=1"); } + /** + * Revoke an api user key. + * + * @param int $site_guid The GUID of the site. + * @param string $api_key The API Key (public). + */ + function remove_api_user($site_guid, $api_key) + { + global $CONFIG; + + $keypair = get_api_user($site_guid, $api_key); + if ($keypair) + return delete_data("DELETE from {$CONFIG->dbprefix}api_users where id={$keypair->id}"); + + return false; + } + /** * This function looks at the super-global variable $_SERVER and extracts the various * header variables needed to pass to the validation functions after performing basic validation. -- cgit v1.2.3