aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/api.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/api.php')
-rw-r--r--engine/lib/api.php19
1 files changed, 18 insertions, 1 deletions
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
@@ -664,6 +664,23 @@
}
/**
+ * 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.
*