Allow zend hooks to admin (#581)
[openemr.git] / acl_upgrade.php
blob60f99e40e7722a9d5ca93be82b910e7599734ca9
1 <?php
2 /**
3 * Upgrade script for access controls.
5 * This script will update the phpGACL database, which include
6 * Access Control Objects(ACO), Groups(ARO), and Access Control
7 * Lists(ACL) to the most recent version.
8 * It will display whether each update already exist
9 * or if it was updated succesfully.
10 * To avoid reversing customizations, upgrade is done in versions,
11 * which are recorded in the database. To add another version of
12 * changes, use the following template:
13 * <pre>// Upgrade for acl_version <acl_version_here>
14 * $upgrade_acl = <acl_version_here>;
15 * if ($acl_version < $upgrade_acl) {
16 * echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
18 * //Collect the ACL ID numbers.
19 * echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
21 * //Add new object Sections
22 * echo "<BR/><B>Adding new object sections</B><BR/>";
24 * //Add new Objects
25 * echo "<BR/><B>Adding new objects</B><BR/>";
27 * //Update already existing Objects
28 * echo "<BR/><B>Upgrading objects</B><BR/>";
30 * //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
31 * // (will also place in the appropriate group and CREATE a new group if needed)
32 * echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
34 * //Update the ACLs
35 * echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
37 * //DONE with upgrading to this version
38 * $acl_version = $upgrade_acl;
39 * }
40 * </pre>
42 * Updates included:
43 * <pre>---VERSION 1 ACL---
44 * 2.8.2
45 * Section "sensitivities" (Sensitivities):
46 * ADD normal Normal (Administrators, Physicians, Clinicians(addonly))
47 * ADD high High (Administrators, Physicians)
48 * Section "admin" (Administration):
49 * ADD super Superuser (Adminstrators)
50 * 2.8.4
51 * Section "admin" (Administration):
52 * ADD drugs Pharmacy Dispensary (Administrators, Physicians, Clinicians(write))
53 * ADD acl ACL Administration (Administrators)
54 * Section "sensitivities" (Sensitivities):
55 * EDIT high High (ensure the order variable is '20')
56 * Section "acct" (Accounting):
57 * ADD disc Price Discounting (Administrators, Physicians, Accounting(write))
58 * 3.0.2
59 * ADD Section "lists" (Lists):
60 * ADD default Default List (write,addonly optional) (Administrators)
61 * ADD state State List (write,addonly optional) (Administrators)
62 * ADD country Country List (write,addonly optional) (Administrators)
63 * ADD language Language List (write,addonly optional) (Administrators)
64 * ADD ethrace Ethnicity-Race List (write,addonly optional) (Administrators)
65 * ADD Section "placeholder" (Placeholder):
66 * ADD filler Placeholder (Maintains empty ACLs)
67 * ACL/Group doc addonly "Physicians" (filler aco)
68 * ACL/Group front addonly "Front Office" (filler aco)
69 * ACL/Group back addonly "Accounting" (filler aco)
70 * 3.3.0
71 * Section "patients" (Patients):
72 * ADD sign Sign Lab Results (Physicians)
73 * ACL/Group breakglass write "Emergency Login" (added all aco's to it)
74 * 4.1.0
75 * Section "nationnotes" (Nation Notes)
76 * ADD nn_configure Nation Notes Configure (Administrators, Emergency Login)
77 * Section "patientportal" (Patient Portal)
78 * ADD portal Patient Portal (Administrators, Emergency Login)
79 * 4.1.1
80 * ACL/Group doc wsome "Physicians" (filler aco)
81 * ACL/Group clin wsome "Clinicians" (filler aco)
82 * ACL/Group front wsome "Front Office" (filler aco)
83 * ACL/Group back wsome "Accounting" (filler aco)
84 * ACL/Group doc view "Physicians" (filler aco)
85 * ACL/Group clin view "Clinicians" (filler aco)
86 * ACL/Group front view "Front Office" (filler aco)
87 * ACL/Group back view "Accounting" (filler aco)
88 * 4.1.3
89 * Section "menus" (Menus)
90 * ADD modle Module (Administrators, Emergency Login)
91 * 5.0.1
92 * Section "patients" (Patients):
93 * ADD reminder Patient Reminders (Physicians)
94 * ADD alert Clinical Reminders/Alerts (Physicians)
95 * ADD disclosure Disclosures (Physicians)
96 * ADD rx Prescriptions (Physicians)
97 * ADD amendment Amendments (Physicians)
98 * ADD lab Lab Results (Physicians)
99 * </pre>
101 * Copyright (C) 2012 Brady Miller <brady.g.miller@gmail.com>
103 * LICENSE: This program is free software; you can redistribute it and/or
104 * modify it under the terms of the GNU General Public License
105 * as published by the Free Software Foundation; either version 2
106 * of the License, or (at your option) any later version.
107 * This program is distributed in the hope that it will be useful,
108 * but WITHOUT ANY WARRANTY; without even the implied warranty of
109 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
110 * GNU General Public License for more details.
111 * You should have received a copy of the GNU General Public License
112 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>.
114 * @package OpenEMR
115 * @author Brady Miller <brady.g.miller@gmail.com>
116 * @link http://www.open-emr.org
119 // Checks if the server's PHP version is compatible with OpenEMR:
120 require_once(dirname(__FILE__) . "/common/compatibility/checker.php");
122 $response = Checker::checkPhpVersion();
123 if ($response !== true) {
124 die($response);
127 $ignoreAuth = true; // no login required
129 require_once('interface/globals.php');
130 require_once("$srcdir/acl_upgrade_fx.php");
132 //Ensure that phpGACL has been installed
133 include_once('library/acl.inc');
134 if (isset ($phpgacl_location)) {
135 include_once("$phpgacl_location/gacl_api.class.php");
136 $gacl = new gacl_api();
138 else {
139 die("You must first set up library/acl.inc to use phpGACL!");
142 $acl_version = get_acl_version();
143 if (empty($acl_version)) {
144 $acl_version = 0;
147 // Upgrade for acl_version 1
148 $upgrade_acl = 1;
149 if ($acl_version < $upgrade_acl) {
150 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
152 //Collect the ACL ID numbers.
153 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
154 //Get Administrator ACL ID number
155 $admin_write = getAclIdNumber('Administrators', 'write');
156 //Get Doctor ACL ID Number
157 $doc_write = getAclIdNumber('Physicians', 'write');
158 //Get Clinician ACL with write access ID number
159 $clin_write = getAclIdNumber('Clinicians', 'write');
160 //Get Clinician ACL with addonly access ID number
161 $clin_addonly = getAclIdNumber('Clinicians', 'addonly');
162 //Get Receptionist ACL ID number
163 $front_write = getAclIdNumber('Front Office', 'write');
164 //Get Accountant ACL ID number
165 $back_write = getAclIdNumber('Accounting', 'write');
167 //Add new object Sections
168 echo "<BR/><B>Adding new object sections</B><BR/>";
169 //Add 'Sensitivities' object section (added in 2.8.2)
170 addObjectSectionAcl('sensitivities', 'Sensitivities');
171 //Add 'Lists' object section (added in 3.0.2)
172 addObjectSectionAcl('lists', 'Lists');
173 //Add 'Placeholder' object section (added in 3.0.2)
174 addObjectSectionAcl('placeholder', 'Placeholder');
175 //Add 'Nation Notes' object section (added in 4.1.0)
176 addObjectSectionAcl('nationnotes','Nation Notes');
177 //Add 'Patient Portal' object section (added in 4.1.0)
178 addObjectSectionAcl('patientportal', 'Patient Portal');
180 //Add new Objects
181 echo "<BR/><B>Adding new objects</B><BR/>";
182 //Add 'Normal' sensitivity object, order variable is default 10 (added in 2.8.2)
183 addObjectAcl('sensitivities', 'Sensitivities', 'normal', 'Normal');
184 //Add 'High' sensitivity object, order variable is set to 20 (added in 2.8.2)
185 addObjectAclWithOrder('sensitivities', 'Sensitivities', 'high', 'High', 20);
186 //Add 'Pharmacy Dispensary' object (added in 2.8.4)
187 addObjectAcl('admin', 'Administration', 'drugs', 'Pharmacy Dispensary');
188 //Add 'ACL Administration' object (added in 2.8.4)
189 addObjectAcl('admin', 'Administration', 'acl', 'ACL Administration');
190 //Add 'Price Discounting' object (added in 2.8.4)
191 addObjectAcl('acct', 'Accounting', 'disc', 'Price Discounting');
192 //Add 'Default List (write,addonly optional)' object (added in 3.0.2)
193 addObjectAcl('lists', 'Lists', 'default', 'Default List (write,addonly optional)');
194 //Add 'State List (write,addonly optional)' object (added in 3.0.2)
195 addObjectAcl('lists', 'Lists', 'state', 'State List (write,addonly optional)');
196 //Add 'Country List (write,addonly optional)' object (added in 3.0.2)
197 addObjectAcl('lists', 'Lists', 'country', 'Country List (write,addonly optional)');
198 //Add 'Language List (write,addonly optional)' object (added in 3.0.2)
199 addObjectAcl('lists', 'Lists', 'language', 'Language List (write,addonly optional)');
200 //Add 'Ethnicity-Race List (write,addonly optional)' object (added in 3.0.2)
201 addObjectAcl('lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)');
202 //Add 'Placeholder (Maintains empty ACLs)' object (added in 3.0.2)
203 addObjectAcl('placeholder', 'Placeholder', 'filler', 'Placeholder (Maintains empty ACLs)');
204 //Add 'Sign Lab Results (write,addonly optional)' object (added in 3.3.0)
205 addObjectAcl('patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)');
206 //Add 'nationnotes' object (added in 4.1.0)
207 addObjectAcl('nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure');
208 //Add 'patientportal' object (added in 4.1.0)
209 addObjectAcl('patientportal', 'Patient Portal', 'portal', 'Patient Portal');
211 //Update already existing Objects
212 echo "<BR/><B>Upgrading objects</B><BR/>";
213 //Ensure that 'High' sensitivity object order variable is set to 20
214 editObjectAcl('sensitivities', 'Sensitivities', 'high', 'High', 20);
216 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
217 // (will also place in the appropriate group and CREATE a new group if needed)
218 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
219 //Add 'Physicians' ACL with 'addonly' and collect the ID number (added in 3.0.2)
220 $doc_addonly = addNewACL('Physicians', 'doc', 'addonly', 'Things that physicians can read and enter but not modify');
221 //Add 'Front Office' ACL with 'addonly' and collect the ID number (added in 3.0.2)
222 $front_addonly = addNewACL('Front Office', 'front', 'addonly', 'Things that front office can read and enter but not modify');
223 //Add 'Accounting' ACL with 'addonly' and collect the ID number (added in 3.0.2)
224 $back_addonly = addNewACL('Accounting', 'back', 'addonly', 'Things that back office can read and enter but not modify');
225 //Add 'Emergency Login' ACL with 'write' and collect the ID number (added in 3.3.0)
226 $emergency_write = addNewACL('Emergency Login', 'breakglass', 'write', 'Things that can use for emergency login, can read and modify');
228 //Update the ACLs
229 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
230 //Insert the 'super' object from the 'admin' section into the Administrators group write ACL (added in 2.8.2)
231 updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'super', 'Superuser', 'write');
232 //Insert the 'high' object from the 'sensitivities' section into the Administrators group write ACL (added in 2.8.2)
233 updateAcl($admin_write, 'Administrators', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
234 //Insert the 'normal' object from the 'sensitivities' section into the Administrators group write ACL (added in 2.8.2)
235 updateAcl($admin_write, 'Administrators', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
236 //Insert the 'high' object from the 'sensitivities' section into the Physicians group write ACL (added in 2.8.2)
237 updateAcl($doc_write, 'Physicians', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
238 //Insert the 'normal' object from the 'sensitivities' section into the Physicians group write ACL (added in 2.8.2)
239 updateAcl($doc_write, 'Physicians', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
240 //Insert the 'normal' object from the 'sensitivities' section into the Clinicians group addonly ACL (added in 2.8.2)
241 updateAcl($clin_addonly, 'Clinicians', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'addonly');
242 //Insert the 'drugs' object from the 'admin' section into the Administrators group write ACL (added in 2.8.4)
243 updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
244 //Insert the 'drugs' object from the 'admin' section into the Physicians group write ACL (added in 2.8.4)
245 updateAcl($doc_write, 'Physicians', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
246 //Insert the 'drugs' object from the 'admin' section into the Clinicians group write ACL (added in 2.8.4)
247 updateAcl($clin_write, 'Clinicians', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
248 //Insert the 'acl' object from the 'admin' section into the Administrators group write ACL (added in 2.8.4)
249 updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'acl', 'ACL Administration', 'write');
250 //Insert the 'disc' object from the 'acct' section into the Administrators group write ACL (added in 2.8.4)
251 updateAcl($admin_write, 'Administrators', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
252 //Insert the 'disc' object from the 'acct' section into the Accounting group write ACL (added in 2.8.4)
253 updateAcl($back_write, 'Accounting', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
254 //Insert the 'disc' object from the 'acct' section into the Physicians group write ACL (added in 2.8.4)
255 updateAcl($doc_write, 'Physicians', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
256 //Insert the 'default' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
257 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'default', 'Default List (write,addonly optional)', 'write');
258 //Insert the 'state' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
259 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'state', 'State List (write,addonly optional)', 'write');
260 //Insert the 'country' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
261 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'country', 'Country List (write,addonly optional)', 'write');
262 //Insert the 'language' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
263 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'language', 'Language List (write,addonly optional)', 'write');
264 //Insert the 'race' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
265 updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)', 'write');
266 //Update ACLs for Emergency Login
267 //Insert the 'disc' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
268 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
269 //Insert the 'bill' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
270 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'bill', 'Billing (write optional)', 'write');
271 //Insert the 'eob' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
272 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'eob', 'EOB Data Entry', 'write');
273 //Insert the 'rep' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
274 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'rep', 'Financial Reporting - my encounters', 'write');
275 //Insert the 'rep_a' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
276 updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'rep_a', 'Financial Reporting - anything', 'write');
277 //Insert the 'calendar' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
278 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'calendar', 'Calendar Settings', 'write');
279 //Insert the 'database' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
280 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'database', 'Database Reporting', 'write');
281 //Insert the 'forms' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
282 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'forms', 'Forms Administration', 'write');
283 //Insert the 'practice' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
284 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'practice', 'Practice Settings', 'write');
285 //Insert the 'superbill' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
286 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'superbill', 'Superbill Codes Administration', 'write');
287 //Insert the 'users' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
288 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'users', 'Users/Groups/Logs Administration', 'write');
289 //Insert the 'batchcom' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
290 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'batchcom', 'Batch Communication Tool', 'write');
291 //Insert the 'language' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
292 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'language', 'Language Interface Tool', 'write');
293 //Insert the 'super' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
294 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'super', 'Superuser', 'write');
295 //Insert the 'drugs' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
296 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
297 //Insert the 'acl' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
298 updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'acl', 'ACL Administration', 'write');
299 //Insert the 'auth_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
300 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'auth_a', 'Authorize - any encounters', 'write');
301 //Insert the 'coding_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
302 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'coding_a', 'Coding - any encounters (write,wsome optional)', 'write');
303 //Insert the 'notes_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
304 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'notes_a', 'Notes - any encounters (write,addonly optional)', 'write');
305 //Insert the 'date_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
306 updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'date_a', 'Fix encounter dates - any encounters', 'write');
307 //Insert the 'default' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
308 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'default', 'Default List (write,addonly optional)', 'write');
309 //Insert the 'state' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
310 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'state', 'State List (write,addonly optional)', 'write');
311 //Insert the 'country' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
312 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'country', 'Country List (write,addonly optional)', 'write');
313 //Insert the 'language' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
314 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'language', 'Language List (write,addonly optional)', 'write');
315 //Insert the 'ethrace' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
316 updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)', 'write');
317 //Insert the 'appt' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
318 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'appt', 'Appointments (write,wsome optional)', 'write');
319 //Insert the 'demo' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
320 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'demo', 'Demographics (write,addonly optional)', 'write');
321 //Insert the 'med' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
322 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'med', 'Medical/History (write,addonly optional)', 'write');
323 //Insert the 'trans' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
324 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'trans', 'Transactions (write optional)', 'write');
325 //Insert the 'docs' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
326 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'docs', 'Documents (write,addonly optional)', 'write');
327 //Insert the 'notes' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
328 updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'notes', 'Patient Notes (write,addonly optional)', 'write');
329 //Insert the 'high' object from the 'sensitivities' section into the Emergency Login group write ACL (added in 3.3.0)
330 updateAcl($emergency_write, 'Emergency Login', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
331 //Insert the 'normal' object from the 'sensitivities' section into the Emergency Login group write ACL (added in 3.3.0)
332 updateAcl($emergency_write, 'Emergency Login', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
333 //Insert the 'sign' object from the 'patients' section into the Physicians group write ACL (added in 3.3.0)
334 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)', 'write');
335 //Insert the 'sign' object from the 'nationnotes' section into the Administrators group write ACL (added in 3.3.0)
336 updateAcl($admin_write, 'Administrators','nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure','write');
337 //Insert the 'sign' object from the 'nationnotes' section into the Emergency Login group write ACL (added in 3.3.0)
338 updateAcl($emergency_write, 'Emergency Login','nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure','write');
339 //Insert the 'patientportal' object from the 'patientportal' section into the Administrators group write ACL (added in 4.1.0)
340 updateAcl($admin_write, 'Administrators','patientportal', 'Patient Portal', 'portal', 'Patient Portal','write');
341 //Insert the 'patientportal' object from the 'patientportal' section into the Emergency Login group write ACL (added in 4.1.0)
342 updateAcl($emergency_write, 'Emergency Login','patientportal', 'Patient Portal', 'portal', 'Patient Portal','write');
344 //DONE with upgrading to this version
345 $acl_version = $upgrade_acl;
348 // Upgrade for acl_version 2
349 $upgrade_acl = 2;
350 if ($acl_version < $upgrade_acl) {
351 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
353 //Collect the ACL ID numbers.
354 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
356 //Add new object Sections
357 echo "<BR/><B>Adding new object sections</B><BR/>";
359 //Add new Objects
360 echo "<BR/><B>Adding new objects</B><BR/>";
362 //Update already existing Objects
363 echo "<BR/><B>Upgrading objects</B><BR/>";
365 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
366 // (will also place in the appropriate group and CREATE a new group if needed)
367 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
368 addNewACL('Physicians', 'doc', 'wsome', 'Things that physicians can read and partly modify');
369 addNewACL('Clinicians', 'clin', 'wsome', 'Things that clinicians can read and partly modify');
370 addNewACL('Front Office', 'front', 'wsome', 'Things that front office can read and partly modify');
371 addNewACL('Accounting', 'back', 'wsome', 'Things that back office can read and partly modify');
372 addNewACL('Physicians', 'doc', 'view', 'Things that physicians can only read');
373 addNewACL('Clinicians', 'clin', 'view', 'Things that clinicians can only read');
374 addNewACL('Front Office', 'front', 'view', 'Things that front office can only read');
375 addNewACL('Accounting', 'back', 'view', 'Things that back office can only read');
377 //Update the ACLs
378 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
380 //DONE with upgrading to this version
381 $acl_version = $upgrade_acl;
384 // Upgrade for acl_version 3
385 $upgrade_acl = 3;
386 if ($acl_version < $upgrade_acl) {
387 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
389 //Collect the ACL ID numbers.
390 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
391 //Get Administrator ACL ID number
392 $admin_write = getAclIdNumber('Administrators', 'write');
393 //Get Emergency ACL ID number
394 $emergency_write = getAclIdNumber('Emergency Login', 'write');
396 //Add new object Sections
397 echo "<BR/><B>Adding new object sections</B><BR/>";
398 //Add 'Menus' object section (added in 4.1.3)
399 addObjectSectionAcl('menus', 'Menus');
401 //Add new Objects
402 echo "<BR/><B>Adding new objects</B><BR/>";
403 //Add 'modules' object (added in 4.1.3)
404 addObjectAcl('menus', 'Menus', 'modle', 'Modules');
406 //Update already existing Objects
407 echo "<BR/><B>Upgrading objects</B><BR/>";
409 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
410 // (will also place in the appropriate group and CREATE a new group if needed)
411 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
413 //Update the ACLs
414 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
415 //Insert the 'Modules' object from the 'Menus' section into the Administrators group write ACL (added in 4.1.3)
416 updateAcl($admin_write, 'Administrators','menus', 'Menus', 'modle', 'Modules', 'write');
417 //Insert the 'Modules' object from the 'Menus' section into the Emergency Login group write ACL (added in 4.1.3)
418 updateAcl($emergency_write, 'Emergency Login','menus', 'Menus', 'modle', 'Modules', 'write');
420 //DONE with upgrading to this version
421 $acl_version = $upgrade_acl;
424 // Upgrade for acl_version 4
425 $upgrade_acl = 4;
426 if ($acl_version < $upgrade_acl) {
427 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
429 //Collect the ACL ID numbers.
430 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
431 //Get Administrator ACL ID number
432 $admin_write = getAclIdNumber('Administrators', 'write');
433 //Get Doctor ACL ID Number
434 $doc_write = getAclIdNumber('Physicians', 'write');
435 //Get Clinician ACL with write access ID number
436 $clin_write = getAclIdNumber('Clinicians', 'write');
437 //Get Clinician ACL with addonly access ID number
438 $clin_addonly = getAclIdNumber('Clinicians', 'addonly');
439 //Get Receptionist ACL ID number
440 $front_write = getAclIdNumber('Front Office', 'write');
441 //Get Accountant ACL ID number
442 $back_write = getAclIdNumber('Accounting', 'write');
444 //Add new object Sections
445 // echo "<BR/><B>Adding new object sections</B><BR/>";
447 //Add new Objects
448 echo "<BR/><B>Adding new objects</B><BR/>";
449 // Add 'Patient Reminders (write,addonly optional)' object (added in 5.0.1)
450 addObjectAcl('patients', 'Patients', 'reminder' , 'Patient Reminders (write,addonly optional)');
451 // Add 'Clinical Reminders/Alerts (write,addonly optional)' object (added in 5.0.1)
452 addObjectAcl('patients', 'Patients', 'alert' , 'Clinical Reminders/Alerts (write,addonly optional)');
453 // Add 'Disclosures (write,addonly optional)' object (added in 5.0.1)
454 addObjectAcl('patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)');
455 // Add 'Prescriptions (write,addonly optional)' object (added in 5.0.1)
456 addObjectAcl('patients', 'Patients', 'rx' , 'Prescriptions (write,addonly optional)');
457 // Add 'Amendments (write,addonly optional)' object (added in 5.0.1)
458 addObjectAcl('patients', 'Patients', 'amendment' , 'Amendments (write,addonly optional)');
459 // Add 'Lab Results (write,addonly optional)' object (added in 5.0.1)
460 addObjectAcl('patients', 'Patients', 'lab' , 'Lab Results (write,addonly optional)');
462 //Update already existing Objects
463 // echo "<BR/><B>Upgrading objects</B><BR/>";
465 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
466 // (will also place in the appropriate group and CREATE a new group if needed)
467 // echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
469 //Update the ACLs
470 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
471 //Insert the 'reminder' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
472 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'reminder', 'Patient Reminders (write,addonly optional)', 'write');
473 //Insert the 'alert' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
474 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'write');
475 //Insert the 'disclosure' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
476 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)', 'write');
477 //Insert the 'rx' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
478 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'rx', 'Prescriptions (write,addonly optional)', 'write');
479 //Insert the 'amendment' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
480 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'amendment', 'Amendments (write,addonly optional)', 'write');
481 //Insert the 'lab' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
482 updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'lab', 'Lab Results (write,addonly optional)', 'write');
484 //DONE with upgrading to this version
485 $acl_version = $upgrade_acl;
488 /* This is a template for a new revision, when needed
489 // Upgrade for acl_version 5
490 $upgrade_acl = 5;
491 if ($acl_version < $upgrade_acl) {
492 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
494 //Collect the ACL ID numbers.
495 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
497 //Add new object Sections
498 echo "<BR/><B>Adding new object sections</B><BR/>";
500 //Add new Objects
501 echo "<BR/><B>Adding new objects</B><BR/>";
503 //Update already existing Objects
504 echo "<BR/><B>Upgrading objects</B><BR/>";
506 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
507 // (will also place in the appropriate group and CREATE a new group if needed)
508 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
510 //Update the ACLs
511 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
513 //DONE with upgrading to this version
514 $acl_version = $upgrade_acl;
518 //All done
519 $response = set_acl_version($acl_version);
521 if ($response) {
522 echo "DONE upgrading access controls";
523 } else {
524 echo "ERROR upgrading access control version";