]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Ensure only the application's owner can edit it
authorZach Copley <zach@status.net>
Wed, 13 Jan 2010 18:20:03 +0000 (18:20 +0000)
committerZach Copley <zach@status.net>
Thu, 14 Jan 2010 02:41:09 +0000 (02:41 +0000)
actions/editapplication.php

index a6db87c61e21747479b608064b9c9f91c698d988..9cc3e3cead0cac9670a11f2761d7e0f5d9f11118 100644 (file)
@@ -45,9 +45,9 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
 
 class EditApplicationAction extends OwnerDesignAction
 {
-    var $msg = null;
-
-    var $app = null;
+    var $msg   = null;
+    var $owner = null;
+    var $app   = null;
 
     function title()
     {
@@ -68,7 +68,14 @@ class EditApplicationAction extends OwnerDesignAction
         }
 
         $id = (int)$this->arg('id');
-        $this->app = Oauth_application::staticGet($id);
+
+        $this->app   = Oauth_application::staticGet($id);
+        $this->owner = User::staticGet($this->app->owner);
+        $cur         = common_current_user();
+
+        if ($cur->id != $this->owner->id) {
+            $this->clientError(_('You are not the owner of this application.'), 401);
+        }
 
         if (!$this->app) {
             $this->clientError(_('No such application.'));