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:
epriestley
2012-10-15 14:49:52 -07:00
parent 304599eab0
commit dbcf2e44e8
13 changed files with 184 additions and 132 deletions

View File

@@ -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;