]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
add is_readonly() to api.php
authorEvan Prodromou <evan@prodromou.name>
Fri, 24 Oct 2008 20:12:34 +0000 (16:12 -0400)
committerEvan Prodromou <evan@prodromou.name>
Fri, 24 Oct 2008 20:12:34 +0000 (16:12 -0400)
darcs-hash:20081024201234-84dde-06d2c147ec967cb8123ee0639a76f00a5f44e5c5.gz

actions/api.php

index 77e20073dfe010825747af6e4bf2e27efb01bcc2..ea4553543e144f3eaca055417db303436e412cc2 100644 (file)
@@ -160,4 +160,25 @@ class ApiAction extends Action {
                }
        }
 
+       function is_readonly() {
+               # NOTE: before handle(), can't use $this->arg
+               $apiaction = $_REQUEST['apiaction'];
+               $method = $_REQUEST['method'];
+               list($cmdtext, $fmt) = explode('.', $method);
+               
+               # FIXME: probably need a table here, instead of this switch
+               
+               switch ($apiaction) {
+                case 'statuses':
+                       switch ($cmdtext) {
+                        case 'update':
+                        case 'destroy':
+                               return false;
+                        default:
+                               return true;
+                       }
+                default: 
+                       return false;
+               }
+       }
 }