2 // If you have installed phpGACL (http://phpgacl.sourceforge.net/)
3 // and have configured it for your site, then uncomment the following
4 // statement and change it to point to the location where
5 // gacl.class.php is intalled.
7 // $phpgacl_location = "/var/www/phpgacl";
9 // Tentatively, the following Access Control Objects will be supported.
10 // These are the "things to be protected":
12 // Section "admin" (Administration):
13 // acl Access Control Administration
14 // calendar Calendar Settings
15 // database Database Reporting
16 // forms Forms Administration
17 // practice Practice Settings
18 // superbill Superbill Codes Administration
19 // users Users/Groups/Logs Administration
21 // Section "acct" (Accounting):
22 // bill Billing (write optional)
24 // rep Financial Reporting - my encounters
25 // rep_a Financial Reporting - anything
27 // Section "patients" (Patient Information):
28 // appt Appointments (write optional)
29 // demo Demographics (write optional)
30 // med Medical Records and History (write optional)
31 // trans Transactions, e.g. referrals (write optional)
32 // docs Documents (write optional)
34 // Section "encounters" (Encounter Information):
35 // auth Authorize - my encounters
36 // auth_a Authorize - any encounters
37 // coding Coding - my encounters (write,wsome optional)
38 // coding_a Coding - any encounters (write,wsome optional)
39 // notes Notes - my encounters (write optional)
40 // notes_a Notes - any encounters (write optional)
42 if ($phpgacl_location) {
43 include_once("$phpgacl_location/gacl.class.php");
44 $gacl_object = new gacl();
47 // acl_check should return 0 if access is denied. Otherwise it may
48 // return anything that evaluates to true. In addition if any of the
49 // following types of access are applicable, then the corresponding value
50 // must be returned if and only if such access is granted:
52 // * write - the user may add or modify the ACO
53 // * wsome - the user has limited add/modify access to the ACO
55 function acl_check($section, $value, $user = '') {
56 global $gacl_object, $phpgacl_location;
57 if (! $user) $user = $_SESSION['authUser'];
59 if ($phpgacl_location) {
60 return $gacl_object->acl_check($section, $value, 'users', $user);
63 // If no phpgacl, then apply the old static rules whereby "authorized"
64 // users (providers) can do anything, and other users can do most things.
66 if ($_SESSION['userauthorized']) return 'write';
68 if ($section == 'patients') {
69 if ($value != 'med') return 'write';
71 else if ($section == 'encounters') {
72 if (strpos($value, 'coding') === 0) return 'write';
73 if (strpos($value, 'notes' ) === 0) return 'write';
75 else if ($section == 'acct') {