summaryrefslogtreecommitdiff
path: root/classes/Consumer.php
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-02-02 06:26:03 +0000
committerZach Copley <zach@status.net>2010-02-05 03:18:43 +0000
commite495ac356c10a6abc0e10c81892830b5e198ef60 (patch)
tree1a0b321221a7ddaf38132d057bb1f02b8f39e61e /classes/Consumer.php
parentdc183f23cf3bd8e0fbd604ad2af4b12f77837bf2 (diff)
Allow developers to delete OAuth applications
Diffstat (limited to 'classes/Consumer.php')
-rw-r--r--classes/Consumer.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/classes/Consumer.php b/classes/Consumer.php
index ad64a8491..ce399f278 100644
--- a/classes/Consumer.php
+++ b/classes/Consumer.php
@@ -36,4 +36,34 @@ class Consumer extends Memcached_DataObject
return $cons;
}
+ /**
+ * Delete a Consumer and related tokens and nonces
+ *
+ * XXX: Should this happen in an OAuthDataStore instead?
+ *
+ */
+ function delete()
+ {
+ // XXX: Is there any reason NOT to do this kind of cleanup?
+
+ $this->_deleteTokens();
+ $this->_deleteNonces();
+
+ parent::delete();
+ }
+
+ function _deleteTokens()
+ {
+ $token = new Token();
+ $token->consumer_key = $this->consumer_key;
+ $token->delete();
+ }
+
+ function _deleteNonces()
+ {
+ $nonce = new Nonce();
+ $nonce->consumer_key = $this->consumer_key;
+ $nonce->delete();
+ }
+
}