CMS  Version 3.9
AdminPageProxyView Class Reference

Public Member Functions

 __construct ()
 
 drawView ()
 

Public Attributes

 $adminPage = null
 

Detailed Description

Definition at line 39 of file admin_page_proxy_view.inc.

Constructor & Destructor Documentation

◆ __construct()

AdminPageProxyView::__construct ( )

Definition at line 43 of file admin_page_proxy_view.inc.

44  {
45  global $isAction;
46  global $isResource;
47  global $isAdmin;
48 
49  global $identifier;
50  global $page;
51  global $section;
52  global $config;
53 
54  // Security rules for AdminPageProxies
55 
56  // #0 - AdminPageProxyView can only be instantiated in a ComponentPage script - not inside an action handler, resource or admin page
57  // #1 - admin page may only be exposed by a component page that has the same identifier (i.e. script has same name)
58  // #2 - admin page must be in the same component as the component page creating the proxy
59  // #3 - page must be served under SSL
60  // #4 - user must have one of the privileged access roles (i.e. role must be able to access the admin section)
61 
62  try
63  {
64  $this->adminPage = AdminPage::fromIdentifier($identifier);
65  }
66  catch(DataNotFoundException $e)
67  {
68  throw new FakoliException("No matching admin page");
69  }
70 
71  $adminComponent = $this->adminPage->Component();
72  $hostComponent = $page->Component();
73 
74  $https = Fakoli::checkSSL();
75 
76  // #0
77  if ($isAction || $isResource || $isAdmin)
78  {
79  throw new FakoliException("Incorrect execution context for proxy view");
80  }
81 
82  // #1
83  if ($page->identifier != $this->adminPage->identifier)
84  {
85  throw new FakoliException("Proxy identifier mismatch");
86  }
87 
88  // #2
89  if ($adminComponent->component_id != $hostComponent->component_id)
90  {
91  throw new FakoliException("Proxy component mismatch");
92  }
93 
94  // #3
95 
96  if (!$https)
97  {
98  throw new FakoliException("Connection not secured by SSL");
99  }
100 
101  // #4
102 
103  $adminAccess = $config["admin_access_roles"];
104  if (!$adminAccess) $adminAccess = "admin";
105 
106  if (!checkRole($adminAccess))
107  {
108  throw new FakoliException("Insufficiently privileged");
109  }
110 
112  if (is_callable($shim)) $shim();
113  }
$section
Definition: event_form.inc:44
$page
Definition: help.inc:39
if(! $class||! $itemID) $adminAccess
Definition: approve.inc:12
static getAdminProxyShim()
static fromIdentifier($identifier)
Definition: admin_page.inc:60
FakoliException is the base exception class for all Fakoli errors.
Definition: core.inc:53
static checkSSL()
Checks if SSL is enabled on the current request.
Definition: core.inc:958
$isResource
Definition: core.inc:1585
if($config["default_content_type"]) $isAction
Definition: core.inc:1584
global $config
Definition: import.inc:4
$identifier
Definition: rss.inc:37

Member Function Documentation

◆ drawView()

AdminPageProxyView::drawView ( )

Definition at line 115 of file admin_page_proxy_view.inc.

116  {
117  global $config;
118  global $method;
119  global $user;
120  global $script;
121  global $styles;
122  global $dialogs;
123  global $page;
124  global $menu_item;
125  global $isAdmin;
126 
127  require_once $this->adminPage->server_path;
128  }
$menu_item
global $user
$method
Pull out a simple reference to the request method.
Definition: core.inc:1573
$styles

Member Data Documentation

◆ $adminPage

AdminPageProxyView::$adminPage = null

Definition at line 41 of file admin_page_proxy_view.inc.


The documentation for this class was generated from the following file: