summaryrefslogtreecommitdiffstats
path: root/core/authorize.php
diff options
context:
space:
mode:
authorAlex Pott2015-06-23 16:24:29 (GMT)
committerAlex Pott2015-06-23 16:24:29 (GMT)
commit42c693a966eb26401211ca9c6525af9715adafa7 (patch)
treef5b2748e2b74ed2649a24a573f3d6baa55a903ea /core/authorize.php
parentc65b82f4f842ba495219625a8929ae492ead6fe6 (diff)
Issue #2407195 by Wim Leers, Fabianx, joelpittet, lauriii, Crell: Move attachment processing to services and per-type response subclasses
Diffstat (limited to 'core/authorize.php')
-rw-r--r--core/authorize.php20
1 files changed, 11 insertions, 9 deletions
diff --git a/core/authorize.php b/core/authorize.php
index 35277f6..d9f1e56 100644
--- a/core/authorize.php
+++ b/core/authorize.php
@@ -85,8 +85,10 @@ drupal_maintenance_theme();
$content = [];
$show_messages = TRUE;
-$response = new Response();
-if (authorize_access_allowed($request)) {
+$is_allowed = authorize_access_allowed($request);
+
+// Build content.
+if ($is_allowed) {
// Load both the Form API and Batch API.
require_once __DIR__ . '/includes/form.inc';
require_once __DIR__ . '/includes/batch.inc';
@@ -152,16 +154,16 @@ if (authorize_access_allowed($request)) {
$show_messages = !(($batch = batch_get()) && isset($batch['running']));
}
else {
- $response->setStatusCode(403);
\Drupal::logger('access denied')->warning('authorize.php');
$page_title = t('Access denied');
$content = ['#markup' => t('You are not allowed to access this page.')];
}
-if (!empty($content)) {
- $response->headers->set('Content-Type', 'text/html; charset=utf-8');
- $response->setContent(\Drupal::service('bare_html_page_renderer')->renderBarePage($content, $page_title, 'maintenance_page', array(
- '#show_messages' => $show_messages,
- )));
- $response->send();
+$bare_html_page_renderer = \Drupal::service('bare_html_page_renderer');
+$response = $bare_html_page_renderer->renderBarePage($content, $page_title, 'maintenance_page', array(
+ '#show_messages' => $show_messages,
+));
+if (!$is_allowed) {
+ $response->setStatusCode(403);
}
+$response->send();