You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

2509 lines
88 KiB

<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>phpGACL</title>
<!-- OpenEMR - Adds Bootstrap to this file !-->
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<link rel="stylesheet" href="../../public/assets/bootstrap/dist/css/bootstrap.min.css" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="generator" content="OpenOffice.org 2.0 (Linux)" />
<meta name="author" content="jrussell" />
<meta name="created" content="20030206;8320000" />
<meta name="changed" content="20060903;16430300" />
<meta name="sdfootnote" content=";;;;P" />
<meta name="sdendnote" content="arabic" />
<style>
.font1 {
font-family: "Bitstream Vera Sans Mono", sans-serif !important;
}
.font2 {
font-family: Arial, sans-serif !important;
}
.font3 {
font-family: "Times New Roman", serif !important;
}
.font4 {
font-family: "Luxi Sans", sans-serif !important;
}
.font5 {
font-family: Helvetica, Arial, sans-serif !important;
}
.font6 {
font-family: "Courier New", sans-serif !important;
}
.font-code {
font-family: "Courier New", monospace !important;
}
.font-code-2 {
font-family: Courier, "Courier New", monospace !important;
}
.font-small {
font-size: small;
}
p {
margin-top: 0.48rem;
margin-bottom: 0.48rem;
color: #000000;
line-height: 1rem;
widows: 2;
orphans: 2;
}
p.western {
font-family: "Bitstream Vera Sans Mono", sans-serif;
font-size: 0.8125rem;
}
p.cjk {
font-family: "Times New Roman", serif;
font-size: 0.8125rem;
}
h1 {
margin-bottom: 0.25rem;
border-top: none;
border-bottom: 1px solid #4700b8;
border-left: 7px solid #4700b8;
border-right: none;
padding-top: 0;
padding-bottom: 0.125rem;
padding-left: 0.125rem;
padding-right: 0;
color: #000000;
widows: 2;
orphans: 2;
page-break-before: always;
}
h1.western {
font-family: "Arial", sans-serif;
font-size: 1.3125rem;
}
h1.cjk {
font-family: "MS Mincho", "MS ??", monospace;
font-size: 1.3125rem;
}
h1.ctl {
font-family: "Arial Unicode MS";
font-size: 1rem;
}
h2 {
margin-bottom: 0.25rem;
color: #000000;
widows: 2;
orphans: 2;
}
h2.western {
font-family: "Georgia", serif;
font-size: 1.0625rem;
font-style: normal;
}
h2.cjk {
font-family: "MS Mincho", "MS ??", monospace;
font-size: 1.125rem;
font-style: italic;
}
h2.ctl {
font-family: "Arial Unicode MS";
font-size: 1rem;
}
h3 {
margin-top: 0.48rem;
margin-bottom: 0.48rem;
color: #000000;
line-height: 1rem;
widows: 2;
orphans: 2;
}
h3.western {
font-family: "Helv", "Arial", sans-serif;
font-size: 0.8125rem;
}
h3.cjk {
font-family: "Times New Roman", serif;
font-size: 0.8125rem;
}
h3.ctl {
font-family: "Arial Unicode MS";
font-size: 1rem;
}
h4 {
margin-top: 0.48rem;
margin-bottom: 0.48rem;
color: #000000;
line-height: 1rem;
widows: 2;
orphans: 2;
}
h4.western {
font-family: "Helv", "Arial", sans-serif;
font-size: 0.8125rem;
font-style: italic;
}
h4.cjk {
font-family: "Times New Roman", serif;
font-size: 0.8125rem;
font-style: italic;
}
h4.ctl {
font-family: "Arial Unicode MS";
font-size: 1rem;
}
A:link {
color: #0000ff;
}
@media print {
@page {
size: 8.27in 11.69in;
margin: 1.18in;
}
p {
margin-top: 0.08in;
margin-bottom: 0.25rem;
line-height: 1rem;
}
p.western, p.cjk {
font-size: 10pt;
}
h1 {
margin-bottom: 0.04in;
border-bottom: 1px solid #4700b8;
border-left: 5.00pt solid #4700b8;
padding-bottom: 0.02in;
padding-left: 0.02in;
}
h2 {
margin-bottom: 0.04in;
}
h3 {
margin-top: 0.08in;
margin-bottom: 0.25rem;
line-height: 1rem;
}
h4 {
margin-top: 0.08in;
margin-bottom: 0.25rem;
line-height: 1rem;
}
h1.western, h1.cjk {
font-size: 16pt;
}
h2.western {
font-size: 13pt;
}
h2.cjk {
font-size: 14pt;
}
h3.western, h3.cjk, h4.western, h4.cjk {
font-size: 10pt;
}
h1.ctl, h2.ctl, h3.ctl, h4.ctl {
font-size: 12pt;
}
}
</style>
</head>
<body dir="ltr">
<div class="container">
<p class="text-center" style="margin-top: 1rem; line-height: 100%; page-break-after: avoid;">
<img src="manual_html_m54d0ced8.png" id="Graphic6" class="img-responsive d-block ml-auto" width="165" height="45" alt="phpGACL Logo" />
<br style="clear: right;" /><br /><br />
</p>
<p class="text-center" style="margin-top: 1rem; line-height: 100%; page-break-after: avoid;">
<span class="font4">
<span class="font-weight-bold" style="font-size: x-large">Generic Access Control Lists with PHP</span>
</span>
</p>
<p class="western">
<span class="font1">Mike Benoit &lt;</span>
<span<u><a href="mailto:ipso@snappymail.ca">
<span class="font1">ipso@snappymail.ca</span>
</a></u>.</span>
<span class="font1">&gt;<br />James
Russell &lt;</span><a href="mailto:james-phpgacl@ps2-pro.com">
<span class="font1">james-phpgacl@ps2-pro.com</span>
</a>
<span class="font1">&gt;<br />Karsten Dambekalns &lt;</span><a href="mailto:k.dambekalns@fishfarm.de">
<span class="font1">k.dambekalns@fishfarm.de</span>
</a>
<span class="font1">&gt;</span>
</p>
<p class="western">
<span class="font1">Copyright &copy; 2002-2006 Mike Benoit<br />Copyright &copy; 2003, James Russell<br />Copyright &copy; 2003, Karsten Dambekalns</span>
</p>
<p class="western">
<span class="font1">Document Version: 60</span>
</p>
<p class="western">
<span class="font1">Last Updated: <strong><sdfield TYPE="datetime" sdnum="1033;1033;MMMM D, YYYY">September 3, 2006</sdfield> - <sdfield type="datetime" sdval="37761.788287037" sdnum="1033;1033;HH:MM AM/PM">06:55 PM</sdfield></strong></span>
</p>
<h1 class="western">Table of Contents</h1>
<div id="Table of Contents1" class="mb-3">
<p class="mt-0" style="margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Table of Contents 2</span>
</p>
<p class="mt-0" style="margin-bottom: 0.25rem; line-height: 100%">
<span class="font2"><a href="#about">About 4</a></span>
</p>
<p class="mt-0" style="margin-bottom: 1rem; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2"><a href="#aboutisit">What is it? 4</a></span>
</p>
<p class="mt-0" style="margin-bottom: 1rem; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2"><a href="#aboutgetit">Where can I get it? 4</a></span>
</p>
<p class="mt-0" style="margin-bottom: 1rem; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2"><a href="#aboutrunit">What do I need to run it? 4</a></span>
</p>
<p class="mt-0" style="margin-bottom: 1rem; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Who is responsible for it? 4</span>
</p>
<p class="mt-0" style="margin-bottom: 0.25rem; line-height: 100%">
<span class="font2"><a href="#introduction">Introduction 5</a></span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Understanding Access Control 5</span>
</p>
<p style="margin-left: 0.33in; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Who/Where 5</span>
</p>
<p style="margin-left: 0.33in; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Who/Where 6</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2"><a href="#defaccesscontrol">Defining access control with phpGACL 6</a></span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2"><a href="#finegrainacccontrol">Fine-grain access control 8</a></span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Multi-level Groups 8</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">How does phpGACL determine
permissions? 9</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Adding groups 10</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Adding people 11</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Resolving conflicts 11</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Naming Access Objects 12</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Adding Sections 14</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Multiple Purposes 15</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Access eXtension Objects 16</span>
</p>
<p style="margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Installation 18</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Basic setup 18</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Advanced setup 19</span>
</p>
<p style="margin-left: 0.33in; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Reusing an already existing ADOdb
installation 19</span>
</p>
<p class="mt-0" style="margin-left: 0.33in; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Reusing an already existing Smarty
installation 20</span>
</p>
<p class="mt-0" style="margin-left: 0.33in; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">How do I move the phpGACL files out
of my website tree while leaving a link in the tree for
administration? 20</span>
</p>
<p style="margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Using phpGACL in your application 21</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Basic usage 21</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Advanced usage 21</span>
</p>
<p style="margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Using the ACL admin utility 22</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">ACL's 22</span>
</p>
<p style="margin-left: 0.33in; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Creating 22</span>
</p>
<p style="margin-left: 0.33in; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Sections 23</span>
</p>
<p style="margin-left: 0.33in; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Extended Return Value 24</span>
</p>
<p style="margin-left: 0.33in; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Notes 24</span>
</p>
<p style="margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Glossary 25</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">ACO 25</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">ARO 25</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">AXO 25</span>
</p>
<p style="margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">References 26</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">phpGACL API 26</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">phpGACL Examples and Tutorials 26</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Access Control Resources 26</span>
</p>
<p style="margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">FAQ 27</span>
</p>
<p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
<span class="font2">Can phpGACL handle large sets of
data? 27</span>
</p>
</div>
<h1 class="western" id="about">About</h1>
<h2 class="western" id="aboutisit"><span class="font1">What is it?</span></h2>
<p class="western">
<span class="font1">phpGACL
is an set of functions that allows you to apply access control to
arbitrary objects (web pages, databases, etc) by other arbitrary
objects (users, remote hosts, etc).</span>
</p>
<p class="western">
<span class="font1">It offers fine-grained access control with simple management, and is very fast.</span>
</p>
<p class="western">
<span class="font1">It
is written in PHP (hence <strong>php</strong>GACL), a popular scripting
language that is commonly used to dynamically create web pages. The
GACL part of phpGACL stands for Generic Access Control List.</span>
</p>
<h2 class="western" id="aboutgetit"><span class="font1">Where can I get it?</span></h2>
<p class="western">
<span class="font1">phpGACL is hosted by sourceforge.net at </span><a href="http://phpGACL.sourceforge.net/">
<span class="font1">http://phpGACL.sourceforge.net/</span>
</a>
</p>
<h2 class="western" id="aboutrunit"><span class="font1">What do I need to run it?</span></h2>
<p class="western">
<span class="font1">phpGACL
requires a relational database to store the access control
information. It accesses this database via an abstract wrapper called
</span><a href="http://php.weblogs.com/adodb">
<span class="font1">ADOdb</span>
</a>
<span class="font1">.
This is compatible with databases such as PostgreSQL, MySQL and
Oracle.</span>
</p>
<p class="western">
<span class="font1">phpGACL
is written in the </span><a href="http://www.php.net/">
<span class="font1">PHP</span>
</a>
<span class="font1">
scripting language. It requires PHP 4.2 and above.</span>
</p>
<p class="western">
<span class="font1">Access
Control List administration is performed by a web interface, and
therefore it is necessary to have a web server with PHP support, such
as </span><a href="http://httpd.apache.org/">
<span class="font1">Apache</span>
</a>
<span class="font1">.</span>
</p>
<h2 class="western">
<span class="font1">Who is responsible for it?</span>
</h2>
<p class="western">
<span class="font1">Mike Benoit </span>&lt;<a href="mailto:ipso@snappymail.ca">
<span class="font1">ipso@snappymail.ca</span>
</a>&gt;
<span class="font1">is the author and project manager.</span>
</p>
<p class="western">
<span class="font1">James Russell </span>&lt;<a href="mailto:james-phpgacl@ps2-pro.com">
<span class="font1">james-phpgacl@ps2-pro.com</span></a>&gt;
<span class="font1"> and Karsten Dambekalns</span> &lt;<a href="mailto:k.dambekalns@fishfarm.de"><span class="font1">k.dambekalns@fishfarm.de</span></a>&gt;
<span class="font1"> did the documentation.</span>
</p>
<h1 class="western" id="introduction">Introduction</h1>
<h2 class="western">
<span class="font1">Understanding
Access Control</span>
</h2>
<p class="western">
<span class="font1">
<span class="font-small">The
best way to explain access control is to use examples with real
things rather than trying to relate to concepts.</span>
</span>
</p>
<p class="western">
<span class="font1">
<span class="font-small">Han
is captain of the Millennium Falcon and Chewie is his second officer.
They've taken on board some passengers: Luke, Obi-wan, R2D2 and C3PO.
Han needs to define access restrictions for various rooms of the
ship: The Cockpit, Lounge, Engines and the external Guns.</span>
</span>
</p>
<p class="western">
<span class="font1">
<span class="font-small">Han
says: &quot;Me and Chewie should have access to everywhere, but after
a particularly messy hyperdrive repair, I forbid Chewie from going
near the Engine Room ever again. Passengers are confined to the
Passenger's Lounge.&quot;</span>
</span>
</p>
<p class="western">
<span class="font1">
<span class="font-small">Let's
assume from now on that access is Boolean. That is, the result of
looking up a person's access to a room is either ALLOW or DENY. There
is no middle ground.</span>
</span>
</p>
<p class="western">
<span class="font1">
<span style="font-size: 3">
<span class="font-small">
<span>If
we mapped this statement into an </span><strong>access matrix</strong><span>
showing who has access to where, it would look something like this (O
means ALLOW, X means DENY):</span>
</span>
</span>
</span>
</p>
<dl>
<dd>
<table class="table" width="337" border="1" cellpadding="7" cellspacing="0">
<col width="81">
<col width="56">
<col width="44">
<col width="31">
<col width="53">
<tr class="align-top">
<td width="81">
<h3 class="western text-right">
<span class="font1">Who/Where</span>
</h3>
</td>
<td width="56">
<p class="western text-center">
<span class="font1">
<span class="font-small">Cockpit</span>
</span>
</p>
</td>
<td width="44">
<p class="western text-center">
<span class="font1">
<span class="font-small">Lounge</span>
</span>
</p>
</td>
<td width="31">
<p class="western text-center">
<span class="font1">
<span class="font-small">Guns</span>
</span>
</p>
</td>
<td width="53">
<p class="western text-center">
<span class="font1">
<span class="font-small">Engines</span>
</span>
</p>
</td>
</tr>
<tr class="align-top">
<td width="81">
<p class="western text-right">
<span class="font1">
<span class="font-small">Han</span>
</span>
</p>
</td>
<td width="56" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="44" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="31" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="53" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
</tr>
<tr class="align-top">
<td width="81">
<p class="western text-right">
<span class="font1">
<span class="font-small">Chewie</span>
</span>
</p>
</td>
<td width="56" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="44" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="31" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="53" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
</tr>
<tr class="align-top">
<td width="81">
<p class="western text-right">
<span class="font1">
<span class="font-small">Obi-wan</span>
</span>
</p>
</td>
<td width="56" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
<td width="44" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="31" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
<td width="53" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
</tr>
<tr class="align-top">
<td width="81">
<p class="western text-right">
<span class="font1">
<span class="font-small">Luke</span>
</span>
</p>
</td>
<td width="56" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
<td width="44" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="31" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
<td width="53" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
</tr>
<tr class="align-top">
<td width="81">
<p class="western text-right">
<span class="font1">
<span class="font-small">R2-D2</span>
</span>
</p>
</td>
<td width="56" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
<td width="44" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="31" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
<td width="53" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
</tr>
<tr class="align-top">
<td width="81">
<p class="western text-right">
<span class="font1">
<span class="font-small">C3PO</span>
</span>
</p>
</td>
<td width="56" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
<td width="44" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="31" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
<td width="53" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
</tr>
</table>
</dd>
</dl>
<p class="western">
<span class="font1">
<span style="font-size: 3">
<span class="font-small">
<span><span>The
columns list the rooms that Han wants to restrict access to, and the
rows list the people that might request access to those rooms. More
generally, the &quot;rooms&quot; are &quot;things to control access
on&quot;. We call these </span><strong>Access Control Objects</strong><span>
(ACOs). The &quot;people&quot; are &quot;things </span><i>requesting</i><span>
access&quot;. We call these </span><strong>Access Request Objects</strong><span>
(AROs). The </span><i>people</i><span> request access to
the </span><i>rooms</i><span>, or in our terminology,
</span><i>AROs</i><span> request access to the </span><i>ACOs</i><span>.</span></span>
</span>
</span>
</span>
</p>
<p class="western">
<span class="font1">
<span style="font-size: 3">
<span class="font-small">
<span>There is a third type of Object, the </span><strong>Access eXtention Object</strong><span> (AXO) that we'll discuss later. These objects share many attributes and are collectively referred to as Access Objects.</span>
</span>
</span>
</span>
</p>
<p class="western">
<span class="font1">
<span class="font-small">Managing access using an access matrix like the one above has advantages and disadvantages.</span>
</span>
</p>
<p class="western">
<span class="font1">
<span class="font-small"><i>Advantages:</i></span>
</span>
</p>
<ul>
<li>
<p class="western">
<span class="font1">
<span class="font-small">It's
very fine-grained. It's possible to control access for an individual
person if necessary.</span>
</span>
</p>
<li>
<p class="western">
<span class="font1">
<span style="font-size: 3"><span>
<span class="font-small">
It's
easy to see <u>who</u>. has access to <u>what</u>.. The answer is
stored in the intersection of the person and the room.
</span>
</span></span>
</span>
</p>
</ul>
<p class="western">
<span class="font1">
<span class="font-small"><i>Disadvantages:</i></span>
</span>
</p>
<ul>
<li value="1">
<p class="western">
<span class="font1">
<span class="font-small">It's
difficult to manage on a large scale. 6 passengers and 4 places is
fairly simple, but what if there were thousands of passengers and
hundreds of places, and you need to restrict access to large groups
of them at once, but still retain enough fine-grained control to
manage access for an individual? That would mean a lot of fiddly and
lengthy adjustment to the matrix, and it's a difficult task to
verify that the final matrix is correct.</span>
</span>
</p>
</li>
<li>
<p class="western">
<span class="font1">
<span class="font-small">It's
hard to summarize or visualize. The above example is fairly simple
to summarize in a few sentences (as Han did above), but what if the
matrix looked like this?</span>
</span>
</p>
<table class="table" width="337" border="1" cellpadding="7" cellspacing="0">
<col width="81">
<col width="52">
<col width="44">
<col width="35">
<col width="54">
<tr class="align-top">
<td width="81">
<h3 class="western text-right">
<span class="font1">Who/Where</span>
</h3>
</td>
<td width="52">
<p class="western text-center">
<span class="font1">
<span class="font-small">Cockpit</span>
</span>
</p>
</td>
<td width="44">
<p class="western text-center">
<span class="font1">
<span class="font-small">Lounge</span>
</span>
</p>
</td>
<td width="35">
<p class="western text-center">
<span class="font1">
<span class="font-small">Guns</span>
</span>
</p>
</td>
<td width="54">
<p class="western text-center">
<span class="font1">
<span class="font-small">Engines</span>
</span>
</p>
</td>
</tr>
<tr class="align-top">
<td width="81">
<p class="western text-right">
<span class="font1">
<span class="font-small">Han</span>
</span>
</p>
</td>
<td width="52" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="44" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="35" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="54" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
</tr>
<tr class="align-top">
<td width="81">
<p class="western text-right">
<span class="font1">
<span class="font-small">Chewie</span>
</span>
</p>
</td>
<td width="52" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="44" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
<td width="35" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="54" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
</tr>
<tr class="align-top">
<td width="81">
<p class="western text-right">
<span class="font1">
<span class="font-small">Obi-wan</span>
</span>
</p>
</td>
<td width="52" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
<td width="44" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="35" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
<td width="54" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
</tr>
<tr class="align-top">
<td width="81">
<p class="western text-right">
<span class="font1">
<span class="font-small">Luke</span>
</span>
</p>
</td>
<td width="52" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="44" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="35" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="54" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
</tr>
<tr class="align-top">
<td width="81">
<p class="western text-right">
<span class="font1">
<span class="font-small">R2-D2</span>
</span>
</p>
</td>
<td width="52" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
<td width="44" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="35" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
<td width="54" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
</tr>
<tr class="align-top">
<td width="81">
<p class="western text-right">
<span class="font1">
<span class="font-small">C3PO</span>
</span>
</p>
</td>
<td width="52" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="44" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
<td width="35" class="bg-danger">
<p class="western text-center">
<span class="font1">
<span class="font-small">&times;</span>
</span>
</p>
</td>
<td width="54" class="bg-success">
<p class="western text-center">
<span class="font1">
<span class="font-small">O</span>
</span>
</p>
</td>
</tr>
</table>
<p class="western">
<span class="font1">
<span class="font-small">This
matrix is not so obvious to summarize, and it's not clear to the
reader why those access decisions might have been made in the first
place.</span>
</span>
</p>
</li>
</ul>
<h2 class="western" id="defaccesscontrol"><span class="font1">Defining access control with phpGACL</span></h2>
<p class="western">
<span class="font1">It
seems that for large or complex situations, this 'access matrix'
approach is clearly unsuitable. We need a better system that
maintains the advantages (fine-grain control and a clear idea of <u>who</u>.
has access to <u>what</u>.) but removes the disadvantages (difficult
to summarize, and difficult to manage large groups of people at
once). One solution is phpGACL.</span>
</p>
<p class="western">
<span class="font1">
<span style="font-size: 3"><span>
<span class="font-small">
phpGACL
doesn't describe access from the 'bottom-up' like the Access Matrix
above. Instead, it describes it 'top-down', like the textual
description of Han's access policy. This is a very flexible system
that allows you to manage access in large groups, it neatly
summarizes the access policy, and it's easy to see <u>who </u>.has
access to <u>what</u>..
</span>
</span></span>
</span>
</p>
<p class="western">
<span class="font1">
<span style="font-size: 3">
<span class="font-small">
<span>An
</span><strong>ARO tree</strong><span> defines a hierarchy of
</span><strong>Groups</strong><span> and AROs (things that request
access). This is very similar to a tree view of folders and files.
The 'folders' are the Groups and the 'files' are AROs.</span>
</span>
</span>
</span>
</p>
<p class="western">
<span class="font1">
<span class="font-small">Let's
make an ACL tree for the people on Han's ship. First we define some
categories for the people. It's clear that Han and Chewie run the
ship, and the rest of them are just passengers:</span>
</span>
</p>
<p class="western">
<span class="font-code">
<span class="font-small">Millennium
Falcon Passengers Group<br />&#9500;&#9472;Crew Group<br />&#9474;
&#9500;&#9472;Han ARO<br />&#9474;
&#9492;&#9472;Chewie ARO<br />&#9492;&#9472;Passengers Group<br />
&#9500;&#9472;Obi-wan ARO<br /> &#9500;&#9472;Luke ARO<br />
&#9500;&#9472;R2D2 ARO<br /> &#9492;&#9472;C3PO ARO</span>
</span>
</p>
<p class="western">
<span class="font1">
<span class="font-small">This
tree by itself doesn't specify any access policy; it just shows how
we're grouping the people who might request access (AROs).</span>
</span>
</p>
<p class="western">
<span class="font1">We
apply access restrictions by assigning instructions about a
particular room (ACO) to Groups or AROs in the tree. Han says: &quot;By
default, no-one should be allowed access to any room on the
Millennium Falcon. But the Crew should have access to every room. The
Passengers should only have access to the Lounge.&quot;</span>
</p>
<p class="western">
<span class="font3">
<span style="font-size: 3">
<span class="font-small">
<span class="font-code">
<span>Millennium
Falcon Passengers<br />&#9500;&#9472;Crew </span><strong>[ALLOW: ALL]</strong><span><br />&#9474;
&#9500;&#9472;Han<br />&#9474; &#9492;&#9472;Chewie<br />&#9492;&#9472;Passengers </span><strong>[ALLOW:
Lounge]</strong><span><br /> &#9500;&#9472;Obi-wan<br />
&#9500;&#9472;Luke<br /> &#9500;&#9472;R2D2<br /> &#9492;&#9472;C3PO</span>
</span>
</span>
</span>
</span>
</p>
<p class="western">
<span class="font1">
<span class="font-small">To interpret this ARO tree, we start from the top and work our way down.</span>
</span>
</p>
<p class="western">
<span class="font1">
<span class="font-small">Firstly,
the default policy is always to deny access. Permissions have been
overridden for the &quot;Crew&quot;, so they have access to
everywhere (&quot;ALL&quot; is a synonym for all rooms: &quot;Cockpit,
Lounge, Guns, Engines&quot;). The &quot;Passengers&quot; have access
only to the Lounge.</span>
</span>
</p>
<p class="western">
<span class="font1">
<span style="font-size: 3"><span>
<span class="font-small">
This
way of describing the access policy is much clearer than the access
matrix. You can easily see who has access to what, and it's easier to
determine <u>why</u>. they've got access (it seems obvious that Han
and Chewie would have access to everything, since they're grouped
under &quot;Crew&quot;).
</span>
</span></span>
</span>
</p>
<p class="western">
<span class="font1">
<span class="font-small">To summarize:</span>
</span>
</p>
<ul>
<li value=1>
<p class="western">
<span class="font1">
<span style="font-size: 3">
<span class="font-small">
<strong>Access Control Objects </strong><span>(ACOs) are the things we want to control access to (e.g. web pages, databases, rooms, etc).</span>
</span>
</span>
</span>
</p>
<li>
<p class="western">
<span class="font1">
<span style="font-size: 3">
<span class="font-small">
<strong>Access
Request Objects</strong><span> (AROs) are the things that
request access (e.g. people, remote computers, etc)</span>
</span>
</span>
</span>
</p>
<li>
<p class="western">
<span class="font1">
<span style="font-size: 3">
<span class="font-small">
<strong>ARO trees</strong><span> define a hierarchy of </span><strong>Groups</strong><span>
and AROs. Groups can contain other Groups and AROs.</span>
</span>
</span>
</span>
</p>
<li>
<p class="western">
<span class="font1">
<span class="font-small">The
default 'catch-all' policy for the ARO tree is always &quot;DENY
ALL&quot;.</span>
</span>
</p>
<li>
<p class="western">
<span class="font1">
<span class="font-small">To
assign access policy, work your way down the tree, explicitly
assigning permissions to Groups and AROs for each ACO as the need
arises.</span>
</span>
</p>
</ul>
<h2 class="western" id="finegrainacccontrol"><span class="font1">Fine-grain access control</span></h2>
<p class="western">
<span class="font1">
<span class="font-small">Oops!
What about Chewie? By grouping him in &quot;Crew&quot;, Han has
indirectly given him access to the Engines! He doesn't want that
after what Chewie recently did to the hyperdrive, so he adds a rule
to disallow this:</span>
</span>
</p>
<p class="western">
<span class="font3">
<span style="font-size: 3">
<span class="font-small">
<span class="font-code">
<span>Millennium
Falcon Passengers<br />&#9500;&#9472;Crew [ALLOW: ALL]<br />&#9474;
&#9500;&#9472;Han<br />&#9474; &#9492;&#9472;Chewie </span><strong>[DENY:
Engines]</strong><span><br />&#9492;&#9472;Passengers [ALLOW:
Lounge]<br /> &#9500;&#9472;Obi-wan<br /> &#9500;&#9472;Luke<br />
&#9500;&#9472;R2D2<br /> &#9492;&#9472;C3PO</span>
</span>
</span>
</span>
</span>
</p>
<p class="western">
<span class="font1">
<span class="font-small">This
is an example of the way you can control access policy in a
fine-grained manner. It is not necessary to move Chewie to another
Group; we simply over-ride the access policy at a lower level.</span>
</span>
</p>
<p class="western">
<span class="font1">
<span class="font-small">Another example of fine-grain control happens when the Empire attacks; Han needs to let Luke man the guns, and let R2D2 repair the hyperdrive in the Engine room. He can do this by over-riding the general permissions granted by their status as a &quot;Passenger&quot;:</span>
</span>
</p>
<p class="western">
<span class="font3">
<span style="font-size: 3">
<span class="font-small">
<span class="font-code">
<span>Millennium
Falcon Passengers<br />&#9500;&#9472;Crew [ALLOW: ALL]<br />&#9474;
&#9500;&#9472;Han<br />&#9474; &#9492;&#9472;Chewie [DENY:
Engines]<br />&#9492;&#9472;Passengers [ALLOW: Lounge]<br /> &#9500;&#9472;Obi-wan<br />
&#9500;&#9472;Luke </span><strong>[ALLOW: Guns]</strong><span><br />
&#9500;&#9472;R2D2 </span><strong>[ALLOW: Engines]</strong><span><br />
&#9492;&#9472;C3PO</span>
</span>
</span>
</span>
</span>
</p>
<h2 class="western">
<span class="font1">Multi-level
Groups</span>
</h2>
<p class="western">
<span class="font1">
<span class="font-small">Groups
can be extended to any level in the ARO tree. For example, you could
add a Group &quot;Jedi&quot; to &quot;Passengers&quot;. Most
passengers would be categorized under &quot;Passengers&quot;, but
Luke and Obi-wan would be under &quot;Jedi&quot; and therefore might
be extended extra privileges (like access to the Cockpit):</span>
</span>
</p>
<p class="western">
<span class="font3">
<span style="font-size: 3">
<span class="font-small">
<span class="font-code">
<span>Millennium
Falcon Passengers<br />&#9500;&#9472;Crew [ALLOW: ALL]<br />&#9474;
&#9500;&#9472;Han<br />&#9474; &#9492;&#9472;Chewie [DENY:
Engines]<br />&#9492;&#9472;Passengers [ALLOW: Lounge]<br />
&#9500;&#9472;</span><strong>Jedi [ALLOW: Cockpit]</strong><span><br />
&#9474; &#9500;&#9472;</span><strong>Obi-wan</strong><span><br />
&#9474; &#9492;&#9472;</span><strong>Luke</strong><span> [ALLOW:
Guns] <br /> &#9500;&#9472;R2D2 [ALLOW: Engines]<br /> &#9492;&#9472;C3PO</span>
</span>
</span>
</span>
</span>
</p>
<h2 class="western">
<span class="font1">How
does phpGACL determine permissions?</span>
</h2>
<p class="western">
<span class="font1">
<span class="font-small">When
the ship's computer (running phpGACL of course) checks access, the
only question it can ask itself is &quot;Does person X have access to
room Y?&quot; In phpGACL terms, this is rephrased as &quot;Does ARO
'X' have access to ACO 'Y'?&quot;</span>
</span>
</p>
<p class="western">
<span class="font1">
<span class="font-small">phpGACL
determines whether a specific person has access to a specific room by
working from the top of the ARO tree towards the specified person,
noting explicit access controls for that place along the way. When it
reaches that person, it uses the last explicit access control it
encountered as the result to return. In this way, you can define
access controls for groups of people, but over-ride them further down
the tree if you need to.</span>
</span>
</p>
<p class="western">
<span class="font1">
<span style="font-size: 3">
<span class="font-small">
<strong>Example
1</strong><span>: We ask: &quot;Does Luke have access to the
Lounge?&quot;.</span>
</span>
</span>
</span>
</p>
<ul>
<li value="1">
<p class="western">
<span class="font1">
<span class="font-small">Set
the default result, &quot;DENY&quot;.</span>
</span>
</p>
</li>
<li>
<p class="western">
<span class="font1">
<span class="font-small">Work
out a path to Luke:</span>
</span>
</p>
</li>
</ul>
<h4 class="western">
<span class="font1"> Millennium
Falcon Passengers &rarr; Passengers &rarr; Jedi &rarr; Luke</span>
</h4>
<ul>
<li value=1>
<p class="western">
<span class="font1">
<span class="font-small">Start
at the top of the tree and move towards Luke: The &quot;Millennium
Falcon Passengers&quot; node doesn't say anything about any room, so
do nothing here.</span>
</span>
</p>
<li>
<p class="western">
<span class="font1">
<span class="font-small">Move
on to &quot;Passengers&quot;, which explicitly says that
&quot;Passengers&quot; have Lounge access, so change the internal
result to &quot;ALLOW&quot;.</span>
</span>
</p>
<li>
<p class="western">
<span class="font1">
<span class="font-small">Move
to the &quot;Jedi&quot; node, which doesn't mention the Lounge at
all.</span>
</span>
</p>
<li>
<p class="western">
<span class="font1">
<span class="font-small">Finally
move to Luke's node, and again there's nothing there about the
Lounge.</span>
</span>
</p>
<li>
<p class="western">
<span class="font1">
<span class="font-small">There's
nowhere left to go, so the result returned is the current value of
the internal result: &quot;ALLOW&quot;</span>
</span>
</p>
</ul>
<p class="western">
<span class="font1">
<span style="font-size: 3">
<span class="font-small">
<strong>Example
2</strong><span>: We ask: &quot;Does Chewie have access to
the Engines?&quot;</span>
</span>
</span>
</span>
</p>
<ul>
<li value=1>
<p class="western">
<span class="font1">
<span class="font-small">Set
the default result, &quot;DENY&quot;.</span>
</span>
</p>
<li>
<p class="western">
<span class="font1">
<span class="font-small">Work
out a path to Chewie:</span>
</span>
</p>
</ul>
<h4 class="western">
<span class="font1"> Millennium
Falcon Passengers &rarr; Crew &rarr; Chewie</span>
</h4>
<ul>
<li>
<p class="western">Start at the top of the tree and move towards
Chewie. The &quot;Millennium Falcon Passengers&quot; node doesn't
say anything about anywhere, so do nothing here.</p>
<li>
<p class="western">
<span class="font1">
<span class="font-small">Move
on to &quot;Crew&quot;, which explicitly says that &quot;Crew&quot;
have Engine access, so change the internal result to &quot;ALLOW&quot;.</span>
</span>
</p>
<li>
<p class="western">
<span class="font1">
<span class="font-small">Move
to Chewie's node, and there's an explicit rule saying that he
doesn't have access to the Engines, so change the internal result to
&quot;DENY&quot;.</span>
</span>
</p>
<li>
<p class="western">
<span class="font1">
<span class="font-small">There's
nowhere left to go, so the result returned is the current value of
the internal result: &quot;DENY&quot;</span>
</span>
</p>
</ul>
<p class="western">
<span class="font1">
<span class="font-small">As
you can see from the examples, if a Group doesn't explicitly specify
a permission for a room, then that Group inherits the access
restrictions of its parent for that room. If the root node
(&quot;Millennium Falcon Passengers&quot;) doesn't specify a
permission, it inherits it from the default setting (&quot;DENY ALL&quot;
in the above examples).</span>
</span>
</p>
<p class="western">
<span class="font1">
<span class="font-small">This
implies a couple of interesting points about the ARO tree:</span>
</span>
</p>
<ul>
<li value=1>
<p class="western">
<span class="font1">
<span class="font-small">The
ARO tree always shows the full list of the AROs. It would not make
sense to ask &quot;Does Jabba have access to the Cockpit?&quot;
because Jabba has not been defined in this system. However, phpGACL
does not check to see if AROs or ACOs exist before performing the
check, so if this question was actually asked then the result would
be the default &quot;DENY&quot;.</span>
</span>
</p>
<li>
<p class="western">
<span class="font1">
<span class="font-small">The
ARO tree may not display some defined ACOs, and relies on the
default setting to define access policy. For example, say Han
defined a &quot;Bathroom&quot; ACO. Any question like &quot;Does
Luke have access to the Bathroom?&quot; would have the answer
&quot;DENY&quot;, because the default is &quot;DENY&quot; and
nowhere in the ARO tree does it ever explicitly mention the
Bathroom. Keep in mind when examining the ARO tree that some ACOs
may not be visible.</span>
</span>
</p>
</ul>
<p class="western">
<span class="font1">
<span style="font-size: 3">
<span class="font-small">
<strong>Note:</strong><span>
When asking phpGACL questions about access to an ACO, it is not
possible to use Groups as AROs (even though it might 'seem' right).
For example, it is impossible to answer the question &quot;Do
Passengers have access to Guns?&quot; The complete answer is not a
Boolean &quot;ALLOW&quot; or &quot;DENY&quot;, but the more complex
&quot;Luke and Obi-wan can but R2D2 and C3PO cannot.&quot; phpGACL is
not designed to return that kind of answer.</span>
</span>
</span>
</span>
</p>
<h2 class="western">
<span class="font1">Adding
groups</span>
</h2>
<p class="western">
<span class="font1">
<span class="font-small">Han
feels this ACL is starting to look a little complicated. There are so
many exceptions! Perhaps he should make another group, &quot;Engineers&quot;,
containing the people who are allowed access to the Engines and Guns.
That group should contain Han and R2D2 since they're both capable of
repairing the engines and guns. This means Han can remove some of
those messy exceptions-to-the-rules, and that has the benefit of
making the description clearer:</span>
</span>
</p>
<p class="western">
<span class="font-code">Default: DENY
ALL<br />Millennium Falcon Passengers<br />&#9500;&#9472;Crew [ALLOW:
ALL]<br />&#9474; &#9500;&#9472;Han<br />&#9474; &#9492;&#9472;Chewie [DENY:
Engines]<br />&#9500;&#9472;Passengers [ALLOW: Lounge]<br />&#9474;
&#9500;&#9472;Jedi [ALLOW: Cockpit]<br />&#9474; &#9474; &#9500;&#9472;Obi-wan<br />&#9474;
&#9474; &#9492;&#9472;Luke [ALLOW: Guns] <br />&#9474; &#9500;&#9472;R2D2<br />&#9474;
&#9492;&#9472;C3PO<br />&#9492;&#9472;<strong>Engineers [ALLOW: Engines,
Guns]</strong><br /> &#9500;&#9472;<strong>Han</strong><br /> &#9492;&#9472;<strong>R2D2</strong></span>
</p>
<p class="western">
<span class="font1">
<span class="font-small">We
can read this as &quot;By default, no-one has access to anywhere.
Crew have access to everywhere (except Chewie, who has no access to
the Engines). Passengers only have access to the Lounge, except Jedi
who also have access to the Cockpit. Luke has access to the Guns too.
Engineers are allowed access to the Engines and Guns.&quot;</span>
</span>
</p>
<p class="western">
<span class="font1">
<span style="font-size: 3">
<span class="font-small">
<span>Most
importantly, we can see that Han and R2D2 are now in </span><i>two</i><span>
places in the ACL. It is not necessary for them to be uniquely
categorized at all. This defines the policy more clearly to the
reader: &quot;Ahh, Han and R2D2 have access to the Engines and Guns
because they're </span><i>engineers</i><span>.&quot;</span>
</span>
</span>
</span>
</p>
<h2 class="western">
<span class="font1">Adding
people</span>
</h2>
<p class="western">
<span class="font1">
<span class="font-small">Han
goes to Cloud City to pick up Lando and get some repairs. Lando's the
Millennium Falcon's previous owner, so Han reckons he qualifies as
Crew. Lando also offers the services of his top engineer, Hontook,
for help with repairing the ship while they're in dock.</span>
</span>
</p>
<p class="western">
<span class="font-code">Default: DENY
ALL<br />Millennium Falcon Passengers<br />&#9500;&#9472;Crew [ALLOW:
ALL]<br />&#9474; &#9500;&#9472;Han<br />&#9474; &#9500;&#9472;Chewie [DENY:
Engines]<br />&#9474; &#9492;&#9472;<strong>Lando</strong><br />&#9500;&#9472;Passengers [ALLOW:
Lounge]<br />&#9474; &#9500;&#9472;Jedi [ALLOW: Cockpit]<br />&#9474; &#9474;
&#9500;&#9472;Obi-wan<br />&#9474; &#9474; &#9492;&#9472;Luke [ALLOW:
Guns] <br />&#9474; &#9500;&#9472;R2D2<br />&#9474;
&#9492;&#9472;C3PO<br />&#9492;&#9472;Engineers [ALLOW: Engines,
Guns]<br /> &#9500;&#9472;Han<br /> &#9500;&#9472;R2D2<br /> &#9492;&#9472;<strong>Hontook</strong></span>
</p>
<p class="western">
<span class="font1">
<span class="font-small">This
shows how easy it is to grant new people access. If we used the
original matrix scheme, we'd have to set permissions for each room
for both Lando and Hontook. Instead, we simply add them to their
appropriate groups and their access is implicitly and easily defined.</span>
</span>
</p>
<h2 class="western">
<span class="font1">Resolving
conflicts</span>
</h2>
<p class="western">
<span class="font1">What
happens if we add Chewie to the list of Engineers?</span>
</p>
<p class="western">
<span class="font-code">Default: DENY
ALL<br />Millennium Falcon Passengers<br />&#9500;&#9472;Crew [ALLOW:
ALL]<br />&#9474; &#9500;&#9472;Han<br />&#9474; &#9500;&#9472;Chewie [DENY:
Engines]<br />&#9474; &#9492;&#9472;Lando<br />&#9500;&#9472;Passengers [ALLOW:
Lounge]<br />&#9474; &#9500;&#9472;Jedi [ALLOW: Cockpit]<br />&#9474; &#9474;
&#9500;&#9472;Obi-wan<br />&#9474; &#9474; &#9492;&#9472;Luke [ALLOW:
Guns] <br />&#9474; &#9500;&#9472;R2D2<br />&#9474;
&#9492;&#9472;C3PO<br />&#9492;&#9472;Engineers [ALLOW: Engines,
Guns]<br /> &#9500;&#9472;Han<br /> &#9500;&#9472;R2D2<br /> &#9500;&#9472;Hontook<br />
&#9492;&#9472;<strong>Chewie</strong></span>
</p>
<p class="western">This makes Chewie's access to the Engines
ambiguous, because now there are two paths from the root of the tree
to Chewie. If the ship's computer follows one path (along the &quot;Crew&quot;
branch), the result is &quot;DENY access to Engines.&quot; If it
follows the other path (along the &quot;Engineers&quot; branch) then
the result is &quot;ALLOW access to Engines&quot;. So, is he allowed
or denied?</p>
<p class="western">phpGACL will warn you if you add or edit an
multiply-grouped ARO in such a way that the ARO's access to an
arbitrary ACO would be ambiguous. But it is <u>up to you</u>. to
resolve the conflict.</p>
<p class="western">If we now asked phpGACL the question &quot;Does
Chewie have access to Engines?&quot; the result returned is the
result given by the <u>last ACL entry to be modified</u>. (this is
phpGACL's policy). In this case the result is ALLOW, because the
&quot;ALLOW: Engines, Guns&quot; directive assigned to the Engineers
Group is more recent than the &quot;DENY: Engines&quot; directive
assigned to Chewie's Group.</p>
<p class="western">When ambiguous access entries exist in the ACL,
the ACL is said to be <strong>inconsistent</strong>. Inconsistent ACLs can be
very dangerous, and you may unwittingly provide access to
inappropriate people if you allow your ACL to remain in this state.
When phpGACL warns you that the ACL is inconsistent, it is best to
resolve the conflicts as soon as possible to regain consistency.</p>
<p class="western">To resolve the conflict in this case, we could
either:</p>
<ul>
<li value=1>
<p class="western">Remove the &quot;DENY: Engines&quot;
directive from Chewie's entry under the Crew Group.</p>
<li>
<p class="western">Add a &quot;DENY: Engines&quot; directive to
Chewie's entry under the Engineers Group.</p>
<li>
<p class="western">Remove Chewie from the Engineers Group, since
Han doesn't think him a worthy Engineer anyway.</p>
</ul>
<p class="western">Han chooses option 3, and removes Chewie from the
Engineers list.</p>
<h2 class="western">Naming Access Objects</h2>
<p class="western">
<span class="font5">
<span class="font-small">phpGACL
uniquely identifies each Access Object (AROs, AXOs and ACOs) with a
two-keyword combination and it's Access Object type.</span>
</span>
</p>
<p class="western">
<span class="font5">
<span class="font-small">The
tuple &quot;(Access Object type, Section, Value)&quot; uniquely
identifies any Access Object.</span>
</span>
</p>
<p class="western">
<span class="font5">
<span class="font-small">The
first element of the tuple is the type of Access Object (ARO, AXO or
ACO).</span>
</span>
</p>
<p class="western">
<span class="font3">
<span style="font-size: 3">
<span class="font-small">
<span class="font5">
<span>The
second element of the tuple, called the </span><strong>Section</strong><span>,
is a user-defined string which names the general category of the
Access Object. Multiple Access Objects can share the same Section
name. The Section name should be short but descriptive. It's used in
the user interface in selection boxes, so try not to make it too
long.</span>
</span>
</span>
</span>
</span>
</p>
<p class="western">
<span class="font5">
<span class="font-small">Sections
are stored in a flat namespace; they are not nestable like Groups.
Sections have nothing to do with Groups or the ARO/AXO trees - they
are purely a mechanism for helping to maintain large numbers of
Access Objects.</span>
</span>
</p>
<p class="western">
<span class="font3">
<span style="font-size: 3">
<span class="font-small">
<span class="font5">
<span>The
third element of the tuple is a user-defined name for the Access
Object, and is called the </span><strong>Value</strong><span>. <u>A
Value cannot contain spaces</u>. (however, a Section can).</span>
</span>
</span>
</span>
</span>
</p>
<p class="western">
<span class="font5">
<span class="font-small"><u>Both
Section and Values are case sensitive.</u>.</span>
</span>
</p>
<p class="western" style="margin-left: 0.38in; margin-top: 0; margin-bottom: 0in; line-height: 1rem">
<span class="font3">
<span style="font-size: 3">
<span class="font-small">
<span class="font5"><strong>Aside:</strong><span>
It is commonly asked why strings are used to identify Access Objects,
rather than integers which ostensibly seem faster. The answer is for
legibility. It is much easier to understand:<br /> </span></span><span>
<span class="font-code-2">acl_check('system',
'login', 'users', 'john_doe');<br /></span>
<span class="font5">than:</span>
<span class="font-code-2"><br /> acl_check(10,
21004, 15, 20304);</span>
</span>
</span>
</span>
</span>
</p>
<p class="western">
<span class="font3">
<span style="font-size: 3">
<span class="font-small">
<span class="font5">
<span>Since
it is often obvious from the context which type of Access Object we
are referring to, the interface for phpGACL (and this documentation)
drops the Access Object type and uses the format &quot;</span><strong>Section
&gt; Value</strong><span>&quot; when displaying the name of
an Access Object. However, the API requires an Access Object's
&quot;Section&quot; and &quot;Value&quot; to be specified in separate
function arguments (the Access Object type is usually implicit in the
argument description).</span>
</span>
</span>
</span>
</span>
</p>
<p class="western">
<span class="font5">
<span class="font-small"><strong>Example
ACO &quot;Section &gt; Values&quot;:</strong></span>
</span>
</p>
<ul>
<li value=1>
<p class="western">
<span class="font5">
<span class="font-small">&quot;Floors
&gt; 1st&quot;</span>
</span>
</p>
<li>
<p class="western">
<span class="font5">
<span class="font-small">&quot;Floors
&gt; 2nd&quot;</span>
</span>
</p>
<li>
<p class="western">
<span class="font5">
<span class="font-small">&quot;Rooms
&gt; Engines&quot;</span>
</span>
</p>
</ul>
<p class="western font-weight-bold">Example ARO &quot;Section &gt; Values&quot;:</p>
<ul>
<li value=1>
<p class="western">
<span class="font5">
<span class="font-small">&quot;People
&gt; John_Smith&rdquo;</span>
</span>
</p>
<li>
<p class="western">&ldquo;<span class="font5">
<span class="font-small">People
&gt; Cathy_Jones&rdquo;</span>
</span>
</p>
<li>
<p class="western">&ldquo;<span class="font5">
<span class="font-small">Hosts
&gt; sandbox.something.com&rdquo;</span>
</span>
</p>
</ul>
<p class="western"><strong>Example API usage:</strong></p>
<ul>
<li value=1>
<p class="western">
<span class="font5">
<span class="font-small">acl_check (
aco_section, aco_value, aro_section, aro_value);</span>
</span>
</p>
<li>
<p class="western">
<span class="font5">
<span class="font-small">acl_check (
'Floors', '2nd', 'People', 'John_Smith' );</span>
</span>
</p>
</ul>
<p class="western">
<span class="font5">
<span class="font-small"><strong>Valid
Naming Restrictions Examples:</strong></span>
</span>
</p>
<ul>
<li value=1>
<p class="western">
<span class="font5">
<span class="font-small">&quot;ACO
-Frob &gt; Flerg&quot;, &quot;ARO - Frob &gt; Flerg&quot; (The
Section and Value are the same in both, but this is fine as
namespaces are separate across Access Object types)</span>
</span>
</p>
<li>
<p class="western">
<span class="font5">
<span class="font-small">&quot;ACO
-Frob &gt; Flerg&quot;, &quot;ACO - Frob &gt; Queegle&quot; (The
Access Object type and Section are the same, but this is fine as the
Values are different)</span>
</span>
</p>
<li>
<p class="western">
<span class="font5">
<span class="font-small">&quot;AXO
- Frob Hrung &gt; Flerg&quot; (Sections can contain spaces)</span>
</span>
</p>
</ul>
<p class="western">
<span class="font5">
<span class="font-small"><strong>Invalid
Naming Restrictions Examples:</strong></span>
</span>
</p>
<ul>
<li value=1>
<p class="western">
<span class="font5">
<span class="font-small">&quot;ACO
- Frob &gt; Flerg&quot;, &quot;ACO - Frob &gt; Flerg&quot; (&quot;Access
Object type - Section &gt; Value&quot; must be unique)</span>
</span>
</p>
<li>
<p class="western">
<span class="font5">
<span class="font-small">&quot;ACO
- Frob &gt; Flerg Habit&quot; (Values cannot contain spaces)</span>
</span>
</p>
</ul>
<h2 class="western">Adding Sections</h2>
<p style="line-height: 100%">
<span class="font5">Before
you can add a new Access Object, its Section must be defined. To add
a new section, use the add_object_section() function.</span>
</p>
<p class="western" style="line-height: 100%">
<span class="font2">
<span class="font-small">add_object_section
(</span>
</span>
</p>
<p style="margin-left: 2.5in; text-indent: -2in; line-height: 100%">
<span class="font2">
<span class="font-code">string
name,</span> A short description of what this Section is for. (e.g.
&quot;Levels in building&quot;).
</span>
</p>
<p style="margin-left: 2.5in; text-indent: -2in; line-height: 100%">
<span class="font2">
<span class="font-code">string
value,</span> The name of the Section (e.g. &quot;Floor&quot;).
</span>
</p>
<p style="margin-left: 2.5in; text-indent: -2in; line-height: 100%">
<span class="font2">
<span class="font-code">int ORDER,</span> An arbitrary value which affects the order this Section appears in the UI.
</span>
</p>
<p style="margin-left: 2.5in; text-indent: -2in; line-height: 100%">
<span class="font2">
<span class="font-code">bool HIDDEN, </span>Whether this should appear in the UI or not (TRUE means that is will be hidden).
</span>
</p>
<p style="margin-left: 2.5in; text-indent: -2in; line-height: 100%">
<span class="font2">
<span class="font-code">string GROUP_TYPE) </span>The Access Object type (&quot;aco&quot;, &quot;aro&quot; or &quot;axo&quot;)</span>
</p>
<p class="western">
<span class="font5">
<span class="font-small">Han
creates 3 Sections for the AROs. &quot;Humans&quot;, &quot;Aliens&quot;
and &quot;Androids&quot;. Let's list the AROs with their full names</span>
</span>
</p>
<p class="western">
<span class="font-code">Millennium
Falcon Passengers<br />&#9500;&#9472;Crew [ALLOW: ALL]<br />&#9474;
&#9500;&#9472;<strong>&quot;Humans &gt; Han&quot;</strong><br />&#9474; &#9500;&#9472;<strong>&quot;Aliens
&gt; Chewie&quot;</strong> [DENY: Engines]<br />&#9474; &#9492;&#9472;<strong>&quot;Humans
&gt; Lando&quot;</strong><br />&#9500;&#9472;Passengers [ALLOW: Lounge]<br />&#9474;
&#9500;&#9472;Jedi [ALLOW: Cockpit]<br />&#9474; &#9474; &#9500;&#9472;<strong>&quot;Humans
&gt; Obi-wan&quot;</strong><br />&#9474; &#9474; &#9492;&#9472;<strong>&quot;Humans
&gt; Luke&quot;</strong> [ALLOW: Guns] <br />&#9474; &#9500;&#9472;<strong>&quot;Androids
&gt; R2D2&quot;</strong><br />&#9474; &#9492;&#9472;<strong>&quot;Androids &gt;
C3PO&quot;</strong><br />&#9492;&#9472;Engineers [ALLOW: Engines, Guns]<br />
&#9500;&#9472;<strong>&quot;Humans &gt; Han&quot;</strong><br /> &#9500;&#9472;<strong>&quot;Androids
&gt; R2D2&quot;</strong><br /> &#9492;&#9472;<strong>&quot;Aliens &gt; Hontook&quot;</strong></span>
</p>
<p class="western">
<span class="font5">
<span class="font-small">Sections
are just a way of categorizing Access Objects, to make the user
interface more usable, and the code for acl_check() more readable.
They do not affect the way phpGACL determines access to an object.
They cannot be nested (so it would not be able to create a &quot;Males&quot;
sub-Section under &quot;Humans&quot; for example; you'd have to
create a Section called &quot;Humans-Male&quot; or similar)</span>
</span>
</p>
<h2 class="western">Multiple Purposes</h2>
<p class="western">
<span class="font5">
<span class="font-small">You may need to use phpGACL for multiple independent purposes. For example, you may need to restrict user access to web pages, and also remote host access to your server. The two tasks are not related.</span>
</span>
</p>
<p class="western">
<span class="font5">
<span class="font-small">phpGACL can handle this in three different ways.</span>
</span>
</p>
<ul>
<li value=1>
<p class="western">
<span class="font5">
<span class="font-small">It can use an alternative database to store the access tables.</span>
</span>
</p>
<li>
<p class="western">
<span class="font5">
<span class="font-small">It can use the same database but with differently named access tables. (this feature is not implemented yet).</span>
</span>
</p>
<li>
<p class="western">
<span class="font5">
<span class="font-small">You can store the Access Objects for both purposes in the same tables, and carefully manage your list so that they don't conflict.</span>
</span>
</p>
</ul>
<p class="western">
<span class="font5">
<span class="font-small">To
implement Option 1 (and Option 2 when it becomes available), use the
$gacl_options array when creating a new phpGACL class. This allows
you to specify the database and table name prefixes to use:</span>
</span>
</p>
<p class="western my-0">
<span class="font-code-2">
<span class="font-small">$gacl_options
= array(<br /> 'db_table_prefix' =&gt; 'gacl_',<br /> 'db_type' =&gt;
'mysql',<br /> 'db_host' =&gt; 'host1',<br /> 'db_user' =&gt;
'user',<br /> 'db_password' =&gt; 'passwd',<br /> 'db_name' =&gt;
'gacl');</span>
</span>
</p>
<p class="western my-0">
<br />
</p>
<p class="western my-0">
<span class="font-code-2">
<span class="font-small">$gacl_host1 = new gacl($gacl_options);</span>
</span>
</p>
<p class="western">
<span class="font5">
<span class="font-small">To
implement Option 3, you must be careful, since phpGACL doesn't know
the relationship between your different tasks, and it will be
possible to make meaningless Access Policy Directives.</span>
</span>
</p>
<p class="western">
<span class="font5">
<span class="font-small">For
example, say Han wanted to restrict access to other ships contacting
his ship's computer, in addition to restricting access to the
different rooms. To do this, he might add &quot;Luke's X-Wing
Fighter&quot; as a remote ship ARO (in addition to other ships and an
ACO for the ship's computer). Because all AROs are in the same ARO
tree, it would be possible to create an APD like &quot;Ships &gt;
Luke's X-Wing Fighter&quot; [ALLOW: &quot;Rooms &gt; Lounge&quot;],
which would be totally meaningless! To help reduce mistakes like
this, good Section naming can make it clearer what Access Objects are
for which tasks. It should be obvious to any administrator that it's
meaningless to assign a Ship permission to use a Room.</span>
</span>
</p>
<h2 class="western">Access eXtension Objects</h2>
<p class="western"><strong>Access eXtension Objects</strong> (AXOs) can add a
3rd dimension to the permissions that can be configured in phpGACL.
We've seen how phpGACL allows you to combine an ARO and an ACO (2
dimensions) to create an Access Policy Directive. This is great for
simple permission requests like:</p>
<p class="western"> Luke (ARO) requests access to &quot;Guns&quot;
(ACO)</p>
<p class="western">If that's all you need, that's fine - AXOs are
totally optional.</p>
<p class="western">But because all ACOs are considered equal, it
makes it difficult to manage if there are many ACOs. If this is the
case, we can change the way we look at Access Objects to manage it
more easily.</p>
<p class="western">AXOs are identical to AROs in many respects. There
is an AXO tree (separate from the ARO tree), with it's own Groups and
AXOs. When dealing with AXOs, consider an AXO to take the old role of
the ACO (i.e. &quot;things to control access on&quot;), and change
the view of ACOs from &quot;things to control access on&quot; to
&quot;actions that are requested&quot;.</p>
<p class="western"><strong>ARO and ACO-only View:</strong></p>
<ul>
<li value=1>
<p class="western">AROs: Things requesting access</p>
<li>
<p class="western">ACOs: Things to control access on</p>
</ul>
<p class="western"><strong>ARO, ACO and AXO View:</strong></p>
<ul>
<li value=1>
<p class="western">AROs: Things requesting access</p>
<li>
<p class="western">ACOs: Actions that are requested</p>
<li>
<p class="western">AXOs: Things to control access on</p>
</ul>
<p class="western"><strong>Example:</strong></p>
<p class="western">A website manager is trying to manage access to
projects on the website. The ARO tree consists of all the users:</p>
<p class="western">
<span class="font-code">Website<br />&#9500;&#9472;Administrators<br />&#9474;
&#9500;&#9472;Alice<br />&#9474; &#9492;&#9472;Carol<br />&#9492;&#9472;Users<br />
&#9500;&#9472;Bob<br /> &#9492;&#9472;Alan</span>
</p>
<p class="western">The projects are organized by Operating System
into categories in the AXO tree:</p>
<p class="western">
<span class="font-code">Projects<br />&#9500;&#9472;Linux<br />&#9474;
&#9500;&#9472;SpamFilter2<br />&#9474; &#9492;&#9472;AutoLinusWorshipper<br />&#9492;&#9472;Windows<br />
&#9500;&#9472;PaperclipKiller<br /> &#9492;&#9472;PopupStopper</span>
</p>
<p class="western">The actions that can be taken with each project
are &quot;View&quot; and &quot;Edit&quot;. These are the ACOs.</p>
<p class="western">Now we want Bob to have &quot;View&quot; access to
all the Linux projects, so it's possible to add an ACL that links
Bob's ARO to the View ACO and the Linux AXO, and thus we can ask the
question:</p>
<p class="western"> Bob (ARO) requests access to &quot;View&quot;
(ACO) the project(s) called &quot;Linux&quot; (AXO)</p>
<p class="western">Keep in mind AXO's are optional, if you don't
specify an AXO when calling acl_check() and a matching ACL exists
with no AXO, it will be allowed. However if <u>only</u>. ACLs exist
with AXO's, and you call acl_check() without an AXO, it will fail.</p>
<p class="western">So basically as soon as you specify an AXO when
calling acl_check(), acl_check() will only search ACLs containing
AXO's. If no AXO is specified, only ACLs without AXOs are searched.
This in theory (I haven't benchmarked) gives us a slight performance
increase as well.</p>
<h1 class="western">Installation</h1>
<h2 class="western">Basic setup</h2>
<OL>
<li>
<p class="western">Untar the distribution .tar.gz file into the
root or a subdirectory of your web site. You might want to rename it
to something more suitable.<br /><br /><br />
</p>
<p class="western"><iMG SRC="manual_html_m48c2db5c.png" name="Graphic1" class="img-responsive" width="474" height="146" /><br style="clear: left;" /></p>
<li>
<p class="western">Edit phpgacl/gacl.ini.php using your
favourite editor and set the db_type, db_host, db_user, db_password,
and db_name you will be using.</p>
<li>
<p class="western">Create the database you specified in db_name
on the server.<br /><br /><br />
</p>
<p class="western"><img src="manual_html_m770a5a15.png" name="Graphic3" class="img-responsive" width="397" height="123"><br style="clear: left;" /></p>
<p class="western"></p>
<li>
<p class="western">Surf to
http://yoursite.net/phpgacl/setup.php. The required tables will be
installed based on your choice of database. Don't be afraid of the
truckload of output, if all goes well you will see only success
messages.<br /><br /><br />
</p>
</OL>
<p class="western"><img src="manual_html_7dced6ce.png" name="Graphic4" class="img-responsive" width="519" height="504" /><br style="clear: left;" /><br /><br />
</p>
<OL START=5>
<li>
<p class="western">Now follow the last advice shown on that
screen and create the phpgacl/admin/smarty/templates_c directory. It
must be writable by the user the webserver runs as. If you don't do
this, you will not be able to use the CAL admin!</p>
<li>
<p class="western">Click the link at the bottom of the
successful setup page or surf
to:<br />http://yoursite.net/phpgacl/admin/acl_admin.php</p>
</OL>
<h2 class="western">Advanced setup</h2>
<h3 class="western">Reusing an already existing ADOdb
installation</h3>
<p class="western">If you already have ADOdb installed you can get
phpGACL to use this copy of ADOdb.</p>
<OL>
<li>
<p class="western">Edit phpgacl/gacl.class.php so that ADODB_DIR
reflects the location of the ADOdb library in your path.</p>
<li>
<p class="western">Rename the phpgacl/adodb folder to something
else like adodb_x and reload the phpgacl/admin/acl_admin.php page to
ensure it still works.</p>
<li>
<p class="western">Erase the adodb directory installed with
phpGACL.</p>
</OL>
<h3 class="western">Reusing an already existing Smarty
installation</h3>
<p class="western">If you already have ADOdb installed you can get
phpGACL to use this copy of ADOdb.</p>
<OL>
<li>
<p class="western">Edit phpgacl/admin/gacl_admin.inc.php so that
the variables $smarty_dir and $smarty_compile_dir reflect the
location of the Smarty library in your path and the template_c
directory you already use.</p>
<p class="western">Move the templates directory that came with
phpGACL to another directory (e.g. one level up). Adjust the
$smarty_template_dir so it points to the new location. If you like
you can move those templates to your existing templates folder, of
course.</p>
<li>
<p class="western">Rename the phpgacl/smarty folder to something
else like smarty_x and reload the phpgacl/admin/acl_admin.php page
to ensure it still works.</p>
<li>
<p class="western">Erase the smarty directory installed with
phpGACL.</p>
</OL>
<h3 class="western">How do I move the phpGACL files out
of my website tree while leaving a link in the tree for
administration?</h3>
<OL>
<li>
<p class="western">Go to your website root.</p>
<li>
<p class="western">Move the phpGACL directory to your includes
directory and create a symlink to the admin directory where you want
the admin tool to go. For example:</p>
<p class="western">mv phpgacl/ /www/includes_directory<br />ln -s
/www/includes_directory/phpgacl/admin/ gacl</p>
<li>
<p class="western">Now surfing to
http://yoursite.net/gacl/acl_admin.php will take you to the admin
page. If it doesn't work, make sure your Webserver allows symbolic
links in the website tree.</p>
</OL>
<h1 class="western">Using phpGACL in your application</h1>
<h2 class="western">Basic usage</h2>
<p class="western">This example shows a basic example of using
phpGACL in your code. It uses the ADOdb abstraction layer as well,
and shows a simple way to validate a login attempt against a
database.</p>
<p class="western">
<span class="font6">
<span style="color: #ff0000">//
include basic ACL api</span><br />
<span style="color: #00cccc">include</span>('<span style="color: #008000">phpgacl/gacl.class.php</span>');<br />$<span style="color: #ff6633">gacl</span>
= <span style="color: #00cccc">new</span> gacl();
</span>
</p>
<p class="western">
<span class="font6">$<span style="color: #ff6633">username</span>
= $<span style="color: #ff6633">db</span>-&gt;<span style="color: #00cccc">quote</span>($<span style="color: #ff6633">_POST</span>['<span style="color: #008000">username</span>']);<br />$<span style="color: #ff6633">password</span>
= $<span style="color: #ff6633">db</span>-&gt;<span style="color: #00cccc">quote</span>(md5($<span style="color: #ff6633">_POST</span>['<span style="color: #008000">password</span>']));<br />$<span style="color: #ff6633">sql</span>
= '<span style="color: #008000">SELECT name FROM users WHERE name=</span>';<br />$<span style="color: #ff6633">sql</span>
.= $<span style="color: #ff6633">username</span>.' <span style="color: #008000">AND
password=</span>'.$<span style="color: #ff6633">password</span>;<br />$<span style="color: #ff6633">row</span>
= $<span style="color: #ff6633">db</span>-&gt;<span style="color: #00cccc">GetRow</span>($<span style="color: #ff6633">sql</span>);</span>
</p>
<p class="western">
<span class="font6">
<span style="color: #00cccc">if</span>($<span style="color: #ff6633">gacl</span>-&gt;<span style="color: #00cccc">acl_check</span>('<span style="color: #008000">system</span>','<span style="color: #008000">login</span>','<span style="color: #008000">user</span>',$<span
color="#ff6633">row</span>['<span style="color: #008000">name</span>'])){<br />
$<span style="color: #ff6633">_SESSION</span>['<span style="color: #008000">username</span>']
= $<span style="color: #ff6633">row</span>['<span style="color: #008000">name</span>'];<br />
<span style="color: #00cccc">return</span>
<span style="color: #6b4794">true</span>;<br />}<br />
<span style="color: #00cccc">else</span><br />
<span style="color: #00cccc">return</span>
<span style="color: #6b4794">false</span>;
</span>
</p>
<p class="western">As you can see there is only one call to
acl_check() in this code. What does it do? Well, it</p>
<ul>
<li>
<p class="western">checks the ARO object $row['name'] from the
ARO section 'user'</p>
<li>
<p class="western">against the ACO object 'login' from the ACO
section 'system'.</p>
</ul>
<h2 class="western">Advanced usage</h2>
<p class="western"><br /><br />
</p>
<h1 class="western">Using the ACL admin utility</h1>
<p class="western">If you want to get a grip on the included ACL
admin utitlity, it will help you a lot if you run the example.php
file. It contains some ACO, ARO and AXO objects, as well as some ACL
defined using those objects. After running it, you should see some
sample data in the admin interface.<br /><br /><br />
</p>
<p class="western"><img src="manual_html_4b803670.png" name="Graphic5" class="img-responsive" width="531" height="488" /><br style="clear: left;" /><br /><br />
</p>
<p class="western">Play around with it, and if you get stuck, come
back and read on...</p>
<p class="western">(yet to be written)</p>
<h2 class="western">ACL's</h2>
<h3 class="western">Creating</h3>
<p class="western">You must have a minimum of an ACO and an ARO
defined to create an ACL.</p>
<p class="western">Select an ACO Section then select from the
available items show in the Access Control Objects list. Click the [
&gt; &gt; ] button to add the Section-ACO to the Selected list. You
may add any number of Section-ACO pairs to this list.</p>
<p class="western"><img src="manual_html_m608b392a.png" name="Graphic9" class="img-responsive" width="531" height="177" /><br style="clear: left;" /><br /><br />
</p>
<p class="western">Next select an ARO Section. At this point you may
select from either the Access Request Objects list or from the ARO
Groups list.</p>
<p class="western"><img SRC="manual_html_157037e7.png" name="Graphic10" class="img-responsive" width="531" height="157" /><br style="clear: left;" /><br /><br />
</p>
<p class="western">Select on of the ACL Sections (usually &ldquo;user&rdquo;
for this case), provide a brief description in the Note area and then
click Submit. Click on the &ldquo;ACL Admin&rdquo; tab and you will
see your new ACL in the list.</p>
<h3 class="western">Sections</h3>
<p class="western"><img src="manual_html_676f8c98.png" name="Graphic7" class="img-responsive" width="518" height="149" /><br style="clear: left;" />A
default install provides you with two ACL sections &ndash; 'system'
and 'user'. You would typically put user created ACL's (for example,
those you enter via the admin interface) in the 'user' section and
put ACL's generated by code in the 'system' section. However, you
can use the ACL sections to provide any other logical grouping that
suits your purposes.</p>
<h3 class="western">Extended Return Value</h3>
<p class="western">Typically a call to the acl_check method will
return a boolean value. However, you may specify a different value
or evan a string to be returned.
</p>
<p class="western">For example, you may negotiate for a user to login
at a cost of $0.20 per time by default and another for $0.18 per time
under a different scheme. You could create a separate ACL for the
default login and for the special use but varying the 'return value'.
If the call to acl_check is successful, you will know the cost of
the login via the return value.</p>
<h3 class="western">Notes</h3>
<p class="western">It's a good idea to add a note when creating an
ACL to help remember it's purpose, for example &ldquo;Basic
permissions for a user in the Administrator group&rdquo;.</p>
<p class="western"><img src="manual_html_m4f4324cb.png" name="Graphic8" class="img-responsive" width="526" height="120" /><br style="clear: left;" /><br /><br />
</p>
<h1 class="western"><a name="Glossary"></a>Glossary</h1>
<h2 class="western">ACO</h2>
<p class="western">
<span class="font5">
<span class="font-small"><dfn>Access Control Object &ndash; An action that are requested to be performed.</dfn></span>
</span>
</p>
<h2 class="western">ARO</h2>
<p class="western">
<span class="font5">
<span class="font-small"><dfn><span>
<span class="font-small">
<span class="font5">Access Request Object &ndash; An entity (for example, a user) that is requesting an action to be performed.</span>
</span>
</span></dfn></span>
</span>
</p>
<h2 class="western">AXO</h2>
<p class="western">
<span class="font5">
<span class="font-small"><dfn><span>
<span class="font-small">
<span class="font5">
Access eXtension Object &ndash; An object to perform an action on for an entity.</span>
</span>
</span></dfn></span>
</span>
</p>
<h1 class="western">References</h1>
<h2 class="western">phpGACL API</h2>
<p class="western" style="line-height: 100%">
<span class="font5">
<span class="font-small">The API documentation is included in the tarball under the /docs/phpdoc/ directory.</span>
</span>
</p>
<h2 class="western">phpGACL Examples and Tutorials</h2>
<p class="western" style="line-height: 100%">
<span class="font5">
<span class="font-small">See example.php included in the tarball.</span>
</span>
</p>
<h2 class="western">Access Control Resources</h2>
<p class="western" style="line-height: 100%">
<span class="font5">
<span class="font-small">. . .</span>
</span>
</p>
<p class="western"><br /><br />
</p>
<h1 class="western">FAQ</h1>
<h2 class="western">Can phpGACL handle large sets of data?</h2>
<p class="western" style="line-height: 100%">
<span class="font5">
<span class="font-small">Not a problem at all. We've tested up to 100,000 AXO's and 100,000 ARO's on moderate hardware even. The performance issues come down to how well you can cache the ACL's, and how fast your database server is.</span>
</span>
</p>
</div>
</body>
</html>