summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-02-02 08:48:52 +0000
committerZach Copley <zach@status.net>2010-02-02 08:48:52 +0000
commit2be00ce64221197f3c8ad1458eba2488c8836e5c (patch)
treeb3fd0ee62c631f53b2c8670ec1f109283b2d6b34 /classes
parent952b5806987e12a34e6fd75509b5d78815c1aa2d (diff)
parent5e90f744a6fb58c43f8f5332ef868ba38e82b3d1 (diff)
Merge branch 'oauth-continued' into 0.9.x
Diffstat (limited to 'classes')
-rw-r--r--classes/Consumer.php30
-rw-r--r--classes/Oauth_application.php17
-rw-r--r--classes/statusnet.ini3
3 files changed, 49 insertions, 1 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();
+ }
+
}
diff --git a/classes/Oauth_application.php b/classes/Oauth_application.php
index a6b539087..748b64220 100644
--- a/classes/Oauth_application.php
+++ b/classes/Oauth_application.php
@@ -137,4 +137,21 @@ class Oauth_application extends Memcached_DataObject
}
}
+ function delete()
+ {
+ $this->_deleteAppUsers();
+
+ $consumer = $this->getConsumer();
+ $consumer->delete();
+
+ parent::delete();
+ }
+
+ function _deleteAppUsers()
+ {
+ $oauser = new Oauth_application_user();
+ $oauser->application_id = $this->id;
+ $oauser->delete();
+ }
+
}
diff --git a/classes/statusnet.ini b/classes/statusnet.ini
index 6203650a6..4ace4407b 100644
--- a/classes/statusnet.ini
+++ b/classes/statusnet.ini
@@ -353,7 +353,7 @@ notice_id = K
id = 129
owner = 129
consumer_key = 130
-name = 130
+name = 2
description = 2
icon = 130
source_url = 2
@@ -367,6 +367,7 @@ modified = 384
[oauth_application__keys]
id = N
+name = U
[oauth_application_user]
profile_id = 129