Restored changes from revisions 1.10, 1.11 and 1.12 which I accidently disregarded...
[openemr.git] / acl_setup.php
blob030441f6c89eb314050022628c1974e5c2bf6039
1 <?php
2 // Copyright (C) 2005-2006 Rod Roark <rod@sunsetsystems.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
9 // This program may be run after phpGACL has been installed, to
10 // create the Access Control Objects and their sections as required
11 // by OpenEMR. Also created are some sample ARO groups, an "admin"
12 // ARO, and some reasonable ACL entries for the groups.
14 include_once('library/acl.inc');
16 if (! $phpgacl_location) die("You must first set up library/acl.inc to use phpGACL!");
18 include_once("$phpgacl_location/gacl_api.class.php");
20 $gacl = new gacl_api();
22 // Create the ACO sections. Every ACO must have a section.
24 $gacl->add_object_section('Accounting' , 'acct' , 10, 0, 'ACO');
25 $gacl->add_object_section('Administration', 'admin' , 10, 0, 'ACO');
26 $gacl->add_object_section('Encounters' , 'encounters' , 10, 0, 'ACO');
27 $gacl->add_object_section('Patients' , 'patients' , 10, 0, 'ACO');
28 $gacl->add_object_section('Squads' , 'squads' , 10, 0, 'ACO');
29 $gacl->add_object_section('Sensitivities' , 'sensitivities', 10, 0, 'ACO');
31 // Create Accounting ACOs.
33 $gacl->add_object('acct', 'Billing (write optional)' , 'bill' , 10, 0, 'ACO');
34 $gacl->add_object('acct', 'EOB Data Entry' , 'eob' , 10, 0, 'ACO');
35 $gacl->add_object('acct', 'Financial Reporting - my encounters', 'rep' , 10, 0, 'ACO');
36 $gacl->add_object('acct', 'Financial Reporting - anything' , 'rep_a', 10, 0, 'ACO');
38 // Create Administration ACOs.
40 $gacl->add_object('admin', 'Superuser' , 'super' , 10, 0, 'ACO');
41 $gacl->add_object('admin', 'Calendar Settings' , 'calendar' , 10, 0, 'ACO');
42 $gacl->add_object('admin', 'Database Reporting' , 'database' , 10, 0, 'ACO');
43 $gacl->add_object('admin', 'Forms Administration' , 'forms' , 10, 0, 'ACO');
44 $gacl->add_object('admin', 'Practice Settings' , 'practice' , 10, 0, 'ACO');
45 $gacl->add_object('admin', 'Superbill Codes Administration' , 'superbill', 10, 0, 'ACO');
46 $gacl->add_object('admin', 'Users/Groups/Logs Administration', 'users' , 10, 0, 'ACO');
47 $gacl->add_object('admin', 'Batch Communication Tool' , 'batchcom' , 10, 0, 'ACO');
48 $gacl->add_object('admin', 'Language Interface Tool' , 'language' , 10, 0, 'ACO');
49 $gacl->add_object('admin', 'Pharmacy Dispensary' , 'drugs' , 10, 0, 'ACO');
51 // Create ACOs for encounters.
53 $gacl->add_object('encounters', 'Authorize - my encounters' , 'auth' , 10, 0, 'ACO');
54 $gacl->add_object('encounters', 'Authorize - any encounters' , 'auth_a' , 10, 0, 'ACO');
55 $gacl->add_object('encounters', 'Coding - my encounters (write,wsome optional)' , 'coding' , 10, 0, 'ACO');
56 $gacl->add_object('encounters', 'Coding - any encounters (write,wsome optional)' , 'coding_a', 10, 0, 'ACO');
57 $gacl->add_object('encounters', 'Notes - my encounters (write,addonly optional)' , 'notes' , 10, 0, 'ACO');
58 $gacl->add_object('encounters', 'Notes - any encounters (write,addonly optional)' , 'notes_a' , 10, 0, 'ACO');
59 $gacl->add_object('encounters', 'Fix encounter dates - any encounters' , 'date_a' , 10, 0, 'ACO');
60 $gacl->add_object('encounters', 'Less-private information (write,addonly optional)', 'relaxed' , 10, 0, 'ACO');
62 // Create ACOs for patients.
64 $gacl->add_object('patients', 'Appointments (write optional)' , 'appt' , 10, 0, 'ACO');
65 $gacl->add_object('patients', 'Demographics (write,addonly optional)' , 'demo' , 10, 0, 'ACO');
66 $gacl->add_object('patients', 'Medical/History (write,addonly optional)', 'med' , 10, 0, 'ACO');
67 $gacl->add_object('patients', 'Transactions (write optional)' , 'trans', 10, 0, 'ACO');
68 $gacl->add_object('patients', 'Documents (write,addonly optional)' , 'docs' , 10, 0, 'ACO');
69 $gacl->add_object('patients', 'Patient Notes (write,addonly optional)' , 'notes', 10, 0, 'ACO');
71 // Create ACOs for sensitivities.
73 $gacl->add_object('sensitivities', 'Normal', 'normal', 10, 0, 'ACO');
74 $gacl->add_object('sensitivities', 'High' , 'high' , 20, 0, 'ACO');
76 // Create ARO groups.
78 $users = $gacl->add_group('users', 'OpenEMR Users' , 0 , 'ARO');
79 $admin = $gacl->add_group('admin', 'Administrators', $users, 'ARO');
80 $clin = $gacl->add_group('clin' , 'Clinicians' , $users, 'ARO');
81 $doc = $gacl->add_group('doc' , 'Physicians' , $users, 'ARO');
82 $front = $gacl->add_group('front', 'Front Office' , $users, 'ARO');
83 $back = $gacl->add_group('back' , 'Accounting' , $users, 'ARO');
85 // Create a Users section for the AROs (humans).
87 $gacl->add_object_section('Users', 'users', 10, 0, 'ARO');
89 // Create the Administrator in the above-created "users" section
90 // and add him/her to the above-created "admin" group.
92 $gacl->add_object('users', 'Administrator', 'admin' ,10, 0, 'ARO');
93 $gacl->add_group_object($admin, 'users', 'admin', 'ARO');
95 // Set permissions for administrators.
97 $gacl->add_acl(
98 array(
99 'acct'=>array('bill', 'eob', 'rep', 'rep_a'),
100 'admin'=>array('calendar', 'database', 'forms', 'practice', 'superbill', 'users', 'batchcom', 'language', 'super', 'drugs'),
101 'encounters'=>array('auth_a', 'coding_a', 'notes_a', 'date_a'),
102 'patients'=>array('appt', 'demo', 'med', 'trans', 'docs', 'notes'),
103 'sensitivities'=>array('normal', 'high')
105 NULL, array($admin), NULL, NULL,
106 1, 1, 'write', 'Administrators can do anything'
109 // Set permissions for physicians.
111 $gacl->add_acl(
112 array(
113 'acct'=>array('rep'),
114 'admin'=>array('drugs'),
115 'encounters'=>array('auth_a', 'coding_a', 'notes_a', 'date_a'),
116 'patients'=>array('appt', 'demo', 'med', 'trans', 'docs', 'notes'),
117 'sensitivities'=>array('normal', 'high')
119 NULL, array($doc), NULL, NULL,
120 1, 1, 'write', 'Things that physicians can read and modify'
123 // Set permissions for clinicians.
125 $gacl->add_acl(
126 array(
127 'encounters'=>array('notes', 'relaxed'),
128 'patients'=>array('demo', 'med', 'docs', 'notes'),
129 'sensitivities'=>array('normal')
131 NULL, array($clin), NULL, NULL,
132 1, 1, 'addonly', 'Things that clinicians can read and enter but not modify'
134 $gacl->add_acl(
135 array(
136 'admin'=>array('drugs'),
137 'encounters'=>array('coding'),
138 'patients'=>array('appt')
140 NULL, array($clin), NULL, NULL,
141 1, 1, 'write', 'Things that clinicians can read and modify'
144 // Set permissions for front office staff.
146 $gacl->add_acl(
147 array(
148 'patients'=>array('appt', 'demo', 'trans', 'notes')
150 NULL, array($front), NULL, NULL,
151 1, 1, 'write', 'Things that front office can read and modify'
154 // Set permissions for back office staff.
156 $gacl->add_acl(
157 array(
158 'acct'=>array('bill', 'eob', 'rep', 'rep_a'),
159 'admin'=>array('practice', 'superbill'),
160 'encounters'=>array('auth_a', 'coding_a', 'date_a'),
161 'patients'=>array('appt', 'demo')
163 NULL, array($back), NULL, NULL,
164 1, 1, 'write', 'Things that back office can read and modify'
168 <html>
169 <head>
170 <title>OpenEMR ACL Setup</title>
171 <link rel=STYLESHEET href="interface/themes/style_blue.css">
172 </head>
173 <body>
174 <span class="title">OpenEMR ACL Setup</span>
175 <br><br>
176 <span class="text">
178 All done!
180 </span>
182 </body>
183 </html>