$this->checkOAuthRequest();
} else {
$this->checkBasicAuthUser();
+ // By default, all basic auth users have read and write access
+
+ $this->access = self::READ_WRITE;
}
}
return true;
}
+ function handle($args)
+ {
+ parent::handle($args);
+
+ if ($this->isReadOnly($args) == false) {
+ if ($this->access == self::READ_ONLY) {
+ $this->clientError(_('API method requires write access.'), 401);
+ exit();
+ }
+ }
+ }
+
function checkOAuthRequest()
{
common_debug("We have an OAuth request.");
if ($this->oauth_access_type != 0) {
+ // Set the read or read-write access for the api call
+ $this->access = ($appUser->access_type & Oauth_application::$writeAccess)
+ ? self::READ_WRITE : self::READ_ONLY;
+
$this->auth_user = User::staticGet('id', $appUser->profile_id);
$msg = "API OAuth authentication for user '%s' (id: %d) on behalf of " .
exit;
}
}
+
return true;
}