Commit 969b2a6f authored by Aaron Wells's avatar Aaron Wells

Marking a page objectionable caused it to be hidden

Bug 1298646: Objectionable pages are meant to remain visible
to users until an admin comes along and deletes them. They were
accidentally being hidden due to a bug in the logic flow in
can_view_view()

Change-Id: I2929e11adc048af58b451892bae1c5789af8dcf0
parent daf39f44
......@@ -2253,12 +2253,6 @@ function can_view_view($view, $user_id=null) {
return true;
}
$access = View::user_access_records($view_id, $user_id);
if (empty($access)) {
return false;
}
// If the view's owner is suspended, deny access to the view
if ($view->get('owner')) {
if ((!$owner = $view->get_owner_object()) || $owner->suspendedctime) {
......@@ -2266,6 +2260,24 @@ function can_view_view($view, $user_id=null) {
}
}
if ($SESSION->get('mnetuser')) {
$mnettoken = get_cookie('mviewaccess:' . $view_id);
}
// If the page has been marked "objectionable" admins should be able to view
// it for review purposes.
if ($view->is_objectionable()) {
if ($owner = $view->get('owner')) {
if ($user->is_admin_for_user($owner)) {
return true;
}
}
else if ($view->get('group') && $user->get('admin')) {
return true;
}
}
// Overriding start/stop dates are set by the owner to deny access
// to users who would otherwise be allowed to see the view. However,
// for some kinds of access (e.g. objectionable content, submitted
......@@ -2276,8 +2288,9 @@ function can_view_view($view, $user_id=null) {
$overridestop = $view->get('stopdate');
$allowedbyoverride = (empty($overridestart) || $overridestart < $dbnow) && (empty($overridestop) || $overridestop > $dbnow);
if ($SESSION->get('mnetuser')) {
$mnettoken = get_cookie('mviewaccess:'.$view_id);
$access = View::user_access_records($view_id, $user_id);
if (empty($access)) {
return false;
}
foreach ($access as &$a) {
......@@ -2328,17 +2341,6 @@ function can_view_view($view, $user_id=null) {
continue;
}
}
else if ($view->is_objectionable()) {
if ($owner = $view->get('owner')) {
if ($user->is_admin_for_user($owner)) {
return true;
}
}
else if ($view->get('group') && $user->get('admin')) {
return true;
}
continue;
}
if (!$allowedbyoverride && $a->visible) {
continue;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment