1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-23 22:10:55 +01:00

When a custom logo is configured but has a restrictive visibility policy, fall back to the default logo

Summary: Fixes T11982. Currently, configuring a custom logo and then setting the policy restrictively locks off the whole install.

Test Plan:
  - Configured `ui.logo`.
  - Searched for the file PHID in global search to find the underlying file.
  - Set the policy to something restrictive ("only me").
  - Purged cache (`bin/cache purge --purge-all`).
  - Restarted webserver to nuke APC.
  - Loaded a page as a different user.
  - Before change: policy exception while trying to load the logo.
  - After change: fallback to default logo.
  - Loaded page as user who can see the logo, got custom logo.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T11982

Differential Revision: https://secure.phabricator.com/D17011
This commit is contained in:
epriestley 2016-12-09 04:15:44 -08:00
parent ffdc082852
commit cde37acb4b

View file

@ -317,19 +317,26 @@ final class PhabricatorMainMenuView extends AphrontView {
$logo_uri = $cache->getKey($cache_key_logo);
if (!$logo_uri) {
$file = id(new PhabricatorFileQuery())
// NOTE: If the file policy has been changed to be restrictive, we'll
// miss here and just show the default logo. The cache will fill later
// when someone who can see the file loads the page. This might be a
// little spooky, see T11982.
$files = id(new PhabricatorFileQuery())
->setViewer($this->getViewer())
->withPHIDs(array($custom_header))
->executeOne();
->execute();
$file = head($files);
if ($file) {
$logo_uri = $file->getViewURI();
$cache->setKey($cache_key_logo, $logo_uri);
}
}
$logo_style[] = 'background-size: 40px 40px;';
$logo_style[] = 'background-position: 0 0;';
$logo_style[] = 'background-image: url('.$logo_uri.')';
if ($logo_uri) {
$logo_style[] = 'background-size: 40px 40px;';
$logo_style[] = 'background-position: 0 0;';
$logo_style[] = 'background-image: url('.$logo_uri.')';
}
}
$logo_node = phutil_tag(