Make PhameBlogs respect policies
Summary: Adds "can view" and "can edit" policies to blogs. Replaces "bloggers" with "can join". This doesn't fully remove "bloggers" because I didn't want this to get too crazy/huge. Test Plan: Created, edited, deleted blogs. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T1373 Differential Revision: https://secure.phabricator.com/D3693
This commit is contained in:
@@ -137,8 +137,18 @@ abstract class AphrontApplicationConfiguration {
|
||||
if ($host != id(new PhutilURI($base_uri))->getDomain() &&
|
||||
$host != id(new PhutilURI($prod_uri))->getDomain() &&
|
||||
$host != id(new PhutilURI($file_uri))->getDomain()) {
|
||||
$blogs = id(new PhameBlogQuery())->withDomain($host)->execute();
|
||||
$blog = reset($blogs);
|
||||
|
||||
try {
|
||||
$blog = id(new PhameBlogQuery())
|
||||
->setViewer($request->getUser())
|
||||
->withDomain($host)
|
||||
->executeOne();
|
||||
} catch (PhabricatorPolicyException $ex) {
|
||||
throw new Exception(
|
||||
"This blog is not visible to logged out users, so it can not be ".
|
||||
"visited from a custom domain.");
|
||||
}
|
||||
|
||||
if (!$blog) {
|
||||
if ($prod_uri && $prod_uri != $base_uri) {
|
||||
$prod_str = ' or '.$prod_uri;
|
||||
|
||||
Reference in New Issue
Block a user