Page MenuHomePhabricator

D7380.diff

diff --git a/src/applications/conduit/call/ConduitCall.php b/src/applications/conduit/call/ConduitCall.php
--- a/src/applications/conduit/call/ConduitCall.php
+++ b/src/applications/conduit/call/ConduitCall.php
@@ -86,10 +86,17 @@
$this->request->setUser($user);
- if ($this->shouldRequireAuthentication()) {
- // TODO: As per below, this should get centralized and cleaned up.
- if (!$user->isLoggedIn() && !$user->isOmnipotent()) {
- throw new ConduitException("ERR-INVALID-AUTH");
+ if (!$this->shouldRequireAuthentication()) {
+ // No auth requirement here.
+ } else {
+
+ $allow_public = $this->handler->shouldAllowPublic() &&
+ PhabricatorEnv::getEnvConfig('policy.allow-public');
+ if (!$allow_public) {
+ if (!$user->isLoggedIn() && !$user->isOmnipotent()) {
+ // TODO: As per below, this should get centralized and cleaned up.
+ throw new ConduitException("ERR-INVALID-AUTH");
+ }
}
// TODO: This would be slightly cleaner by just using a Query, but the
diff --git a/src/applications/conduit/method/ConduitAPIMethod.php b/src/applications/conduit/method/ConduitAPIMethod.php
--- a/src/applications/conduit/method/ConduitAPIMethod.php
+++ b/src/applications/conduit/method/ConduitAPIMethod.php
@@ -104,6 +104,10 @@
return true;
}
+ public function shouldAllowPublic() {
+ return false;
+ }
+
public function shouldAllowUnguardedWrites() {
return false;
}
diff --git a/src/applications/diffusion/conduit/ConduitAPI_diffusion_abstractquery_Method.php b/src/applications/diffusion/conduit/ConduitAPI_diffusion_abstractquery_Method.php
--- a/src/applications/diffusion/conduit/ConduitAPI_diffusion_abstractquery_Method.php
+++ b/src/applications/diffusion/conduit/ConduitAPI_diffusion_abstractquery_Method.php
@@ -6,9 +6,14 @@
abstract class ConduitAPI_diffusion_abstractquery_Method
extends ConduitAPI_diffusion_Method {
+ public function shouldAllowPublic() {
+ return true;
+ }
+
public function getMethodStatus() {
return self::METHOD_STATUS_UNSTABLE;
}
+
public function getMethodStatusDescription() {
return pht(
'See T2784 - migrating diffusion working copy calls to conduit methods. '.

File Metadata

Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/fv/x6/koloafxzegefltje
Default Alt Text
D7380.diff (2 KB)

Event Timeline