Page MenuHomePhabricator

D7380.id16622.diff
No OneTemporary

D7380.id16622.diff

Index: src/applications/conduit/call/ConduitCall.php
===================================================================
--- src/applications/conduit/call/ConduitCall.php
+++ 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
Index: src/applications/conduit/method/ConduitAPIMethod.php
===================================================================
--- src/applications/conduit/method/ConduitAPIMethod.php
+++ src/applications/conduit/method/ConduitAPIMethod.php
@@ -104,6 +104,10 @@
return true;
}
+ public function shouldAllowPublic() {
+ return false;
+ }
+
public function shouldAllowUnguardedWrites() {
return false;
}
Index: src/applications/diffusion/conduit/ConduitAPI_diffusion_abstractquery_Method.php
===================================================================
--- src/applications/diffusion/conduit/ConduitAPI_diffusion_abstractquery_Method.php
+++ 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/plain
Expires
Mar 24 2025, 11:24 AM (6 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7223126
Default Alt Text
D7380.id16622.diff (2 KB)

Event Timeline