Make "public" pastes meaningfully visible to logged-out users
Summary: - Introduce `shouldAllowPublic()`, indicating that logged-out users are OK in a controller if the install is configured to permit public policies. - Make Paste views and lists allow public users. - Make UI do sensible things with respect to disabling links, etc. - Improve behavior of "you need to login" with respect to policy exceptions and Ajax requests. Test Plan: Looked at "public" paste, saw all unavailable UI disabled, clicked it, got appropraite prompts. Reviewers: vrana, btrahan Reviewed By: vrana CC: aran Maniphest Tasks: T603 Differential Revision: https://secure.phabricator.com/D3502
This commit is contained in:
@@ -336,6 +336,18 @@ class AphrontDefaultApplicationConfiguration
|
||||
}
|
||||
|
||||
if ($ex instanceof PhabricatorPolicyException) {
|
||||
|
||||
if (!$user->isLoggedIn()) {
|
||||
// If the user isn't logged in, just give them a login form. This is
|
||||
// probably a generally more useful response than a policy dialog that
|
||||
// they have to click through to get a login form.
|
||||
//
|
||||
// Possibly we should add a header here like "you need to login to see
|
||||
// the thing you are trying to look at".
|
||||
$login_controller = new PhabricatorLoginController($request);
|
||||
return $login_controller->processRequest();
|
||||
}
|
||||
|
||||
$content =
|
||||
'<div class="aphront-policy-exception">'.
|
||||
phutil_escape_html($ex->getMessage()).
|
||||
|
||||
Reference in New Issue
Block a user