CQM Module:
[openemr.git] / acl_setup.php
blob2057456cc607a7e8c169c02c2d108cd233db1b9d
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.
8 //
9 // This program is run by the OpenEMR setup.php script to install phpGACL
10 // and creates the Access Control Objects and their sections.
11 // See openemr/library/acl.inc file for the list of
12 // currently supported Access Control Objects(ACO), which this
13 // script will install. This script also creates several
14 // ARO groups, an "admin" ARO, and some reasonable ACL entries for
15 // the groups.
16 // ARO groups include:
17 // Administrators
18 // Physicians (Doctors)
19 // Clinicians (Nurses, Physician Assistants, etc.)
20 // Front Office (Receptionist)
21 // Accounting
23 // Upgrade Howto
24 // When upgrading to a new version of OpenEMR, run the acl_upgrade.php
25 // script to update the phpGACL access controls. This is required to
26 // ensure the database includes all the required Access Control
27 // Objects(ACO).
30 // On 06/2009, added pertinent comments below each entry to allow capture
31 // of these terms by the translation engine.
33 require_once(dirname(__FILE__).'/library/acl.inc');
35 if (! $phpgacl_location) die("You must first set up library/acl.inc to use phpGACL!");
37 require_once("$phpgacl_location/gacl_api.class.php");
39 $gacl = new gacl_api();
41 // Create the ACO sections. Every ACO must have a section.
43 if ($gacl->add_object_section('Accounting', 'acct', 10, 0, 'ACO') === FALSE) {
44 echo "Unable to create the access controls for OpenEMR. You have likely already run this script (acl_setup.php) successfully.<br>Other possible problems include php-GACL configuration file errors (gacl.ini.php or gacl.class.php).<br>";
45 return;
47 // xl('Accounting')
48 $gacl->add_object_section('Administration', 'admin' , 10, 0, 'ACO');
49 // xl('Administration')
50 $gacl->add_object_section('Encounters' , 'encounters' , 10, 0, 'ACO');
51 // xl('Encounters')
52 $gacl->add_object_section('Lists' , 'lists' , 10, 0, 'ACO');
53 // xl('Lists')
54 $gacl->add_object_section('Patients' , 'patients' , 10, 0, 'ACO');
55 // xl('Patients')
56 $gacl->add_object_section('Squads' , 'squads' , 10, 0, 'ACO');
57 // xl('Squads')
58 $gacl->add_object_section('Sensitivities' , 'sensitivities', 10, 0, 'ACO');
59 // xl('Sensitivities')
60 $gacl->add_object_section('Placeholder' , 'placeholder' , 10, 0, 'ACO');
61 // xl('Placeholder')
63 // Create Accounting ACOs.
65 $gacl->add_object('acct', 'Billing (write optional)' , 'bill' , 10, 0, 'ACO');
66 // xl('Billing (write optional)')
67 $gacl->add_object('acct', 'Price Discounting' , 'disc' , 10, 0, 'ACO');
68 // xl('Price Discounting')
69 $gacl->add_object('acct', 'EOB Data Entry' , 'eob' , 10, 0, 'ACO');
70 // xl('EOB Data Entry')
71 $gacl->add_object('acct', 'Financial Reporting - my encounters', 'rep' , 10, 0, 'ACO');
72 // xl('Financial Reporting - my encounters')
73 $gacl->add_object('acct', 'Financial Reporting - anything' , 'rep_a', 10, 0, 'ACO');
74 // xl('Financial Reporting - anything')
76 // Create Administration ACOs.
78 $gacl->add_object('admin', 'Superuser' , 'super' , 10, 0, 'ACO');
79 // xl('Superuser')
80 $gacl->add_object('admin', 'Calendar Settings' , 'calendar' , 10, 0, 'ACO');
81 // xl('Calendar Settings')
82 $gacl->add_object('admin', 'Database Reporting' , 'database' , 10, 0, 'ACO');
83 // xl('Database Reporting')
84 $gacl->add_object('admin', 'Forms Administration' , 'forms' , 10, 0, 'ACO');
85 // xl('Forms Administration')
86 $gacl->add_object('admin', 'Practice Settings' , 'practice' , 10, 0, 'ACO');
87 // xl('Practice Settings')
88 $gacl->add_object('admin', 'Superbill Codes Administration' , 'superbill', 10, 0, 'ACO');
89 // xl('Superbill Codes Administration')
90 $gacl->add_object('admin', 'Users/Groups/Logs Administration', 'users' , 10, 0, 'ACO');
91 // xl('Users/Groups/Logs Administration')
92 $gacl->add_object('admin', 'Batch Communication Tool' , 'batchcom' , 10, 0, 'ACO');
93 // xl('Batch Communication Tool')
94 $gacl->add_object('admin', 'Language Interface Tool' , 'language' , 10, 0, 'ACO');
95 // xl('Language Interface Tool')
96 $gacl->add_object('admin', 'Pharmacy Dispensary' , 'drugs' , 10, 0, 'ACO');
97 // xl('Pharmacy Dispensary')
98 $gacl->add_object('admin', 'ACL Administration' , 'acl' , 10, 0, 'ACO');
99 // xl('ACL Administration')
101 // Create ACOs for encounters.
103 $gacl->add_object('encounters', 'Authorize - my encounters' , 'auth' , 10, 0, 'ACO');
104 // xl('Authorize - my encounters')
105 $gacl->add_object('encounters', 'Authorize - any encounters' , 'auth_a' , 10, 0, 'ACO');
106 // xl('Authorize - any encounters')
107 $gacl->add_object('encounters', 'Coding - my encounters (write,wsome optional)' , 'coding' , 10, 0, 'ACO');
108 // xl('Coding - my encounters (write,wsome optional)')
109 $gacl->add_object('encounters', 'Coding - any encounters (write,wsome optional)' , 'coding_a', 10, 0, 'ACO');
110 // xl('Coding - any encounters (write,wsome optional)')
111 $gacl->add_object('encounters', 'Notes - my encounters (write,addonly optional)' , 'notes' , 10, 0, 'ACO');
112 // xl('Notes - my encounters (write,addonly optional)')
113 $gacl->add_object('encounters', 'Notes - any encounters (write,addonly optional)' , 'notes_a' , 10, 0, 'ACO');
114 // xl('Notes - any encounters (write,addonly optional)')
115 $gacl->add_object('encounters', 'Fix encounter dates - any encounters' , 'date_a' , 10, 0, 'ACO');
116 // xl('Fix encounter dates - any encounters')
117 $gacl->add_object('encounters', 'Less-private information (write,addonly optional)', 'relaxed' , 10, 0, 'ACO');
118 // xl('Less-private information (write,addonly optional)')
120 // Create ACOs for lists.
122 $gacl->add_object('lists', 'Default List (write,addonly optional)' , 'default' , 10, 0, 'ACO');
123 // xl('Default List (write,addonly optional)')
124 $gacl->add_object('lists', 'State List (write,addonly optional)' , 'state' , 10, 0, 'ACO');
125 // xl('State List (write,addonly optional)')
126 $gacl->add_object('lists', 'Country List (write,addonly optional)' , 'country' , 10, 0, 'ACO');
127 // xl('Country List (write,addonly optional)')
128 $gacl->add_object('lists', 'Language List (write,addonly optional)' , 'language' , 10, 0, 'ACO');
129 // xl('Language List (write,addonly optional)')
130 $gacl->add_object('lists', 'Ethnicity-Race List (write,addonly optional)' , 'ethrace' , 10, 0, 'ACO');
131 // xl('Ethnicity-Race List (write,addonly optional)')
133 // Create ACOs for patients.
135 $gacl->add_object('patients', 'Appointments (write optional)' , 'appt' , 10, 0, 'ACO');
136 // xl('Appointments (write optional)')
137 $gacl->add_object('patients', 'Demographics (write,addonly optional)' , 'demo' , 10, 0, 'ACO');
138 // xl('Demographics (write,addonly optional)')
139 $gacl->add_object('patients', 'Medical/History (write,addonly optional)' , 'med' , 10, 0, 'ACO');
140 // xl('Medical/History (write,addonly optional)')
141 $gacl->add_object('patients', 'Transactions (write optional)' , 'trans', 10, 0, 'ACO');
142 // xl('Transactions (write optional)')
143 $gacl->add_object('patients', 'Documents (write,addonly optional)' , 'docs' , 10, 0, 'ACO');
144 // xl('Documents (write,addonly optional)')
145 $gacl->add_object('patients', 'Patient Notes (write,addonly optional)' , 'notes', 10, 0, 'ACO');
146 // xl('Patient Notes (write,addonly optional)')
147 $gacl->add_object('patients', 'Sign Lab Results (write,addonly optional)', 'sign' , 10, 0, 'ACO');
148 // xl('Sign Lab Results (write,addonly optional)')
150 // Create ACOs for sensitivities.
152 $gacl->add_object('sensitivities', 'Normal', 'normal', 10, 0, 'ACO');
153 // xl('Normal')
154 $gacl->add_object('sensitivities', 'High' , 'high' , 20, 0, 'ACO');
155 // xl('High')
157 // Create ACO for placeholder.
159 $gacl->add_object('placeholder', 'Placeholder (Maintains empty ACLs)', 'filler', 10, 0, 'ACO');
160 // xl('Placeholder (Maintains empty ACLs)')
162 // Create ARO groups.
164 $users = $gacl->add_group('users', 'OpenEMR Users' , 0 , 'ARO');
165 // xl('OpenEMR Users')
166 $admin = $gacl->add_group('admin', 'Administrators', $users, 'ARO');
167 // xl('Administrators')
168 $clin = $gacl->add_group('clin' , 'Clinicians' , $users, 'ARO');
169 // xl('Clinicians')
170 $doc = $gacl->add_group('doc' , 'Physicians' , $users, 'ARO');
171 // xl('Physicians')
172 $front = $gacl->add_group('front', 'Front Office' , $users, 'ARO');
173 // xl('Front Office')
174 $back = $gacl->add_group('back' , 'Accounting' , $users, 'ARO');
175 // xl('Accounting')
176 $breakglass = $gacl->add_group('breakglass' , 'Emergency Login' , $users, 'ARO');
177 // xl('Emergency Login')
180 // Create a Users section for the AROs (humans).
182 $gacl->add_object_section('Users', 'users', 10, 0, 'ARO');
183 // xl('Users')
185 // Create the Administrator in the above-created "users" section
186 // and add him/her to the above-created "admin" group.
187 // If this script is being used by OpenEMR's setup, then will
188 // incorporate the installation values. Otherwise will
189 // hardcode the 'admin' user.
190 if ( isset($this->iuser) ) {
191 $gacl->add_object('users', $this->iuname, $this->iuser, 10, 0, 'ARO');
192 $gacl->add_group_object($admin, 'users', $this->iuser, 'ARO');
194 else {
195 $gacl->add_object('users', 'Administrator', 'admin' ,10, 0, 'ARO');
196 $gacl->add_group_object($admin, 'users', 'admin', 'ARO');
199 // Declare return terms for language translations
200 // xl('write') xl('wsome') xl('addonly')
202 // Set permissions for administrators.
204 $gacl->add_acl(
205 array(
206 'acct'=>array('bill', 'disc', 'eob', 'rep', 'rep_a'),
207 'admin'=>array('calendar', 'database', 'forms', 'practice', 'superbill', 'users', 'batchcom', 'language', 'super', 'drugs', 'acl'),
208 'encounters'=>array('auth_a', 'coding_a', 'notes_a', 'date_a'),
209 'lists'=>array('default','state','country','language','ethrace'),
210 'patients'=>array('appt', 'demo', 'med', 'trans', 'docs', 'notes'),
211 'sensitivities'=>array('normal', 'high')
213 NULL, array($admin), NULL, NULL,
214 1, 1, 'write', 'Administrators can do anything'
216 // xl('Administrators can do anything')
218 // Set permissions for physicians.
220 $gacl->add_acl(
221 array(
222 'placeholder'=>array('filler')
224 NULL, array($doc), NULL, NULL,
225 1, 1, 'addonly', 'Things that physicians can read and enter but not modify'
227 // xl('Things that physicians can read and enter but not modify')
228 $gacl->add_acl(
229 array(
230 'acct'=>array('disc', 'rep'),
231 'admin'=>array('drugs'),
232 'encounters'=>array('auth_a', 'coding_a', 'notes_a', 'date_a'),
233 'patients'=>array('appt', 'demo', 'med', 'trans', 'docs', 'notes', 'sign'),
234 'sensitivities'=>array('normal', 'high')
236 NULL, array($doc), NULL, NULL,
237 1, 1, 'write', 'Things that physicians can read and modify'
239 // xl('Things that physicians can read and modify')
241 // Set permissions for clinicians.
243 $gacl->add_acl(
244 array(
245 'encounters'=>array('notes', 'relaxed'),
246 'patients'=>array('demo', 'med', 'docs', 'notes'),
247 'sensitivities'=>array('normal')
249 NULL, array($clin), NULL, NULL,
250 1, 1, 'addonly', 'Things that clinicians can read and enter but not modify'
252 // xl('Things that clinicians can read and enter but not modify')
253 $gacl->add_acl(
254 array(
255 'admin'=>array('drugs'),
256 'encounters'=>array('coding'),
257 'patients'=>array('appt')
259 NULL, array($clin), NULL, NULL,
260 1, 1, 'write', 'Things that clinicians can read and modify'
262 // xl('Things that clinicians can read and modify')
264 // Set permissions for front office staff.
266 $gacl->add_acl(
267 array(
268 'placeholder'=>array('filler')
270 NULL, array($front), NULL, NULL,
271 1, 1, 'addonly', 'Things that front office can read and enter but not modify'
273 // xl('Things that front office can read and enter but not modify')
274 $gacl->add_acl(
275 array(
276 'patients'=>array('appt', 'demo', 'trans', 'notes')
278 NULL, array($front), NULL, NULL,
279 1, 1, 'write', 'Things that front office can read and modify'
281 // xl('Things that front office can read and modify')
283 // Set permissions for back office staff.
285 $gacl->add_acl(
286 array(
287 'placeholder'=>array('filler')
289 NULL, array($back), NULL, NULL,
290 1, 1, 'addonly', 'Things that back office can read and enter but not modify'
292 // xl('Things that back office can read and enter but not modify')
293 $gacl->add_acl(
294 array(
295 'acct'=>array('bill', 'disc', 'eob', 'rep', 'rep_a'),
296 'admin'=>array('practice', 'superbill'),
297 'encounters'=>array('auth_a', 'coding_a', 'date_a'),
298 'patients'=>array('appt', 'demo')
300 NULL, array($back), NULL, NULL,
301 1, 1, 'write', 'Things that back office can read and modify'
303 // xl('Things that back office can read and modify')
304 // Set permissions for Emergency Login.
306 $gacl->add_acl(
307 array(
308 'acct'=>array('bill', 'disc', 'eob', 'rep', 'rep_a'),
309 'admin'=>array('calendar', 'database', 'forms', 'practice', 'superbill', 'users', 'batchcom', 'language', 'super', 'drugs', 'acl'),
310 'encounters'=>array('auth_a', 'coding_a', 'notes_a', 'date_a'),
311 'lists'=>array('default','state','country','language','ethrace'),
312 'patients'=>array('appt', 'demo', 'med', 'trans', 'docs', 'notes'),
313 'sensitivities'=>array('normal', 'high')
315 NULL, array($breakglass), NULL, NULL,
316 1, 1, 'write', 'Emergency Login user can do anything'
318 // xl('Emergency Login user can do anything')
321 <html>
322 <head>
323 <title>OpenEMR ACL Setup</title>
324 <link rel=STYLESHEET href="interface/themes/style_blue.css">
325 </head>
326 <body>
327 <b>OpenEMR ACL Setup</b>
328 <br>
329 All done configuring and installing access controls (php-GACL)!
330 </body>
331 </html>