fix: e2e ci misc fixes (#7785)
[openemr.git] / gacl / docs / manual.html
blob5290607d498bb06dd3dd4ca70c2210f0e20b24a7
1 <!DOCTYPE HTML>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8" />
5 <title>phpGACL</title>
6 <!-- OpenEMR - Adds Bootstrap to this file !-->
7 <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
8 <link rel="stylesheet" href="../../public/assets/bootstrap/dist/css/bootstrap.min.css" />
9 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
10 <meta name="generator" content="OpenOffice.org 2.0 (Linux)" />
11 <meta name="author" content="jrussell" />
12 <meta name="created" content="20030206;8320000" />
13 <meta name="changed" content="20060903;16430300" />
14 <meta name="sdfootnote" content=";;;;P" />
15 <meta name="sdendnote" content="arabic" />
16 <style>
17 .font1 {
18 font-family: "Bitstream Vera Sans Mono", sans-serif !important;
21 .font2 {
22 font-family: Arial, sans-serif !important;
25 .font3 {
26 font-family: "Times New Roman", serif !important;
29 .font4 {
30 font-family: "Luxi Sans", sans-serif !important;
33 .font5 {
34 font-family: Helvetica, Arial, sans-serif !important;
37 .font6 {
38 font-family: "Courier New", sans-serif !important;
41 .font-code {
42 font-family: "Courier New", monospace !important;
45 .font-code-2 {
46 font-family: Courier, "Courier New", monospace !important;
49 .font-small {
50 font-size: small;
53 p {
54 margin-top: 0.48rem;
55 margin-bottom: 0.48rem;
56 color: #000000;
57 line-height: 1rem;
58 widows: 2;
59 orphans: 2;
62 p.western {
63 font-family: "Bitstream Vera Sans Mono", sans-serif;
64 font-size: 0.8125rem;
67 p.cjk {
68 font-family: "Times New Roman", serif;
69 font-size: 0.8125rem;
72 h1 {
73 margin-bottom: 0.25rem;
74 border-top: none;
75 border-bottom: 1px solid #4700b8;
76 border-left: 7px solid #4700b8;
77 border-right: none;
78 padding-top: 0;
79 padding-bottom: 0.125rem;
80 padding-left: 0.125rem;
81 padding-right: 0;
82 color: #000000;
83 widows: 2;
84 orphans: 2;
85 page-break-before: always;
88 h1.western {
89 font-family: "Arial", sans-serif;
90 font-size: 1.3125rem;
93 h1.cjk {
94 font-family: "MS Mincho", "MS ??", monospace;
95 font-size: 1.3125rem;
98 h1.ctl {
99 font-family: "Arial Unicode MS";
100 font-size: 1rem;
103 h2 {
104 margin-bottom: 0.25rem;
105 color: #000000;
106 widows: 2;
107 orphans: 2;
110 h2.western {
111 font-family: "Georgia", serif;
112 font-size: 1.0625rem;
113 font-style: normal;
116 h2.cjk {
117 font-family: "MS Mincho", "MS ??", monospace;
118 font-size: 1.125rem;
119 font-style: italic;
122 h2.ctl {
123 font-family: "Arial Unicode MS";
124 font-size: 1rem;
127 h3 {
128 margin-top: 0.48rem;
129 margin-bottom: 0.48rem;
130 color: #000000;
131 line-height: 1rem;
132 widows: 2;
133 orphans: 2;
136 h3.western {
137 font-family: "Helv", "Arial", sans-serif;
138 font-size: 0.8125rem;
141 h3.cjk {
142 font-family: "Times New Roman", serif;
143 font-size: 0.8125rem;
146 h3.ctl {
147 font-family: "Arial Unicode MS";
148 font-size: 1rem;
151 h4 {
152 margin-top: 0.48rem;
153 margin-bottom: 0.48rem;
154 color: #000000;
155 line-height: 1rem;
156 widows: 2;
157 orphans: 2;
160 h4.western {
161 font-family: "Helv", "Arial", sans-serif;
162 font-size: 0.8125rem;
163 font-style: italic;
166 h4.cjk {
167 font-family: "Times New Roman", serif;
168 font-size: 0.8125rem;
169 font-style: italic;
172 h4.ctl {
173 font-family: "Arial Unicode MS";
174 font-size: 1rem;
177 A:link {
178 color: #0000ff;
181 @media print {
182 @page {
183 size: 8.27in 11.69in;
184 margin: 1.18in;
188 margin-top: 0.08in;
189 margin-bottom: 0.25rem;
190 line-height: 1rem;
193 p.western, p.cjk {
194 font-size: 10pt;
197 h1 {
198 margin-bottom: 0.04in;
199 border-bottom: 1px solid #4700b8;
200 border-left: 5.00pt solid #4700b8;
201 padding-bottom: 0.02in;
202 padding-left: 0.02in;
205 h2 {
206 margin-bottom: 0.04in;
209 h3 {
210 margin-top: 0.08in;
211 margin-bottom: 0.25rem;
212 line-height: 1rem;
215 h4 {
216 margin-top: 0.08in;
217 margin-bottom: 0.25rem;
218 line-height: 1rem;
221 h1.western, h1.cjk {
222 font-size: 16pt;
225 h2.western {
226 font-size: 13pt;
229 h2.cjk {
230 font-size: 14pt;
233 h3.western, h3.cjk, h4.western, h4.cjk {
234 font-size: 10pt;
237 h1.ctl, h2.ctl, h3.ctl, h4.ctl {
238 font-size: 12pt;
241 .image-space {
242 content: ' ';
243 display: block;
245 </style>
246 </head>
248 <body dir="ltr">
249 <div class="container">
250 <p class="text-center image-space" style="margin-top: 1rem; line-height: 100%; page-break-after: avoid;">
251 <img src="manual_html_m54d0ced8.png" id="Graphic6" class="img-responsive d-block ml-auto" width="165" height="45" alt="phpGACL Logo" />
252 </p>
253 <p class="text-center" style="margin-top: 1rem; line-height: 100%; page-break-after: avoid;">
254 <span class="font4">
255 <span class="font-weight-bold" style="font-size: x-large">Generic Access Control Lists with PHP</span>
256 </span>
257 </p>
258 <p class="western">
259 <span class="font1">Mike Benoit &lt;</span>
260 <span<u><a href="mailto:ipso@snappymail.ca">
261 <span class="font1">ipso@snappymail.ca</span>
262 </a></u>.</span>
263 <span class="font1">&gt;<br />James
264 Russell &lt;</span><a href="mailto:james-phpgacl@ps2-pro.com">
265 <span class="font1">james-phpgacl@ps2-pro.com</span>
266 </a>
267 <span class="font1">&gt;<br />Karsten Dambekalns &lt;</span><a href="mailto:k.dambekalns@fishfarm.de">
268 <span class="font1">k.dambekalns@fishfarm.de</span>
269 </a>
270 <span class="font1">&gt;</span>
271 </p>
272 <p class="western">
273 <span class="font1">Copyright &copy; 2002-2006 Mike Benoit<br />Copyright &copy; 2003, James Russell<br />Copyright &copy; 2003, Karsten Dambekalns</span>
274 </p>
275 <p class="western">
276 <span class="font1">Document Version: 60</span>
277 </p>
278 <p class="western">
279 <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>
280 </p>
281 <h1 class="western">Table of Contents</h1>
282 <div id="Table of Contents1" class="mb-3">
283 <p class="mt-0" style="margin-bottom: 0.25rem; line-height: 100%">
284 <span class="font2">Table of Contents 2</span>
285 </p>
286 <p class="mt-0" style="margin-bottom: 0.25rem; line-height: 100%">
287 <span class="font2"><a href="#about">About 4</a></span>
288 </p>
289 <p class="mt-0" style="margin-bottom: 1rem; margin-bottom: 0.25rem; line-height: 100%">
290 <span class="font2"><a href="#aboutisit">What is it? 4</a></span>
291 </p>
292 <p class="mt-0" style="margin-bottom: 1rem; margin-bottom: 0.25rem; line-height: 100%">
293 <span class="font2"><a href="#aboutgetit">Where can I get it? 4</a></span>
294 </p>
295 <p class="mt-0" style="margin-bottom: 1rem; margin-bottom: 0.25rem; line-height: 100%">
296 <span class="font2"><a href="#aboutrunit">What do I need to run it? 4</a></span>
297 </p>
298 <p class="mt-0" style="margin-bottom: 1rem; margin-bottom: 0.25rem; line-height: 100%">
299 <span class="font2">Who is responsible for it? 4</span>
300 </p>
301 <p class="mt-0" style="margin-bottom: 0.25rem; line-height: 100%">
302 <span class="font2"><a href="#introduction">Introduction 5</a></span>
303 </p>
304 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
305 <span class="font2">Understanding Access Control 5</span>
306 </p>
307 <p style="margin-left: 0.33in; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
308 <span class="font2">Who/Where 5</span>
309 </p>
310 <p style="margin-left: 0.33in; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
311 <span class="font2">Who/Where 6</span>
312 </p>
313 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
314 <span class="font2"><a href="#defaccesscontrol">Defining access control with phpGACL 6</a></span>
315 </p>
316 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
317 <span class="font2"><a href="#finegrainacccontrol">Fine-grain access control 8</a></span>
318 </p>
319 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
320 <span class="font2">Multi-level Groups 8</span>
321 </p>
322 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
323 <span class="font2">How does phpGACL determine
324 permissions? 9</span>
325 </p>
326 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
327 <span class="font2">Adding groups 10</span>
328 </p>
329 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
330 <span class="font2">Adding people 11</span>
331 </p>
332 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
333 <span class="font2">Resolving conflicts 11</span>
334 </p>
335 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
336 <span class="font2">Naming Access Objects 12</span>
337 </p>
338 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
339 <span class="font2">Adding Sections 14</span>
340 </p>
341 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
342 <span class="font2">Multiple Purposes 15</span>
343 </p>
344 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
345 <span class="font2">Access eXtension Objects 16</span>
346 </p>
347 <p style="margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
348 <span class="font2">Installation 18</span>
349 </p>
350 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
351 <span class="font2">Basic setup 18</span>
352 </p>
353 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
354 <span class="font2">Advanced setup 19</span>
355 </p>
356 <p style="margin-left: 0.33in; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
357 <span class="font2">Reusing an already existing ADOdb
358 installation 19</span>
359 </p>
360 <p class="mt-0" style="margin-left: 0.33in; margin-bottom: 0.25rem; line-height: 100%">
361 <span class="font2">Reusing an already existing Smarty
362 installation 20</span>
363 </p>
364 <p class="mt-0" style="margin-left: 0.33in; margin-bottom: 0.25rem; line-height: 100%">
365 <span class="font2">How do I move the phpGACL files out
366 of my website tree while leaving a link in the tree for
367 administration? 20</span>
368 </p>
369 <p style="margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
370 <span class="font2">Using phpGACL in your application 21</span>
371 </p>
372 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
373 <span class="font2">Basic usage 21</span>
374 </p>
375 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
376 <span class="font2">Advanced usage 21</span>
377 </p>
378 <p style="margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
379 <span class="font2">Using the ACL admin utility 22</span>
380 </p>
381 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
382 <span class="font2">ACL's 22</span>
383 </p>
384 <p style="margin-left: 0.33in; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
385 <span class="font2">Creating 22</span>
386 </p>
387 <p style="margin-left: 0.33in; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
388 <span class="font2">Sections 23</span>
389 </p>
390 <p style="margin-left: 0.33in; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
391 <span class="font2">Extended Return Value 24</span>
392 </p>
393 <p style="margin-left: 0.33in; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
394 <span class="font2">Notes 24</span>
395 </p>
396 <p style="margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
397 <span class="font2">Glossary 25</span>
398 </p>
399 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
400 <span class="font2">ACO 25</span>
401 </p>
402 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
403 <span class="font2">ARO 25</span>
404 </p>
405 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
406 <span class="font2">AXO 25</span>
407 </p>
408 <p style="margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
409 <span class="font2">References 26</span>
410 </p>
411 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
412 <span class="font2">phpGACL API 26</span>
413 </p>
414 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
415 <span class="font2">phpGACL Examples and Tutorials 26</span>
416 </p>
417 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
418 <span class="font2">Access Control Resources 26</span>
419 </p>
420 <p style="margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
421 <span class="font2">FAQ 27</span>
422 </p>
423 <p style="margin-bottom: 1rem; margin-top: 0; margin-bottom: 0.25rem; line-height: 100%">
424 <span class="font2">Can phpGACL handle large sets of
425 data? 27</span>
426 </p>
427 </div>
428 <h1 class="western" id="about">About</h1>
429 <h2 class="western" id="aboutisit"><span class="font1">What is it?</span></h2>
430 <p class="western">
431 <span class="font1">phpGACL
432 is an set of functions that allows you to apply access control to
433 arbitrary objects (web pages, databases, etc) by other arbitrary
434 objects (users, remote hosts, etc).</span>
435 </p>
436 <p class="western">
437 <span class="font1">It offers fine-grained access control with simple management, and is very fast.</span>
438 </p>
439 <p class="western">
440 <span class="font1">It
441 is written in PHP (hence <strong>php</strong>GACL), a popular scripting
442 language that is commonly used to dynamically create web pages. The
443 GACL part of phpGACL stands for Generic Access Control List.</span>
444 </p>
445 <h2 class="western" id="aboutgetit"><span class="font1">Where can I get it?</span></h2>
446 <p class="western">
447 <span class="font1">phpGACL is hosted by sourceforge.net at </span><a href="http://phpGACL.sourceforge.net/">
448 <span class="font1">http://phpGACL.sourceforge.net/</span>
449 </a>
450 </p>
451 <h2 class="western" id="aboutrunit"><span class="font1">What do I need to run it?</span></h2>
452 <p class="western">
453 <span class="font1">phpGACL
454 requires a relational database to store the access control
455 information. It accesses this database via an abstract wrapper called
456 </span><a href="http://php.weblogs.com/adodb">
457 <span class="font1">ADOdb</span>
458 </a>
459 <span class="font1">.
460 This is compatible with databases such as PostgreSQL, MySQL and
461 Oracle.</span>
462 </p>
463 <p class="western">
464 <span class="font1">phpGACL
465 is written in the </span><a href="http://www.php.net/">
466 <span class="font1">PHP</span>
467 </a>
468 <span class="font1">
469 scripting language. It requires PHP 4.2 and above.</span>
470 </p>
471 <p class="western">
472 <span class="font1">Access
473 Control List administration is performed by a web interface, and
474 therefore it is necessary to have a web server with PHP support, such
475 as </span><a href="http://httpd.apache.org/">
476 <span class="font1">Apache</span>
477 </a>
478 <span class="font1">.</span>
479 </p>
480 <h2 class="western">
481 <span class="font1">Who is responsible for it?</span>
482 </h2>
483 <p class="western">
484 <span class="font1">Mike Benoit </span>&lt;<a href="mailto:ipso@snappymail.ca">
485 <span class="font1">ipso@snappymail.ca</span>
486 </a>&gt;
487 <span class="font1">is the author and project manager.</span>
488 </p>
489 <p class="western">
490 <span class="font1">James Russell </span>&lt;<a href="mailto:james-phpgacl@ps2-pro.com">
491 <span class="font1">james-phpgacl@ps2-pro.com</span></a>&gt;
492 <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;
493 <span class="font1"> did the documentation.</span>
494 </p>
495 <h1 class="western" id="introduction">Introduction</h1>
496 <h2 class="western">
497 <span class="font1">Understanding
498 Access Control</span>
499 </h2>
500 <p class="western">
501 <span class="font1">
502 <span class="font-small">The
503 best way to explain access control is to use examples with real
504 things rather than trying to relate to concepts.</span>
505 </span>
506 </p>
507 <p class="western">
508 <span class="font1">
509 <span class="font-small">Han
510 is captain of the Millennium Falcon and Chewie is his second officer.
511 They've taken on board some passengers: Luke, Obi-wan, R2D2 and C3PO.
512 Han needs to define access restrictions for various rooms of the
513 ship: The Cockpit, Lounge, Engines and the external Guns.</span>
514 </span>
515 </p>
516 <p class="western">
517 <span class="font1">
518 <span class="font-small">Han
519 says: &quot;Me and Chewie should have access to everywhere, but after
520 a particularly messy hyperdrive repair, I forbid Chewie from going
521 near the Engine Room ever again. Passengers are confined to the
522 Passenger's Lounge.&quot;</span>
523 </span>
524 </p>
525 <p class="western">
526 <span class="font1">
527 <span class="font-small">Let's
528 assume from now on that access is Boolean. That is, the result of
529 looking up a person's access to a room is either ALLOW or DENY. There
530 is no middle ground.</span>
531 </span>
532 </p>
533 <p class="western">
534 <span class="font1">
535 <span style="font-size: 3">
536 <span class="font-small">
537 <span>If
538 we mapped this statement into an </span><strong>access matrix</strong><span>
539 showing who has access to where, it would look something like this (O
540 means ALLOW, X means DENY):</span>
541 </span>
542 </span>
543 </span>
544 </p>
545 <dl>
546 <dd>
547 <table class="table" width="337" border="1" cellpadding="7" cellspacing="0">
548 <col width="81">
549 <col width="56">
550 <col width="44">
551 <col width="31">
552 <col width="53">
553 <tr class="align-top">
554 <td width="81">
555 <h3 class="western text-right">
556 <span class="font1">Who/Where</span>
557 </h3>
558 </td>
559 <td width="56">
560 <p class="western text-center">
561 <span class="font1">
562 <span class="font-small">Cockpit</span>
563 </span>
564 </p>
565 </td>
566 <td width="44">
567 <p class="western text-center">
568 <span class="font1">
569 <span class="font-small">Lounge</span>
570 </span>
571 </p>
572 </td>
573 <td width="31">
574 <p class="western text-center">
575 <span class="font1">
576 <span class="font-small">Guns</span>
577 </span>
578 </p>
579 </td>
580 <td width="53">
581 <p class="western text-center">
582 <span class="font1">
583 <span class="font-small">Engines</span>
584 </span>
585 </p>
586 </td>
587 </tr>
588 <tr class="align-top">
589 <td width="81">
590 <p class="western text-right">
591 <span class="font1">
592 <span class="font-small">Han</span>
593 </span>
594 </p>
595 </td>
596 <td width="56" class="bg-success">
597 <p class="western text-center">
598 <span class="font1">
599 <span class="font-small">O</span>
600 </span>
601 </p>
602 </td>
603 <td width="44" class="bg-success">
604 <p class="western text-center">
605 <span class="font1">
606 <span class="font-small">O</span>
607 </span>
608 </p>
609 </td>
610 <td width="31" class="bg-success">
611 <p class="western text-center">
612 <span class="font1">
613 <span class="font-small">O</span>
614 </span>
615 </p>
616 </td>
617 <td width="53" class="bg-success">
618 <p class="western text-center">
619 <span class="font1">
620 <span class="font-small">O</span>
621 </span>
622 </p>
623 </td>
624 </tr>
625 <tr class="align-top">
626 <td width="81">
627 <p class="western text-right">
628 <span class="font1">
629 <span class="font-small">Chewie</span>
630 </span>
631 </p>
632 </td>
633 <td width="56" class="bg-success">
634 <p class="western text-center">
635 <span class="font1">
636 <span class="font-small">O</span>
637 </span>
638 </p>
639 </td>
640 <td width="44" class="bg-success">
641 <p class="western text-center">
642 <span class="font1">
643 <span class="font-small">O</span>
644 </span>
645 </p>
646 </td>
647 <td width="31" class="bg-success">
648 <p class="western text-center">
649 <span class="font1">
650 <span class="font-small">O</span>
651 </span>
652 </p>
653 </td>
654 <td width="53" class="bg-danger">
655 <p class="western text-center">
656 <span class="font1">
657 <span class="font-small">&times;</span>
658 </span>
659 </p>
660 </td>
661 </tr>
662 <tr class="align-top">
663 <td width="81">
664 <p class="western text-right">
665 <span class="font1">
666 <span class="font-small">Obi-wan</span>
667 </span>
668 </p>
669 </td>
670 <td width="56" class="bg-danger">
671 <p class="western text-center">
672 <span class="font1">
673 <span class="font-small">&times;</span>
674 </span>
675 </p>
676 </td>
677 <td width="44" class="bg-success">
678 <p class="western text-center">
679 <span class="font1">
680 <span class="font-small">O</span>
681 </span>
682 </p>
683 </td>
684 <td width="31" class="bg-danger">
685 <p class="western text-center">
686 <span class="font1">
687 <span class="font-small">&times;</span>
688 </span>
689 </p>
690 </td>
691 <td width="53" class="bg-danger">
692 <p class="western text-center">
693 <span class="font1">
694 <span class="font-small">&times;</span>
695 </span>
696 </p>
697 </td>
698 </tr>
699 <tr class="align-top">
700 <td width="81">
701 <p class="western text-right">
702 <span class="font1">
703 <span class="font-small">Luke</span>
704 </span>
705 </p>
706 </td>
707 <td width="56" class="bg-danger">
708 <p class="western text-center">
709 <span class="font1">
710 <span class="font-small">&times;</span>
711 </span>
712 </p>
713 </td>
714 <td width="44" class="bg-success">
715 <p class="western text-center">
716 <span class="font1">
717 <span class="font-small">O</span>
718 </span>
719 </p>
720 </td>
721 <td width="31" class="bg-danger">
722 <p class="western text-center">
723 <span class="font1">
724 <span class="font-small">&times;</span>
725 </span>
726 </p>
727 </td>
728 <td width="53" class="bg-danger">
729 <p class="western text-center">
730 <span class="font1">
731 <span class="font-small">&times;</span>
732 </span>
733 </p>
734 </td>
735 </tr>
736 <tr class="align-top">
737 <td width="81">
738 <p class="western text-right">
739 <span class="font1">
740 <span class="font-small">R2-D2</span>
741 </span>
742 </p>
743 </td>
744 <td width="56" class="bg-danger">
745 <p class="western text-center">
746 <span class="font1">
747 <span class="font-small">&times;</span>
748 </span>
749 </p>
750 </td>
751 <td width="44" class="bg-success">
752 <p class="western text-center">
753 <span class="font1">
754 <span class="font-small">O</span>
755 </span>
756 </p>
757 </td>
758 <td width="31" class="bg-danger">
759 <p class="western text-center">
760 <span class="font1">
761 <span class="font-small">&times;</span>
762 </span>
763 </p>
764 </td>
765 <td width="53" class="bg-danger">
766 <p class="western text-center">
767 <span class="font1">
768 <span class="font-small">&times;</span>
769 </span>
770 </p>
771 </td>
772 </tr>
773 <tr class="align-top">
774 <td width="81">
775 <p class="western text-right">
776 <span class="font1">
777 <span class="font-small">C3PO</span>
778 </span>
779 </p>
780 </td>
781 <td width="56" class="bg-danger">
782 <p class="western text-center">
783 <span class="font1">
784 <span class="font-small">&times;</span>
785 </span>
786 </p>
787 </td>
788 <td width="44" class="bg-success">
789 <p class="western text-center">
790 <span class="font1">
791 <span class="font-small">O</span>
792 </span>
793 </p>
794 </td>
795 <td width="31" class="bg-danger">
796 <p class="western text-center">
797 <span class="font1">
798 <span class="font-small">&times;</span>
799 </span>
800 </p>
801 </td>
802 <td width="53" class="bg-danger">
803 <p class="western text-center">
804 <span class="font1">
805 <span class="font-small">&times;</span>
806 </span>
807 </p>
808 </td>
809 </tr>
810 </table>
811 </dd>
812 </dl>
813 <p class="western">
814 <span class="font1">
815 <span style="font-size: 3">
816 <span class="font-small">
817 <span><span>The
818 columns list the rooms that Han wants to restrict access to, and the
819 rows list the people that might request access to those rooms. More
820 generally, the &quot;rooms&quot; are &quot;things to control access
821 on&quot;. We call these </span><strong>Access Control Objects</strong><span>
822 (ACOs). The &quot;people&quot; are &quot;things </span><i>requesting</i><span>
823 access&quot;. We call these </span><strong>Access Request Objects</strong><span>
824 (AROs). The </span><i>people</i><span> request access to
825 the </span><i>rooms</i><span>, or in our terminology,
826 </span><i>AROs</i><span> request access to the </span><i>ACOs</i><span>.</span></span>
827 </span>
828 </span>
829 </span>
830 </p>
831 <p class="western">
832 <span class="font1">
833 <span style="font-size: 3">
834 <span class="font-small">
835 <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>
836 </span>
837 </span>
838 </span>
839 </p>
840 <p class="western">
841 <span class="font1">
842 <span class="font-small">Managing access using an access matrix like the one above has advantages and disadvantages.</span>
843 </span>
844 </p>
845 <p class="western">
846 <span class="font1">
847 <span class="font-small"><i>Advantages:</i></span>
848 </span>
849 </p>
850 <ul>
851 <li>
852 <p class="western">
853 <span class="font1">
854 <span class="font-small">It's
855 very fine-grained. It's possible to control access for an individual
856 person if necessary.</span>
857 </span>
858 </p>
859 <li>
860 <p class="western">
861 <span class="font1">
862 <span style="font-size: 3"><span>
863 <span class="font-small">
864 It's
865 easy to see <u>who</u>. has access to <u>what</u>.. The answer is
866 stored in the intersection of the person and the room.
867 </span>
868 </span></span>
869 </span>
870 </p>
871 </ul>
872 <p class="western">
873 <span class="font1">
874 <span class="font-small"><i>Disadvantages:</i></span>
875 </span>
876 </p>
877 <ul>
878 <li value="1">
879 <p class="western">
880 <span class="font1">
881 <span class="font-small">It's
882 difficult to manage on a large scale. 6 passengers and 4 places is
883 fairly simple, but what if there were thousands of passengers and
884 hundreds of places, and you need to restrict access to large groups
885 of them at once, but still retain enough fine-grained control to
886 manage access for an individual? That would mean a lot of fiddly and
887 lengthy adjustment to the matrix, and it's a difficult task to
888 verify that the final matrix is correct.</span>
889 </span>
890 </p>
891 </li>
892 <li>
893 <p class="western">
894 <span class="font1">
895 <span class="font-small">It's
896 hard to summarize or visualize. The above example is fairly simple
897 to summarize in a few sentences (as Han did above), but what if the
898 matrix looked like this?</span>
899 </span>
900 </p>
901 <table class="table" width="337" border="1" cellpadding="7" cellspacing="0">
902 <col width="81">
903 <col width="52">
904 <col width="44">
905 <col width="35">
906 <col width="54">
907 <tr class="align-top">
908 <td width="81">
909 <h3 class="western text-right">
910 <span class="font1">Who/Where</span>
911 </h3>
912 </td>
913 <td width="52">
914 <p class="western text-center">
915 <span class="font1">
916 <span class="font-small">Cockpit</span>
917 </span>
918 </p>
919 </td>
920 <td width="44">
921 <p class="western text-center">
922 <span class="font1">
923 <span class="font-small">Lounge</span>
924 </span>
925 </p>
926 </td>
927 <td width="35">
928 <p class="western text-center">
929 <span class="font1">
930 <span class="font-small">Guns</span>
931 </span>
932 </p>
933 </td>
934 <td width="54">
935 <p class="western text-center">
936 <span class="font1">
937 <span class="font-small">Engines</span>
938 </span>
939 </p>
940 </td>
941 </tr>
942 <tr class="align-top">
943 <td width="81">
944 <p class="western text-right">
945 <span class="font1">
946 <span class="font-small">Han</span>
947 </span>
948 </p>
949 </td>
950 <td width="52" class="bg-success">
951 <p class="western text-center">
952 <span class="font1">
953 <span class="font-small">O</span>
954 </span>
955 </p>
956 </td>
957 <td width="44" class="bg-success">
958 <p class="western text-center">
959 <span class="font1">
960 <span class="font-small">O</span>
961 </span>
962 </p>
963 </td>
964 <td width="35" class="bg-success">
965 <p class="western text-center">
966 <span class="font1">
967 <span class="font-small">O</span>
968 </span>
969 </p>
970 </td>
971 <td width="54" class="bg-success">
972 <p class="western text-center">
973 <span class="font1">
974 <span class="font-small">O</span>
975 </span>
976 </p>
977 </td>
978 </tr>
979 <tr class="align-top">
980 <td width="81">
981 <p class="western text-right">
982 <span class="font1">
983 <span class="font-small">Chewie</span>
984 </span>
985 </p>
986 </td>
987 <td width="52" class="bg-success">
988 <p class="western text-center">
989 <span class="font1">
990 <span class="font-small">O</span>
991 </span>
992 </p>
993 </td>
994 <td width="44" class="bg-danger">
995 <p class="western text-center">
996 <span class="font1">
997 <span class="font-small">&times;</span>
998 </span>
999 </p>
1000 </td>
1001 <td width="35" class="bg-success">
1002 <p class="western text-center">
1003 <span class="font1">
1004 <span class="font-small">O</span>
1005 </span>
1006 </p>
1007 </td>
1008 <td width="54" class="bg-danger">
1009 <p class="western text-center">
1010 <span class="font1">
1011 <span class="font-small">&times;</span>
1012 </span>
1013 </p>
1014 </td>
1015 </tr>
1016 <tr class="align-top">
1017 <td width="81">
1018 <p class="western text-right">
1019 <span class="font1">
1020 <span class="font-small">Obi-wan</span>
1021 </span>
1022 </p>
1023 </td>
1024 <td width="52" class="bg-danger">
1025 <p class="western text-center">
1026 <span class="font1">
1027 <span class="font-small">&times;</span>
1028 </span>
1029 </p>
1030 </td>
1031 <td width="44" class="bg-success">
1032 <p class="western text-center">
1033 <span class="font1">
1034 <span class="font-small">O</span>
1035 </span>
1036 </p>
1037 </td>
1038 <td width="35" class="bg-danger">
1039 <p class="western text-center">
1040 <span class="font1">
1041 <span class="font-small">&times;</span>
1042 </span>
1043 </p>
1044 </td>
1045 <td width="54" class="bg-danger">
1046 <p class="western text-center">
1047 <span class="font1">
1048 <span class="font-small">&times;</span>
1049 </span>
1050 </p>
1051 </td>
1052 </tr>
1053 <tr class="align-top">
1054 <td width="81">
1055 <p class="western text-right">
1056 <span class="font1">
1057 <span class="font-small">Luke</span>
1058 </span>
1059 </p>
1060 </td>
1061 <td width="52" class="bg-success">
1062 <p class="western text-center">
1063 <span class="font1">
1064 <span class="font-small">O</span>
1065 </span>
1066 </p>
1067 </td>
1068 <td width="44" class="bg-success">
1069 <p class="western text-center">
1070 <span class="font1">
1071 <span class="font-small">O</span>
1072 </span>
1073 </p>
1074 </td>
1075 <td width="35" class="bg-success">
1076 <p class="western text-center">
1077 <span class="font1">
1078 <span class="font-small">O</span>
1079 </span>
1080 </p>
1081 </td>
1082 <td width="54" class="bg-danger">
1083 <p class="western text-center">
1084 <span class="font1">
1085 <span class="font-small">&times;</span>
1086 </span>
1087 </p>
1088 </td>
1089 </tr>
1090 <tr class="align-top">
1091 <td width="81">
1092 <p class="western text-right">
1093 <span class="font1">
1094 <span class="font-small">R2-D2</span>
1095 </span>
1096 </p>
1097 </td>
1098 <td width="52" class="bg-danger">
1099 <p class="western text-center">
1100 <span class="font1">
1101 <span class="font-small">&times;</span>
1102 </span>
1103 </p>
1104 </td>
1105 <td width="44" class="bg-success">
1106 <p class="western text-center">
1107 <span class="font1">
1108 <span class="font-small">O</span>
1109 </span>
1110 </p>
1111 </td>
1112 <td width="35" class="bg-danger">
1113 <p class="western text-center">
1114 <span class="font1">
1115 <span class="font-small">&times;</span>
1116 </span>
1117 </p>
1118 </td>
1119 <td width="54" class="bg-success">
1120 <p class="western text-center">
1121 <span class="font1">
1122 <span class="font-small">O</span>
1123 </span>
1124 </p>
1125 </td>
1126 </tr>
1127 <tr class="align-top">
1128 <td width="81">
1129 <p class="western text-right">
1130 <span class="font1">
1131 <span class="font-small">C3PO</span>
1132 </span>
1133 </p>
1134 </td>
1135 <td width="52" class="bg-success">
1136 <p class="western text-center">
1137 <span class="font1">
1138 <span class="font-small">O</span>
1139 </span>
1140 </p>
1141 </td>
1142 <td width="44" class="bg-success">
1143 <p class="western text-center">
1144 <span class="font1">
1145 <span class="font-small">O</span>
1146 </span>
1147 </p>
1148 </td>
1149 <td width="35" class="bg-danger">
1150 <p class="western text-center">
1151 <span class="font1">
1152 <span class="font-small">&times;</span>
1153 </span>
1154 </p>
1155 </td>
1156 <td width="54" class="bg-success">
1157 <p class="western text-center">
1158 <span class="font1">
1159 <span class="font-small">O</span>
1160 </span>
1161 </p>
1162 </td>
1163 </tr>
1164 </table>
1165 <p class="western">
1166 <span class="font1">
1167 <span class="font-small">This
1168 matrix is not so obvious to summarize, and it's not clear to the
1169 reader why those access decisions might have been made in the first
1170 place.</span>
1171 </span>
1172 </p>
1173 </li>
1174 </ul>
1175 <h2 class="western" id="defaccesscontrol"><span class="font1">Defining access control with phpGACL</span></h2>
1176 <p class="western">
1177 <span class="font1">It
1178 seems that for large or complex situations, this 'access matrix'
1179 approach is clearly unsuitable. We need a better system that
1180 maintains the advantages (fine-grain control and a clear idea of <u>who</u>.
1181 has access to <u>what</u>.) but removes the disadvantages (difficult
1182 to summarize, and difficult to manage large groups of people at
1183 once). One solution is phpGACL.</span>
1184 </p>
1185 <p class="western">
1186 <span class="font1">
1187 <span style="font-size: 3"><span>
1188 <span class="font-small">
1189 phpGACL
1190 doesn't describe access from the 'bottom-up' like the Access Matrix
1191 above. Instead, it describes it 'top-down', like the textual
1192 description of Han's access policy. This is a very flexible system
1193 that allows you to manage access in large groups, it neatly
1194 summarizes the access policy, and it's easy to see <u>who </u>.has
1195 access to <u>what</u>..
1196 </span>
1197 </span></span>
1198 </span>
1199 </p>
1200 <p class="western">
1201 <span class="font1">
1202 <span style="font-size: 3">
1203 <span class="font-small">
1204 <span>An
1205 </span><strong>ARO tree</strong><span> defines a hierarchy of
1206 </span><strong>Groups</strong><span> and AROs (things that request
1207 access). This is very similar to a tree view of folders and files.
1208 The 'folders' are the Groups and the 'files' are AROs.</span>
1209 </span>
1210 </span>
1211 </span>
1212 </p>
1213 <p class="western">
1214 <span class="font1">
1215 <span class="font-small">Let's
1216 make an ACL tree for the people on Han's ship. First we define some
1217 categories for the people. It's clear that Han and Chewie run the
1218 ship, and the rest of them are just passengers:</span>
1219 </span>
1220 </p>
1221 <p class="western">
1222 <span class="font-code">
1223 <span class="font-small">Millennium
1224 Falcon Passengers Group<br />&#9500;&#9472;Crew Group<br />&#9474;
1225 &#9500;&#9472;Han ARO<br />&#9474;
1226 &#9492;&#9472;Chewie ARO<br />&#9492;&#9472;Passengers Group<br />
1227 &#9500;&#9472;Obi-wan ARO<br /> &#9500;&#9472;Luke ARO<br />
1228 &#9500;&#9472;R2D2 ARO<br /> &#9492;&#9472;C3PO ARO</span>
1229 </span>
1230 </p>
1231 <p class="western">
1232 <span class="font1">
1233 <span class="font-small">This
1234 tree by itself doesn't specify any access policy; it just shows how
1235 we're grouping the people who might request access (AROs).</span>
1236 </span>
1237 </p>
1238 <p class="western">
1239 <span class="font1">We
1240 apply access restrictions by assigning instructions about a
1241 particular room (ACO) to Groups or AROs in the tree. Han says: &quot;By
1242 default, no-one should be allowed access to any room on the
1243 Millennium Falcon. But the Crew should have access to every room. The
1244 Passengers should only have access to the Lounge.&quot;</span>
1245 </p>
1246 <p class="western">
1247 <span class="font3">
1248 <span style="font-size: 3">
1249 <span class="font-small">
1250 <span class="font-code">
1251 <span>Millennium
1252 Falcon Passengers<br />&#9500;&#9472;Crew </span><strong>[ALLOW: ALL]</strong><span><br />&#9474;
1253 &#9500;&#9472;Han<br />&#9474; &#9492;&#9472;Chewie<br />&#9492;&#9472;Passengers </span><strong>[ALLOW:
1254 Lounge]</strong><span><br /> &#9500;&#9472;Obi-wan<br />
1255 &#9500;&#9472;Luke<br /> &#9500;&#9472;R2D2<br /> &#9492;&#9472;C3PO</span>
1256 </span>
1257 </span>
1258 </span>
1259 </span>
1260 </p>
1261 <p class="western">
1262 <span class="font1">
1263 <span class="font-small">To interpret this ARO tree, we start from the top and work our way down.</span>
1264 </span>
1265 </p>
1266 <p class="western">
1267 <span class="font1">
1268 <span class="font-small">Firstly,
1269 the default policy is always to deny access. Permissions have been
1270 overridden for the &quot;Crew&quot;, so they have access to
1271 everywhere (&quot;ALL&quot; is a synonym for all rooms: &quot;Cockpit,
1272 Lounge, Guns, Engines&quot;). The &quot;Passengers&quot; have access
1273 only to the Lounge.</span>
1274 </span>
1275 </p>
1276 <p class="western">
1277 <span class="font1">
1278 <span style="font-size: 3"><span>
1279 <span class="font-small">
1280 This
1281 way of describing the access policy is much clearer than the access
1282 matrix. You can easily see who has access to what, and it's easier to
1283 determine <u>why</u>. they've got access (it seems obvious that Han
1284 and Chewie would have access to everything, since they're grouped
1285 under &quot;Crew&quot;).
1286 </span>
1287 </span></span>
1288 </span>
1289 </p>
1290 <p class="western">
1291 <span class="font1">
1292 <span class="font-small">To summarize:</span>
1293 </span>
1294 </p>
1295 <ul>
1296 <li value=1>
1297 <p class="western">
1298 <span class="font1">
1299 <span style="font-size: 3">
1300 <span class="font-small">
1301 <strong>Access Control Objects </strong><span>(ACOs) are the things we want to control access to (e.g. web pages, databases, rooms, etc).</span>
1302 </span>
1303 </span>
1304 </span>
1305 </p>
1306 <li>
1307 <p class="western">
1308 <span class="font1">
1309 <span style="font-size: 3">
1310 <span class="font-small">
1311 <strong>Access
1312 Request Objects</strong><span> (AROs) are the things that
1313 request access (e.g. people, remote computers, etc)</span>
1314 </span>
1315 </span>
1316 </span>
1317 </p>
1318 <li>
1319 <p class="western">
1320 <span class="font1">
1321 <span style="font-size: 3">
1322 <span class="font-small">
1323 <strong>ARO trees</strong><span> define a hierarchy of </span><strong>Groups</strong><span>
1324 and AROs. Groups can contain other Groups and AROs.</span>
1325 </span>
1326 </span>
1327 </span>
1328 </p>
1329 <li>
1330 <p class="western">
1331 <span class="font1">
1332 <span class="font-small">The
1333 default 'catch-all' policy for the ARO tree is always &quot;DENY
1334 ALL&quot;.</span>
1335 </span>
1336 </p>
1337 <li>
1338 <p class="western">
1339 <span class="font1">
1340 <span class="font-small">To
1341 assign access policy, work your way down the tree, explicitly
1342 assigning permissions to Groups and AROs for each ACO as the need
1343 arises.</span>
1344 </span>
1345 </p>
1346 </ul>
1347 <h2 class="western" id="finegrainacccontrol"><span class="font1">Fine-grain access control</span></h2>
1348 <p class="western">
1349 <span class="font1">
1350 <span class="font-small">Oops!
1351 What about Chewie? By grouping him in &quot;Crew&quot;, Han has
1352 indirectly given him access to the Engines! He doesn't want that
1353 after what Chewie recently did to the hyperdrive, so he adds a rule
1354 to disallow this:</span>
1355 </span>
1356 </p>
1357 <p class="western">
1358 <span class="font3">
1359 <span style="font-size: 3">
1360 <span class="font-small">
1361 <span class="font-code">
1362 <span>Millennium
1363 Falcon Passengers<br />&#9500;&#9472;Crew [ALLOW: ALL]<br />&#9474;
1364 &#9500;&#9472;Han<br />&#9474; &#9492;&#9472;Chewie </span><strong>[DENY:
1365 Engines]</strong><span><br />&#9492;&#9472;Passengers [ALLOW:
1366 Lounge]<br /> &#9500;&#9472;Obi-wan<br /> &#9500;&#9472;Luke<br />
1367 &#9500;&#9472;R2D2<br /> &#9492;&#9472;C3PO</span>
1368 </span>
1369 </span>
1370 </span>
1371 </span>
1372 </p>
1373 <p class="western">
1374 <span class="font1">
1375 <span class="font-small">This
1376 is an example of the way you can control access policy in a
1377 fine-grained manner. It is not necessary to move Chewie to another
1378 Group; we simply over-ride the access policy at a lower level.</span>
1379 </span>
1380 </p>
1381 <p class="western">
1382 <span class="font1">
1383 <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>
1384 </span>
1385 </p>
1386 <p class="western">
1387 <span class="font3">
1388 <span style="font-size: 3">
1389 <span class="font-small">
1390 <span class="font-code">
1391 <span>Millennium
1392 Falcon Passengers<br />&#9500;&#9472;Crew [ALLOW: ALL]<br />&#9474;
1393 &#9500;&#9472;Han<br />&#9474; &#9492;&#9472;Chewie [DENY:
1394 Engines]<br />&#9492;&#9472;Passengers [ALLOW: Lounge]<br /> &#9500;&#9472;Obi-wan<br />
1395 &#9500;&#9472;Luke </span><strong>[ALLOW: Guns]</strong><span><br />
1396 &#9500;&#9472;R2D2 </span><strong>[ALLOW: Engines]</strong><span><br />
1397 &#9492;&#9472;C3PO</span>
1398 </span>
1399 </span>
1400 </span>
1401 </span>
1402 </p>
1403 <h2 class="western">
1404 <span class="font1">Multi-level
1405 Groups</span>
1406 </h2>
1407 <p class="western">
1408 <span class="font1">
1409 <span class="font-small">Groups
1410 can be extended to any level in the ARO tree. For example, you could
1411 add a Group &quot;Jedi&quot; to &quot;Passengers&quot;. Most
1412 passengers would be categorized under &quot;Passengers&quot;, but
1413 Luke and Obi-wan would be under &quot;Jedi&quot; and therefore might
1414 be extended extra privileges (like access to the Cockpit):</span>
1415 </span>
1416 </p>
1417 <p class="western">
1418 <span class="font3">
1419 <span style="font-size: 3">
1420 <span class="font-small">
1421 <span class="font-code">
1422 <span>Millennium
1423 Falcon Passengers<br />&#9500;&#9472;Crew [ALLOW: ALL]<br />&#9474;
1424 &#9500;&#9472;Han<br />&#9474; &#9492;&#9472;Chewie [DENY:
1425 Engines]<br />&#9492;&#9472;Passengers [ALLOW: Lounge]<br />
1426 &#9500;&#9472;</span><strong>Jedi [ALLOW: Cockpit]</strong><span><br />
1427 &#9474; &#9500;&#9472;</span><strong>Obi-wan</strong><span><br />
1428 &#9474; &#9492;&#9472;</span><strong>Luke</strong><span> [ALLOW:
1429 Guns] <br /> &#9500;&#9472;R2D2 [ALLOW: Engines]<br /> &#9492;&#9472;C3PO</span>
1430 </span>
1431 </span>
1432 </span>
1433 </span>
1434 </p>
1435 <h2 class="western">
1436 <span class="font1">How
1437 does phpGACL determine permissions?</span>
1438 </h2>
1439 <p class="western">
1440 <span class="font1">
1441 <span class="font-small">When
1442 the ship's computer (running phpGACL of course) checks access, the
1443 only question it can ask itself is &quot;Does person X have access to
1444 room Y?&quot; In phpGACL terms, this is rephrased as &quot;Does ARO
1445 'X' have access to ACO 'Y'?&quot;</span>
1446 </span>
1447 </p>
1448 <p class="western">
1449 <span class="font1">
1450 <span class="font-small">phpGACL
1451 determines whether a specific person has access to a specific room by
1452 working from the top of the ARO tree towards the specified person,
1453 noting explicit access controls for that place along the way. When it
1454 reaches that person, it uses the last explicit access control it
1455 encountered as the result to return. In this way, you can define
1456 access controls for groups of people, but over-ride them further down
1457 the tree if you need to.</span>
1458 </span>
1459 </p>
1460 <p class="western">
1461 <span class="font1">
1462 <span style="font-size: 3">
1463 <span class="font-small">
1464 <strong>Example
1465 1</strong><span>: We ask: &quot;Does Luke have access to the
1466 Lounge?&quot;.</span>
1467 </span>
1468 </span>
1469 </span>
1470 </p>
1471 <ul>
1472 <li value="1">
1473 <p class="western">
1474 <span class="font1">
1475 <span class="font-small">Set
1476 the default result, &quot;DENY&quot;.</span>
1477 </span>
1478 </p>
1479 </li>
1480 <li>
1481 <p class="western">
1482 <span class="font1">
1483 <span class="font-small">Work
1484 out a path to Luke:</span>
1485 </span>
1486 </p>
1487 </li>
1488 </ul>
1489 <h4 class="western">
1490 <span class="font1"> Millennium
1491 Falcon Passengers &rarr; Passengers &rarr; Jedi &rarr; Luke</span>
1492 </h4>
1493 <ul>
1494 <li value=1>
1495 <p class="western">
1496 <span class="font1">
1497 <span class="font-small">Start
1498 at the top of the tree and move towards Luke: The &quot;Millennium
1499 Falcon Passengers&quot; node doesn't say anything about any room, so
1500 do nothing here.</span>
1501 </span>
1502 </p>
1503 <li>
1504 <p class="western">
1505 <span class="font1">
1506 <span class="font-small">Move
1507 on to &quot;Passengers&quot;, which explicitly says that
1508 &quot;Passengers&quot; have Lounge access, so change the internal
1509 result to &quot;ALLOW&quot;.</span>
1510 </span>
1511 </p>
1512 <li>
1513 <p class="western">
1514 <span class="font1">
1515 <span class="font-small">Move
1516 to the &quot;Jedi&quot; node, which doesn't mention the Lounge at
1517 all.</span>
1518 </span>
1519 </p>
1520 <li>
1521 <p class="western">
1522 <span class="font1">
1523 <span class="font-small">Finally
1524 move to Luke's node, and again there's nothing there about the
1525 Lounge.</span>
1526 </span>
1527 </p>
1528 <li>
1529 <p class="western">
1530 <span class="font1">
1531 <span class="font-small">There's
1532 nowhere left to go, so the result returned is the current value of
1533 the internal result: &quot;ALLOW&quot;</span>
1534 </span>
1535 </p>
1536 </ul>
1537 <p class="western">
1538 <span class="font1">
1539 <span style="font-size: 3">
1540 <span class="font-small">
1541 <strong>Example
1542 2</strong><span>: We ask: &quot;Does Chewie have access to
1543 the Engines?&quot;</span>
1544 </span>
1545 </span>
1546 </span>
1547 </p>
1548 <ul>
1549 <li value=1>
1550 <p class="western">
1551 <span class="font1">
1552 <span class="font-small">Set
1553 the default result, &quot;DENY&quot;.</span>
1554 </span>
1555 </p>
1556 <li>
1557 <p class="western">
1558 <span class="font1">
1559 <span class="font-small">Work
1560 out a path to Chewie:</span>
1561 </span>
1562 </p>
1563 </ul>
1564 <h4 class="western">
1565 <span class="font1"> Millennium
1566 Falcon Passengers &rarr; Crew &rarr; Chewie</span>
1567 </h4>
1568 <ul>
1569 <li>
1570 <p class="western">Start at the top of the tree and move towards
1571 Chewie. The &quot;Millennium Falcon Passengers&quot; node doesn't
1572 say anything about anywhere, so do nothing here.</p>
1573 <li>
1574 <p class="western">
1575 <span class="font1">
1576 <span class="font-small">Move
1577 on to &quot;Crew&quot;, which explicitly says that &quot;Crew&quot;
1578 have Engine access, so change the internal result to &quot;ALLOW&quot;.</span>
1579 </span>
1580 </p>
1581 <li>
1582 <p class="western">
1583 <span class="font1">
1584 <span class="font-small">Move
1585 to Chewie's node, and there's an explicit rule saying that he
1586 doesn't have access to the Engines, so change the internal result to
1587 &quot;DENY&quot;.</span>
1588 </span>
1589 </p>
1590 <li>
1591 <p class="western">
1592 <span class="font1">
1593 <span class="font-small">There's
1594 nowhere left to go, so the result returned is the current value of
1595 the internal result: &quot;DENY&quot;</span>
1596 </span>
1597 </p>
1598 </ul>
1599 <p class="western">
1600 <span class="font1">
1601 <span class="font-small">As
1602 you can see from the examples, if a Group doesn't explicitly specify
1603 a permission for a room, then that Group inherits the access
1604 restrictions of its parent for that room. If the root node
1605 (&quot;Millennium Falcon Passengers&quot;) doesn't specify a
1606 permission, it inherits it from the default setting (&quot;DENY ALL&quot;
1607 in the above examples).</span>
1608 </span>
1609 </p>
1610 <p class="western">
1611 <span class="font1">
1612 <span class="font-small">This
1613 implies a couple of interesting points about the ARO tree:</span>
1614 </span>
1615 </p>
1616 <ul>
1617 <li value=1>
1618 <p class="western">
1619 <span class="font1">
1620 <span class="font-small">The
1621 ARO tree always shows the full list of the AROs. It would not make
1622 sense to ask &quot;Does Jabba have access to the Cockpit?&quot;
1623 because Jabba has not been defined in this system. However, phpGACL
1624 does not check to see if AROs or ACOs exist before performing the
1625 check, so if this question was actually asked then the result would
1626 be the default &quot;DENY&quot;.</span>
1627 </span>
1628 </p>
1629 <li>
1630 <p class="western">
1631 <span class="font1">
1632 <span class="font-small">The
1633 ARO tree may not display some defined ACOs, and relies on the
1634 default setting to define access policy. For example, say Han
1635 defined a &quot;Bathroom&quot; ACO. Any question like &quot;Does
1636 Luke have access to the Bathroom?&quot; would have the answer
1637 &quot;DENY&quot;, because the default is &quot;DENY&quot; and
1638 nowhere in the ARO tree does it ever explicitly mention the
1639 Bathroom. Keep in mind when examining the ARO tree that some ACOs
1640 may not be visible.</span>
1641 </span>
1642 </p>
1643 </ul>
1644 <p class="western">
1645 <span class="font1">
1646 <span style="font-size: 3">
1647 <span class="font-small">
1648 <strong>Note:</strong><span>
1649 When asking phpGACL questions about access to an ACO, it is not
1650 possible to use Groups as AROs (even though it might 'seem' right).
1651 For example, it is impossible to answer the question &quot;Do
1652 Passengers have access to Guns?&quot; The complete answer is not a
1653 Boolean &quot;ALLOW&quot; or &quot;DENY&quot;, but the more complex
1654 &quot;Luke and Obi-wan can but R2D2 and C3PO cannot.&quot; phpGACL is
1655 not designed to return that kind of answer.</span>
1656 </span>
1657 </span>
1658 </span>
1659 </p>
1660 <h2 class="western">
1661 <span class="font1">Adding
1662 groups</span>
1663 </h2>
1664 <p class="western">
1665 <span class="font1">
1666 <span class="font-small">Han
1667 feels this ACL is starting to look a little complicated. There are so
1668 many exceptions! Perhaps he should make another group, &quot;Engineers&quot;,
1669 containing the people who are allowed access to the Engines and Guns.
1670 That group should contain Han and R2D2 since they're both capable of
1671 repairing the engines and guns. This means Han can remove some of
1672 those messy exceptions-to-the-rules, and that has the benefit of
1673 making the description clearer:</span>
1674 </span>
1675 </p>
1676 <p class="western">
1677 <span class="font-code">Default: DENY
1678 ALL<br />Millennium Falcon Passengers<br />&#9500;&#9472;Crew [ALLOW:
1679 ALL]<br />&#9474; &#9500;&#9472;Han<br />&#9474; &#9492;&#9472;Chewie [DENY:
1680 Engines]<br />&#9500;&#9472;Passengers [ALLOW: Lounge]<br />&#9474;
1681 &#9500;&#9472;Jedi [ALLOW: Cockpit]<br />&#9474; &#9474; &#9500;&#9472;Obi-wan<br />&#9474;
1682 &#9474; &#9492;&#9472;Luke [ALLOW: Guns] <br />&#9474; &#9500;&#9472;R2D2<br />&#9474;
1683 &#9492;&#9472;C3PO<br />&#9492;&#9472;<strong>Engineers [ALLOW: Engines,
1684 Guns]</strong><br /> &#9500;&#9472;<strong>Han</strong><br /> &#9492;&#9472;<strong>R2D2</strong></span>
1685 </p>
1686 <p class="western">
1687 <span class="font1">
1688 <span class="font-small">We
1689 can read this as &quot;By default, no-one has access to anywhere.
1690 Crew have access to everywhere (except Chewie, who has no access to
1691 the Engines). Passengers only have access to the Lounge, except Jedi
1692 who also have access to the Cockpit. Luke has access to the Guns too.
1693 Engineers are allowed access to the Engines and Guns.&quot;</span>
1694 </span>
1695 </p>
1696 <p class="western">
1697 <span class="font1">
1698 <span style="font-size: 3">
1699 <span class="font-small">
1700 <span>Most
1701 importantly, we can see that Han and R2D2 are now in </span><i>two</i><span>
1702 places in the ACL. It is not necessary for them to be uniquely
1703 categorized at all. This defines the policy more clearly to the
1704 reader: &quot;Ahh, Han and R2D2 have access to the Engines and Guns
1705 because they're </span><i>engineers</i><span>.&quot;</span>
1706 </span>
1707 </span>
1708 </span>
1709 </p>
1710 <h2 class="western">
1711 <span class="font1">Adding
1712 people</span>
1713 </h2>
1714 <p class="western">
1715 <span class="font1">
1716 <span class="font-small">Han
1717 goes to Cloud City to pick up Lando and get some repairs. Lando's the
1718 Millennium Falcon's previous owner, so Han reckons he qualifies as
1719 Crew. Lando also offers the services of his top engineer, Hontook,
1720 for help with repairing the ship while they're in dock.</span>
1721 </span>
1722 </p>
1723 <p class="western">
1724 <span class="font-code">Default: DENY
1725 ALL<br />Millennium Falcon Passengers<br />&#9500;&#9472;Crew [ALLOW:
1726 ALL]<br />&#9474; &#9500;&#9472;Han<br />&#9474; &#9500;&#9472;Chewie [DENY:
1727 Engines]<br />&#9474; &#9492;&#9472;<strong>Lando</strong><br />&#9500;&#9472;Passengers [ALLOW:
1728 Lounge]<br />&#9474; &#9500;&#9472;Jedi [ALLOW: Cockpit]<br />&#9474; &#9474;
1729 &#9500;&#9472;Obi-wan<br />&#9474; &#9474; &#9492;&#9472;Luke [ALLOW:
1730 Guns] <br />&#9474; &#9500;&#9472;R2D2<br />&#9474;
1731 &#9492;&#9472;C3PO<br />&#9492;&#9472;Engineers [ALLOW: Engines,
1732 Guns]<br /> &#9500;&#9472;Han<br /> &#9500;&#9472;R2D2<br /> &#9492;&#9472;<strong>Hontook</strong></span>
1733 </p>
1734 <p class="western">
1735 <span class="font1">
1736 <span class="font-small">This
1737 shows how easy it is to grant new people access. If we used the
1738 original matrix scheme, we'd have to set permissions for each room
1739 for both Lando and Hontook. Instead, we simply add them to their
1740 appropriate groups and their access is implicitly and easily defined.</span>
1741 </span>
1742 </p>
1743 <h2 class="western">
1744 <span class="font1">Resolving
1745 conflicts</span>
1746 </h2>
1747 <p class="western">
1748 <span class="font1">What
1749 happens if we add Chewie to the list of Engineers?</span>
1750 </p>
1751 <p class="western">
1752 <span class="font-code">Default: DENY
1753 ALL<br />Millennium Falcon Passengers<br />&#9500;&#9472;Crew [ALLOW:
1754 ALL]<br />&#9474; &#9500;&#9472;Han<br />&#9474; &#9500;&#9472;Chewie [DENY:
1755 Engines]<br />&#9474; &#9492;&#9472;Lando<br />&#9500;&#9472;Passengers [ALLOW:
1756 Lounge]<br />&#9474; &#9500;&#9472;Jedi [ALLOW: Cockpit]<br />&#9474; &#9474;
1757 &#9500;&#9472;Obi-wan<br />&#9474; &#9474; &#9492;&#9472;Luke [ALLOW:
1758 Guns] <br />&#9474; &#9500;&#9472;R2D2<br />&#9474;
1759 &#9492;&#9472;C3PO<br />&#9492;&#9472;Engineers [ALLOW: Engines,
1760 Guns]<br /> &#9500;&#9472;Han<br /> &#9500;&#9472;R2D2<br /> &#9500;&#9472;Hontook<br />
1761 &#9492;&#9472;<strong>Chewie</strong></span>
1762 </p>
1763 <p class="western">This makes Chewie's access to the Engines
1764 ambiguous, because now there are two paths from the root of the tree
1765 to Chewie. If the ship's computer follows one path (along the &quot;Crew&quot;
1766 branch), the result is &quot;DENY access to Engines.&quot; If it
1767 follows the other path (along the &quot;Engineers&quot; branch) then
1768 the result is &quot;ALLOW access to Engines&quot;. So, is he allowed
1769 or denied?</p>
1770 <p class="western">phpGACL will warn you if you add or edit an
1771 multiply-grouped ARO in such a way that the ARO's access to an
1772 arbitrary ACO would be ambiguous. But it is <u>up to you</u>. to
1773 resolve the conflict.</p>
1774 <p class="western">If we now asked phpGACL the question &quot;Does
1775 Chewie have access to Engines?&quot; the result returned is the
1776 result given by the <u>last ACL entry to be modified</u>. (this is
1777 phpGACL's policy). In this case the result is ALLOW, because the
1778 &quot;ALLOW: Engines, Guns&quot; directive assigned to the Engineers
1779 Group is more recent than the &quot;DENY: Engines&quot; directive
1780 assigned to Chewie's Group.</p>
1781 <p class="western">When ambiguous access entries exist in the ACL,
1782 the ACL is said to be <strong>inconsistent</strong>. Inconsistent ACLs can be
1783 very dangerous, and you may unwittingly provide access to
1784 inappropriate people if you allow your ACL to remain in this state.
1785 When phpGACL warns you that the ACL is inconsistent, it is best to
1786 resolve the conflicts as soon as possible to regain consistency.</p>
1787 <p class="western">To resolve the conflict in this case, we could
1788 either:</p>
1789 <ul>
1790 <li value=1>
1791 <p class="western">Remove the &quot;DENY: Engines&quot;
1792 directive from Chewie's entry under the Crew Group.</p>
1793 <li>
1794 <p class="western">Add a &quot;DENY: Engines&quot; directive to
1795 Chewie's entry under the Engineers Group.</p>
1796 <li>
1797 <p class="western">Remove Chewie from the Engineers Group, since
1798 Han doesn't think him a worthy Engineer anyway.</p>
1799 </ul>
1800 <p class="western">Han chooses option 3, and removes Chewie from the
1801 Engineers list.</p>
1802 <h2 class="western">Naming Access Objects</h2>
1803 <p class="western">
1804 <span class="font5">
1805 <span class="font-small">phpGACL
1806 uniquely identifies each Access Object (AROs, AXOs and ACOs) with a
1807 two-keyword combination and it's Access Object type.</span>
1808 </span>
1809 </p>
1810 <p class="western">
1811 <span class="font5">
1812 <span class="font-small">The
1813 tuple &quot;(Access Object type, Section, Value)&quot; uniquely
1814 identifies any Access Object.</span>
1815 </span>
1816 </p>
1817 <p class="western">
1818 <span class="font5">
1819 <span class="font-small">The
1820 first element of the tuple is the type of Access Object (ARO, AXO or
1821 ACO).</span>
1822 </span>
1823 </p>
1824 <p class="western">
1825 <span class="font3">
1826 <span style="font-size: 3">
1827 <span class="font-small">
1828 <span class="font5">
1829 <span>The
1830 second element of the tuple, called the </span><strong>Section</strong><span>,
1831 is a user-defined string which names the general category of the
1832 Access Object. Multiple Access Objects can share the same Section
1833 name. The Section name should be short but descriptive. It's used in
1834 the user interface in selection boxes, so try not to make it too
1835 long.</span>
1836 </span>
1837 </span>
1838 </span>
1839 </span>
1840 </p>
1841 <p class="western">
1842 <span class="font5">
1843 <span class="font-small">Sections
1844 are stored in a flat namespace; they are not nestable like Groups.
1845 Sections have nothing to do with Groups or the ARO/AXO trees - they
1846 are purely a mechanism for helping to maintain large numbers of
1847 Access Objects.</span>
1848 </span>
1849 </p>
1850 <p class="western">
1851 <span class="font3">
1852 <span style="font-size: 3">
1853 <span class="font-small">
1854 <span class="font5">
1855 <span>The
1856 third element of the tuple is a user-defined name for the Access
1857 Object, and is called the </span><strong>Value</strong><span>. <u>A
1858 Value cannot contain spaces</u>. (however, a Section can).</span>
1859 </span>
1860 </span>
1861 </span>
1862 </span>
1863 </p>
1864 <p class="western">
1865 <span class="font5">
1866 <span class="font-small"><u>Both
1867 Section and Values are case sensitive.</u>.</span>
1868 </span>
1869 </p>
1870 <p class="western" style="margin-left: 0.38in; margin-top: 0; margin-bottom: 0in; line-height: 1rem">
1871 <span class="font3">
1872 <span style="font-size: 3">
1873 <span class="font-small">
1874 <span class="font5"><strong>Aside:</strong><span>
1875 It is commonly asked why strings are used to identify Access Objects,
1876 rather than integers which ostensibly seem faster. The answer is for
1877 legibility. It is much easier to understand:<br /> </span></span><span>
1878 <span class="font-code-2">acl_check('system',
1879 'login', 'users', 'john_doe');<br /></span>
1880 <span class="font5">than:</span>
1881 <span class="font-code-2"><br /> acl_check(10,
1882 21004, 15, 20304);</span>
1883 </span>
1884 </span>
1885 </span>
1886 </span>
1887 </p>
1888 <p class="western">
1889 <span class="font3">
1890 <span style="font-size: 3">
1891 <span class="font-small">
1892 <span class="font5">
1893 <span>Since
1894 it is often obvious from the context which type of Access Object we
1895 are referring to, the interface for phpGACL (and this documentation)
1896 drops the Access Object type and uses the format &quot;</span><strong>Section
1897 &gt; Value</strong><span>&quot; when displaying the name of
1898 an Access Object. However, the API requires an Access Object's
1899 &quot;Section&quot; and &quot;Value&quot; to be specified in separate
1900 function arguments (the Access Object type is usually implicit in the
1901 argument description).</span>
1902 </span>
1903 </span>
1904 </span>
1905 </span>
1906 </p>
1907 <p class="western">
1908 <span class="font5">
1909 <span class="font-small"><strong>Example
1910 ACO &quot;Section &gt; Values&quot;:</strong></span>
1911 </span>
1912 </p>
1913 <ul>
1914 <li value=1>
1915 <p class="western">
1916 <span class="font5">
1917 <span class="font-small">&quot;Floors
1918 &gt; 1st&quot;</span>
1919 </span>
1920 </p>
1921 <li>
1922 <p class="western">
1923 <span class="font5">
1924 <span class="font-small">&quot;Floors
1925 &gt; 2nd&quot;</span>
1926 </span>
1927 </p>
1928 <li>
1929 <p class="western">
1930 <span class="font5">
1931 <span class="font-small">&quot;Rooms
1932 &gt; Engines&quot;</span>
1933 </span>
1934 </p>
1935 </ul>
1936 <p class="western font-weight-bold">Example ARO &quot;Section &gt; Values&quot;:</p>
1937 <ul>
1938 <li value=1>
1939 <p class="western">
1940 <span class="font5">
1941 <span class="font-small">&quot;People
1942 &gt; John_Smith&rdquo;</span>
1943 </span>
1944 </p>
1945 <li>
1946 <p class="western">&ldquo;<span class="font5">
1947 <span class="font-small">People
1948 &gt; Cathy_Jones&rdquo;</span>
1949 </span>
1950 </p>
1951 <li>
1952 <p class="western">&ldquo;<span class="font5">
1953 <span class="font-small">Hosts
1954 &gt; sandbox.something.com&rdquo;</span>
1955 </span>
1956 </p>
1957 </ul>
1958 <p class="western"><strong>Example API usage:</strong></p>
1959 <ul>
1960 <li value=1>
1961 <p class="western">
1962 <span class="font5">
1963 <span class="font-small">acl_check (
1964 aco_section, aco_value, aro_section, aro_value);</span>
1965 </span>
1966 </p>
1967 <li>
1968 <p class="western">
1969 <span class="font5">
1970 <span class="font-small">acl_check (
1971 'Floors', '2nd', 'People', 'John_Smith' );</span>
1972 </span>
1973 </p>
1974 </ul>
1975 <p class="western">
1976 <span class="font5">
1977 <span class="font-small"><strong>Valid
1978 Naming Restrictions Examples:</strong></span>
1979 </span>
1980 </p>
1981 <ul>
1982 <li value=1>
1983 <p class="western">
1984 <span class="font5">
1985 <span class="font-small">&quot;ACO
1986 -Frob &gt; Flerg&quot;, &quot;ARO - Frob &gt; Flerg&quot; (The
1987 Section and Value are the same in both, but this is fine as
1988 namespaces are separate across Access Object types)</span>
1989 </span>
1990 </p>
1991 <li>
1992 <p class="western">
1993 <span class="font5">
1994 <span class="font-small">&quot;ACO
1995 -Frob &gt; Flerg&quot;, &quot;ACO - Frob &gt; Queegle&quot; (The
1996 Access Object type and Section are the same, but this is fine as the
1997 Values are different)</span>
1998 </span>
1999 </p>
2000 <li>
2001 <p class="western">
2002 <span class="font5">
2003 <span class="font-small">&quot;AXO
2004 - Frob Hrung &gt; Flerg&quot; (Sections can contain spaces)</span>
2005 </span>
2006 </p>
2007 </ul>
2008 <p class="western">
2009 <span class="font5">
2010 <span class="font-small"><strong>Invalid
2011 Naming Restrictions Examples:</strong></span>
2012 </span>
2013 </p>
2014 <ul>
2015 <li value=1>
2016 <p class="western">
2017 <span class="font5">
2018 <span class="font-small">&quot;ACO
2019 - Frob &gt; Flerg&quot;, &quot;ACO - Frob &gt; Flerg&quot; (&quot;Access
2020 Object type - Section &gt; Value&quot; must be unique)</span>
2021 </span>
2022 </p>
2023 <li>
2024 <p class="western">
2025 <span class="font5">
2026 <span class="font-small">&quot;ACO
2027 - Frob &gt; Flerg Habit&quot; (Values cannot contain spaces)</span>
2028 </span>
2029 </p>
2030 </ul>
2031 <h2 class="western">Adding Sections</h2>
2032 <p style="line-height: 100%">
2033 <span class="font5">Before
2034 you can add a new Access Object, its Section must be defined. To add
2035 a new section, use the add_object_section() function.</span>
2036 </p>
2037 <p class="western" style="line-height: 100%">
2038 <span class="font2">
2039 <span class="font-small">add_object_section
2040 (</span>
2041 </span>
2042 </p>
2043 <p style="margin-left: 2.5in; text-indent: -2in; line-height: 100%">
2044 <span class="font2">
2045 <span class="font-code">string
2046 name,</span> A short description of what this Section is for. (e.g.
2047 &quot;Levels in building&quot;).
2048 </span>
2049 </p>
2050 <p style="margin-left: 2.5in; text-indent: -2in; line-height: 100%">
2051 <span class="font2">
2052 <span class="font-code">string
2053 value,</span> The name of the Section (e.g. &quot;Floor&quot;).
2054 </span>
2055 </p>
2056 <p style="margin-left: 2.5in; text-indent: -2in; line-height: 100%">
2057 <span class="font2">
2058 <span class="font-code">int ORDER,</span> An arbitrary value which affects the order this Section appears in the UI.
2059 </span>
2060 </p>
2061 <p style="margin-left: 2.5in; text-indent: -2in; line-height: 100%">
2062 <span class="font2">
2063 <span class="font-code">bool HIDDEN, </span>Whether this should appear in the UI or not (TRUE means that is will be hidden).
2064 </span>
2065 </p>
2066 <p style="margin-left: 2.5in; text-indent: -2in; line-height: 100%">
2067 <span class="font2">
2068 <span class="font-code">string GROUP_TYPE) </span>The Access Object type (&quot;aco&quot;, &quot;aro&quot; or &quot;axo&quot;)</span>
2069 </p>
2070 <p class="western">
2071 <span class="font5">
2072 <span class="font-small">Han
2073 creates 3 Sections for the AROs. &quot;Humans&quot;, &quot;Aliens&quot;
2074 and &quot;Androids&quot;. Let's list the AROs with their full names</span>
2075 </span>
2076 </p>
2077 <p class="western">
2078 <span class="font-code">Millennium
2079 Falcon Passengers<br />&#9500;&#9472;Crew [ALLOW: ALL]<br />&#9474;
2080 &#9500;&#9472;<strong>&quot;Humans &gt; Han&quot;</strong><br />&#9474; &#9500;&#9472;<strong>&quot;Aliens
2081 &gt; Chewie&quot;</strong> [DENY: Engines]<br />&#9474; &#9492;&#9472;<strong>&quot;Humans
2082 &gt; Lando&quot;</strong><br />&#9500;&#9472;Passengers [ALLOW: Lounge]<br />&#9474;
2083 &#9500;&#9472;Jedi [ALLOW: Cockpit]<br />&#9474; &#9474; &#9500;&#9472;<strong>&quot;Humans
2084 &gt; Obi-wan&quot;</strong><br />&#9474; &#9474; &#9492;&#9472;<strong>&quot;Humans
2085 &gt; Luke&quot;</strong> [ALLOW: Guns] <br />&#9474; &#9500;&#9472;<strong>&quot;Androids
2086 &gt; R2D2&quot;</strong><br />&#9474; &#9492;&#9472;<strong>&quot;Androids &gt;
2087 C3PO&quot;</strong><br />&#9492;&#9472;Engineers [ALLOW: Engines, Guns]<br />
2088 &#9500;&#9472;<strong>&quot;Humans &gt; Han&quot;</strong><br /> &#9500;&#9472;<strong>&quot;Androids
2089 &gt; R2D2&quot;</strong><br /> &#9492;&#9472;<strong>&quot;Aliens &gt; Hontook&quot;</strong></span>
2090 </p>
2091 <p class="western">
2092 <span class="font5">
2093 <span class="font-small">Sections
2094 are just a way of categorizing Access Objects, to make the user
2095 interface more usable, and the code for acl_check() more readable.
2096 They do not affect the way phpGACL determines access to an object.
2097 They cannot be nested (so it would not be able to create a &quot;Males&quot;
2098 sub-Section under &quot;Humans&quot; for example; you'd have to
2099 create a Section called &quot;Humans-Male&quot; or similar)</span>
2100 </span>
2101 </p>
2102 <h2 class="western">Multiple Purposes</h2>
2103 <p class="western">
2104 <span class="font5">
2105 <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>
2106 </span>
2107 </p>
2108 <p class="western">
2109 <span class="font5">
2110 <span class="font-small">phpGACL can handle this in three different ways.</span>
2111 </span>
2112 </p>
2113 <ul>
2114 <li value=1>
2115 <p class="western">
2116 <span class="font5">
2117 <span class="font-small">It can use an alternative database to store the access tables.</span>
2118 </span>
2119 </p>
2120 <li>
2121 <p class="western">
2122 <span class="font5">
2123 <span class="font-small">It can use the same database but with differently named access tables. (this feature is not implemented yet).</span>
2124 </span>
2125 </p>
2126 <li>
2127 <p class="western">
2128 <span class="font5">
2129 <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>
2130 </span>
2131 </p>
2132 </ul>
2133 <p class="western">
2134 <span class="font5">
2135 <span class="font-small">To
2136 implement Option 1 (and Option 2 when it becomes available), use the
2137 $gacl_options array when creating a new phpGACL class. This allows
2138 you to specify the database and table name prefixes to use:</span>
2139 </span>
2140 </p>
2141 <p class="western my-0">
2142 <span class="font-code-2">
2143 <span class="font-small">$gacl_options
2144 = array(<br /> 'db_table_prefix' =&gt; 'gacl_',<br /> 'db_type' =&gt;
2145 'mysql',<br /> 'db_host' =&gt; 'host1',<br /> 'db_user' =&gt;
2146 'user',<br /> 'db_password' =&gt; 'passwd',<br /> 'db_name' =&gt;
2147 'gacl');</span>
2148 </span>
2149 </p>
2150 <p class="western my-0">
2151 <br />
2152 </p>
2153 <p class="western my-0">
2154 <span class="font-code-2">
2155 <span class="font-small">$gacl_host1 = new gacl($gacl_options);</span>
2156 </span>
2157 </p>
2158 <p class="western">
2159 <span class="font5">
2160 <span class="font-small">To
2161 implement Option 3, you must be careful, since phpGACL doesn't know
2162 the relationship between your different tasks, and it will be
2163 possible to make meaningless Access Policy Directives.</span>
2164 </span>
2165 </p>
2166 <p class="western">
2167 <span class="font5">
2168 <span class="font-small">For
2169 example, say Han wanted to restrict access to other ships contacting
2170 his ship's computer, in addition to restricting access to the
2171 different rooms. To do this, he might add &quot;Luke's X-Wing
2172 Fighter&quot; as a remote ship ARO (in addition to other ships and an
2173 ACO for the ship's computer). Because all AROs are in the same ARO
2174 tree, it would be possible to create an APD like &quot;Ships &gt;
2175 Luke's X-Wing Fighter&quot; [ALLOW: &quot;Rooms &gt; Lounge&quot;],
2176 which would be totally meaningless! To help reduce mistakes like
2177 this, good Section naming can make it clearer what Access Objects are
2178 for which tasks. It should be obvious to any administrator that it's
2179 meaningless to assign a Ship permission to use a Room.</span>
2180 </span>
2181 </p>
2182 <h2 class="western">Access eXtension Objects</h2>
2183 <p class="western"><strong>Access eXtension Objects</strong> (AXOs) can add a
2184 3rd dimension to the permissions that can be configured in phpGACL.
2185 We've seen how phpGACL allows you to combine an ARO and an ACO (2
2186 dimensions) to create an Access Policy Directive. This is great for
2187 simple permission requests like:</p>
2188 <p class="western"> Luke (ARO) requests access to &quot;Guns&quot;
2189 (ACO)</p>
2190 <p class="western">If that's all you need, that's fine - AXOs are
2191 totally optional.</p>
2192 <p class="western">But because all ACOs are considered equal, it
2193 makes it difficult to manage if there are many ACOs. If this is the
2194 case, we can change the way we look at Access Objects to manage it
2195 more easily.</p>
2196 <p class="western">AXOs are identical to AROs in many respects. There
2197 is an AXO tree (separate from the ARO tree), with it's own Groups and
2198 AXOs. When dealing with AXOs, consider an AXO to take the old role of
2199 the ACO (i.e. &quot;things to control access on&quot;), and change
2200 the view of ACOs from &quot;things to control access on&quot; to
2201 &quot;actions that are requested&quot;.</p>
2202 <p class="western"><strong>ARO and ACO-only View:</strong></p>
2203 <ul>
2204 <li value=1>
2205 <p class="western">AROs: Things requesting access</p>
2206 <li>
2207 <p class="western">ACOs: Things to control access on</p>
2208 </ul>
2209 <p class="western"><strong>ARO, ACO and AXO View:</strong></p>
2210 <ul>
2211 <li value=1>
2212 <p class="western">AROs: Things requesting access</p>
2213 <li>
2214 <p class="western">ACOs: Actions that are requested</p>
2215 <li>
2216 <p class="western">AXOs: Things to control access on</p>
2217 </ul>
2218 <p class="western"><strong>Example:</strong></p>
2219 <p class="western">A website manager is trying to manage access to
2220 projects on the website. The ARO tree consists of all the users:</p>
2221 <p class="western">
2222 <span class="font-code">Website<br />&#9500;&#9472;Administrators<br />&#9474;
2223 &#9500;&#9472;Alice<br />&#9474; &#9492;&#9472;Carol<br />&#9492;&#9472;Users<br />
2224 &#9500;&#9472;Bob<br /> &#9492;&#9472;Alan</span>
2225 </p>
2226 <p class="western">The projects are organized by Operating System
2227 into categories in the AXO tree:</p>
2228 <p class="western">
2229 <span class="font-code">Projects<br />&#9500;&#9472;Linux<br />&#9474;
2230 &#9500;&#9472;SpamFilter2<br />&#9474; &#9492;&#9472;AutoLinusWorshipper<br />&#9492;&#9472;Windows<br />
2231 &#9500;&#9472;PaperclipKiller<br /> &#9492;&#9472;PopupStopper</span>
2232 </p>
2233 <p class="western">The actions that can be taken with each project
2234 are &quot;View&quot; and &quot;Edit&quot;. These are the ACOs.</p>
2235 <p class="western">Now we want Bob to have &quot;View&quot; access to
2236 all the Linux projects, so it's possible to add an ACL that links
2237 Bob's ARO to the View ACO and the Linux AXO, and thus we can ask the
2238 question:</p>
2239 <p class="western"> Bob (ARO) requests access to &quot;View&quot;
2240 (ACO) the project(s) called &quot;Linux&quot; (AXO)</p>
2241 <p class="western">Keep in mind AXO's are optional, if you don't
2242 specify an AXO when calling acl_check() and a matching ACL exists
2243 with no AXO, it will be allowed. However if <u>only</u>. ACLs exist
2244 with AXO's, and you call acl_check() without an AXO, it will fail.</p>
2245 <p class="western">So basically as soon as you specify an AXO when
2246 calling acl_check(), acl_check() will only search ACLs containing
2247 AXO's. If no AXO is specified, only ACLs without AXOs are searched.
2248 This in theory (I haven't benchmarked) gives us a slight performance
2249 increase as well.</p>
2250 <h1 class="western">Installation</h1>
2251 <h2 class="western">Basic setup</h2>
2252 <OL>
2253 <li>
2254 <p class="western">Untar the distribution .tar.gz file into the
2255 root or a subdirectory of your web site. You might want to rename it
2256 to something more suitable.<br /><br /><br />
2257 </p>
2258 <p class="western"><iMG SRC="manual_html_m48c2db5c.png" name="Graphic1" class="img-responsive" width="474" height="146" /><br style="clear: left;" /></p>
2259 <li>
2260 <p class="western">Edit phpgacl/gacl.ini.php using your
2261 favourite editor and set the db_type, db_host, db_user, db_password,
2262 and db_name you will be using.</p>
2263 <li>
2264 <p class="western">Create the database you specified in db_name
2265 on the server.<br /><br /><br />
2266 </p>
2267 <p class="western"><img src="manual_html_m770a5a15.png" name="Graphic3" class="img-responsive" width="397" height="123"><br style="clear: left;" /></p>
2268 <p class="western"></p>
2269 <li>
2270 <p class="western">Surf to
2271 http://yoursite.net/phpgacl/setup.php. The required tables will be
2272 installed based on your choice of database. Don't be afraid of the
2273 truckload of output, if all goes well you will see only success
2274 messages.<br /><br /><br />
2275 </p>
2276 </OL>
2277 <p class="western"><img src="manual_html_7dced6ce.png" name="Graphic4" class="img-responsive" width="519" height="504" /><br style="clear: left;" /><br /><br />
2278 </p>
2279 <OL START=5>
2280 <li>
2281 <p class="western">Now follow the last advice shown on that
2282 screen and create the phpgacl/admin/smarty/templates_c directory. It
2283 must be writable by the user the webserver runs as. If you don't do
2284 this, you will not be able to use the CAL admin!</p>
2285 <li>
2286 <p class="western">Click the link at the bottom of the
2287 successful setup page or surf
2288 to:<br />http://yoursite.net/phpgacl/admin/acl_admin.php</p>
2289 </OL>
2290 <h2 class="western">Advanced setup</h2>
2291 <h3 class="western">Reusing an already existing ADOdb
2292 installation</h3>
2293 <p class="western">If you already have ADOdb installed you can get
2294 phpGACL to use this copy of ADOdb.</p>
2295 <OL>
2296 <li>
2297 <p class="western">Edit phpgacl/gacl.class.php so that ADODB_DIR
2298 reflects the location of the ADOdb library in your path.</p>
2299 <li>
2300 <p class="western">Rename the phpgacl/adodb folder to something
2301 else like adodb_x and reload the phpgacl/admin/acl_admin.php page to
2302 ensure it still works.</p>
2303 <li>
2304 <p class="western">Erase the adodb directory installed with
2305 phpGACL.</p>
2306 </OL>
2307 <h3 class="western">Reusing an already existing Smarty
2308 installation</h3>
2309 <p class="western">If you already have ADOdb installed you can get
2310 phpGACL to use this copy of ADOdb.</p>
2311 <OL>
2312 <li>
2313 <p class="western">Edit phpgacl/admin/gacl_admin.inc.php so that
2314 the variables $smarty_dir and $smarty_compile_dir reflect the
2315 location of the Smarty library in your path and the template_c
2316 directory you already use.</p>
2317 <p class="western">Move the templates directory that came with
2318 phpGACL to another directory (e.g. one level up). Adjust the
2319 $smarty_template_dir so it points to the new location. If you like
2320 you can move those templates to your existing templates folder, of
2321 course.</p>
2322 <li>
2323 <p class="western">Rename the phpgacl/smarty folder to something
2324 else like smarty_x and reload the phpgacl/admin/acl_admin.php page
2325 to ensure it still works.</p>
2326 <li>
2327 <p class="western">Erase the smarty directory installed with
2328 phpGACL.</p>
2329 </OL>
2330 <h3 class="western">How do I move the phpGACL files out
2331 of my website tree while leaving a link in the tree for
2332 administration?</h3>
2333 <OL>
2334 <li>
2335 <p class="western">Go to your website root.</p>
2336 <li>
2337 <p class="western">Move the phpGACL directory to your includes
2338 directory and create a symlink to the admin directory where you want
2339 the admin tool to go. For example:</p>
2340 <p class="western">mv phpgacl/ /www/includes_directory<br />ln -s
2341 /www/includes_directory/phpgacl/admin/ gacl</p>
2342 <li>
2343 <p class="western">Now surfing to
2344 http://yoursite.net/gacl/acl_admin.php will take you to the admin
2345 page. If it doesn't work, make sure your Webserver allows symbolic
2346 links in the website tree.</p>
2347 </OL>
2348 <h1 class="western">Using phpGACL in your application</h1>
2349 <h2 class="western">Basic usage</h2>
2350 <p class="western">This example shows a basic example of using
2351 phpGACL in your code. It uses the ADOdb abstraction layer as well,
2352 and shows a simple way to validate a login attempt against a
2353 database.</p>
2354 <p class="western">
2355 <span class="font6">
2356 <span style="color: #ff0000">//
2357 include basic ACL api</span><br />
2358 <span style="color: #00cccc">include</span>('<span style="color: #008000">phpgacl/gacl.class.php</span>');<br />$<span style="color: #ff6633">gacl</span>
2359 = <span style="color: #00cccc">new</span> gacl();
2360 </span>
2361 </p>
2362 <p class="western">
2363 <span class="font6">$<span style="color: #ff6633">username</span>
2364 = $<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>
2365 = $<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>
2366 = '<span style="color: #008000">SELECT name FROM users WHERE name=</span>';<br />$<span style="color: #ff6633">sql</span>
2367 .= $<span style="color: #ff6633">username</span>.' <span style="color: #008000">AND
2368 password=</span>'.$<span style="color: #ff6633">password</span>;<br />$<span style="color: #ff6633">row</span>
2369 = $<span style="color: #ff6633">db</span>-&gt;<span style="color: #00cccc">GetRow</span>($<span style="color: #ff6633">sql</span>);</span>
2370 </p>
2371 <p class="western">
2372 <span class="font6">
2373 <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
2374 color="#ff6633">row</span>['<span style="color: #008000">name</span>'])){<br />
2375 $<span style="color: #ff6633">_SESSION</span>['<span style="color: #008000">username</span>']
2376 = $<span style="color: #ff6633">row</span>['<span style="color: #008000">name</span>'];<br />
2377 <span style="color: #00cccc">return</span>
2378 <span style="color: #6b4794">true</span>;<br />}<br />
2379 <span style="color: #00cccc">else</span><br />
2380 <span style="color: #00cccc">return</span>
2381 <span style="color: #6b4794">false</span>;
2382 </span>
2383 </p>
2384 <p class="western">As you can see there is only one call to
2385 acl_check() in this code. What does it do? Well, it</p>
2386 <ul>
2387 <li>
2388 <p class="western">checks the ARO object $row['name'] from the
2389 ARO section 'user'</p>
2390 <li>
2391 <p class="western">against the ACO object 'login' from the ACO
2392 section 'system'.</p>
2393 </ul>
2394 <h2 class="western">Advanced usage</h2>
2395 <p class="western"><br /><br />
2396 </p>
2397 <h1 class="western">Using the ACL admin utility</h1>
2398 <p class="western">If you want to get a grip on the included ACL
2399 admin utitlity, it will help you a lot if you run the example.php
2400 file. It contains some ACO, ARO and AXO objects, as well as some ACL
2401 defined using those objects. After running it, you should see some
2402 sample data in the admin interface.<br /><br /><br />
2403 </p>
2404 <p class="western"><img src="manual_html_4b803670.png" name="Graphic5" class="img-responsive" width="531" height="488" /><br style="clear: left;" /><br /><br />
2405 </p>
2406 <p class="western">Play around with it, and if you get stuck, come
2407 back and read on...</p>
2408 <p class="western">(yet to be written)</p>
2409 <h2 class="western">ACL's</h2>
2410 <h3 class="western">Creating</h3>
2411 <p class="western">You must have a minimum of an ACO and an ARO
2412 defined to create an ACL.</p>
2413 <p class="western">Select an ACO Section then select from the
2414 available items show in the Access Control Objects list. Click the [
2415 &gt; &gt; ] button to add the Section-ACO to the Selected list. You
2416 may add any number of Section-ACO pairs to this list.</p>
2417 <p class="western"><img src="manual_html_m608b392a.png" name="Graphic9" class="img-responsive" width="531" height="177" /><br style="clear: left;" /><br /><br />
2418 </p>
2419 <p class="western">Next select an ARO Section. At this point you may
2420 select from either the Access Request Objects list or from the ARO
2421 Groups list.</p>
2422 <p class="western"><img SRC="manual_html_157037e7.png" name="Graphic10" class="img-responsive" width="531" height="157" /><br style="clear: left;" /><br /><br />
2423 </p>
2424 <p class="western">Select on of the ACL Sections (usually &ldquo;user&rdquo;
2425 for this case), provide a brief description in the Note area and then
2426 click Submit. Click on the &ldquo;ACL Admin&rdquo; tab and you will
2427 see your new ACL in the list.</p>
2428 <h3 class="western">Sections</h3>
2429 <p class="western"><img src="manual_html_676f8c98.png" name="Graphic7" class="img-responsive" width="518" height="149" /><br style="clear: left;" />A
2430 default install provides you with two ACL sections &ndash; 'system'
2431 and 'user'. You would typically put user created ACL's (for example,
2432 those you enter via the admin interface) in the 'user' section and
2433 put ACL's generated by code in the 'system' section. However, you
2434 can use the ACL sections to provide any other logical grouping that
2435 suits your purposes.</p>
2436 <h3 class="western">Extended Return Value</h3>
2437 <p class="western">Typically a call to the acl_check method will
2438 return a boolean value. However, you may specify a different value
2439 or evan a string to be returned.
2440 </p>
2441 <p class="western">For example, you may negotiate for a user to login
2442 at a cost of $0.20 per time by default and another for $0.18 per time
2443 under a different scheme. You could create a separate ACL for the
2444 default login and for the special use but varying the 'return value'.
2445 If the call to acl_check is successful, you will know the cost of
2446 the login via the return value.</p>
2447 <h3 class="western">Notes</h3>
2448 <p class="western">It's a good idea to add a note when creating an
2449 ACL to help remember it's purpose, for example &ldquo;Basic
2450 permissions for a user in the Administrator group&rdquo;.</p>
2451 <p class="western"><img src="manual_html_m4f4324cb.png" name="Graphic8" class="img-responsive" width="526" height="120" /><br style="clear: left;" /><br /><br />
2452 </p>
2453 <h1 class="western"><a name="Glossary"></a>Glossary</h1>
2454 <h2 class="western">ACO</h2>
2455 <p class="western">
2456 <span class="font5">
2457 <span class="font-small"><dfn>Access Control Object &ndash; An action that are requested to be performed.</dfn></span>
2458 </span>
2459 </p>
2460 <h2 class="western">ARO</h2>
2461 <p class="western">
2462 <span class="font5">
2463 <span class="font-small"><dfn><span>
2464 <span class="font-small">
2465 <span class="font5">Access Request Object &ndash; An entity (for example, a user) that is requesting an action to be performed.</span>
2466 </span>
2467 </span></dfn></span>
2468 </span>
2469 </p>
2470 <h2 class="western">AXO</h2>
2471 <p class="western">
2472 <span class="font5">
2473 <span class="font-small"><dfn><span>
2474 <span class="font-small">
2475 <span class="font5">
2476 Access eXtension Object &ndash; An object to perform an action on for an entity.</span>
2477 </span>
2478 </span></dfn></span>
2479 </span>
2480 </p>
2481 <h1 class="western">References</h1>
2482 <h2 class="western">phpGACL API</h2>
2483 <p class="western" style="line-height: 100%">
2484 <span class="font5">
2485 <span class="font-small">The API documentation is included in the tarball under the /docs/phpdoc/ directory.</span>
2486 </span>
2487 </p>
2488 <h2 class="western">phpGACL Examples and Tutorials</h2>
2489 <p class="western" style="line-height: 100%">
2490 <span class="font5">
2491 <span class="font-small">See example.php included in the tarball.</span>
2492 </span>
2493 </p>
2494 <h2 class="western">Access Control Resources</h2>
2495 <p class="western" style="line-height: 100%">
2496 <span class="font5">
2497 <span class="font-small">. . .</span>
2498 </span>
2499 </p>
2500 <p class="western"><br /><br />
2501 </p>
2502 <h1 class="western">FAQ</h1>
2503 <h2 class="western">Can phpGACL handle large sets of data?</h2>
2504 <p class="western" style="line-height: 100%">
2505 <span class="font5">
2506 <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>
2507 </span>
2508 </p>
2509 </div>
2510 </body>
2512 </html>