ccda import fix (#5904)
[openemr.git] / acl_upgrade.php
blob6501e9c032b96237913397fef5fc1d935227cb30
1 <?php
3 /**
4 * Upgrade script for access controls.
6 * This script will update the phpGACL database, which include
7 * Access Control Objects(ACO), Groups(ARO), and Access Control
8 * Lists(ACL) to the most recent version.
9 * It will display whether each update already exist
10 * or if it was updated succesfully.
11 * To avoid reversing customizations, upgrade is done in versions,
12 * which are recorded in the database. To add another version of
13 * changes, use the following template:
14 * <pre>// Upgrade for acl_version <acl_version_here>
15 * $upgrade_acl = <acl_version_here>;
16 * if ($acl_version < $upgrade_acl) {
17 * echo "<B>UPGRADING ACCESS CONTROLS TO VERSION ".$upgrade_acl.":</B></BR>";
19 * //Collect the ACL ID numbers.
20 * echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
22 * //Add new object Sections
23 * echo "<BR/><B>Adding new object sections</B><BR/>";
25 * //Add new Objects
26 * echo "<BR/><B>Adding new objects</B><BR/>";
28 * //Update already existing Objects
29 * echo "<BR/><B>Upgrading objects</B><BR/>";
31 * //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
32 * // (will also place in the appropriate group and CREATE a new group if needed)
33 * echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
35 * //Update the ACLs
36 * echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
38 * //DONE with upgrading to this version
39 * $acl_version = $upgrade_acl;
40 * }
41 * </pre>
43 * Updates included:
44 * <pre>---VERSION 1 ACL---
45 * 2.8.2
46 * Section "sensitivities" (Sensitivities):
47 * ADD normal Normal (Administrators, Physicians, Clinicians(addonly))
48 * ADD high High (Administrators, Physicians)
49 * Section "admin" (Administration):
50 * ADD super Superuser (Adminstrators)
51 * 2.8.4
52 * Section "admin" (Administration):
53 * ADD drugs Pharmacy Dispensary (Administrators, Physicians, Clinicians(write))
54 * ADD acl ACL Administration (Administrators)
55 * Section "sensitivities" (Sensitivities):
56 * EDIT high High (ensure the order variable is '20')
57 * Section "acct" (Accounting):
58 * ADD disc Price Discounting (Administrators, Physicians, Accounting(write))
59 * 3.0.2
60 * ADD Section "lists" (Lists):
61 * ADD default Default List (write,addonly optional) (Administrators)
62 * ADD state State List (write,addonly optional) (Administrators)
63 * ADD country Country List (write,addonly optional) (Administrators)
64 * ADD language Language List (write,addonly optional) (Administrators)
65 * ADD ethrace Ethnicity-Race List (write,addonly optional) (Administrators)
66 * ADD Section "placeholder" (Placeholder):
67 * ADD filler Placeholder (Maintains empty ACLs)
68 * ACL/Group doc addonly "Physicians" (filler aco)
69 * ACL/Group front addonly "Front Office" (filler aco)
70 * ACL/Group back addonly "Accounting" (filler aco)
71 * 3.3.0
72 * Section "patients" (Patients):
73 * ADD sign Sign Lab Results (Physicians)
74 * ACL/Group breakglass write "Emergency Login" (added all aco's to it)
75 * 4.1.0
76 * Section "nationnotes" (Nation Notes):
77 * ADD nn_configure Nation Notes Configure (Administrators, Emergency Login)
78 * Section "patientportal" (Patient Portal):
79 * ADD portal Patient Portal (Administrators, Emergency Login)
80 * 4.1.1
81 * ACL/Group doc wsome "Physicians" (filler aco)
82 * ACL/Group clin wsome "Clinicians" (filler aco)
83 * ACL/Group front wsome "Front Office" (filler aco)
84 * ACL/Group back wsome "Accounting" (filler aco)
85 * ACL/Group doc view "Physicians" (filler aco)
86 * ACL/Group clin view "Clinicians" (filler aco)
87 * ACL/Group front view "Front Office" (filler aco)
88 * ACL/Group back view "Accounting" (filler aco)
89 * 4.1.3
90 * Section "menus" (Menus):
91 * ADD modle Module (Administrators, Emergency Login)
92 * 5.0.1
93 * Section "patients" (Patients):
94 * ADD reminder Patient Reminders (Physicians,Clinicians(addonly))
95 * ADD alert Clinical Reminders/Alerts (Physicians,Clinicians,Front Office(view),Accounting(view))
96 * ADD disclosure Disclosures (Physicians,Clinicians(addonly))
97 * ADD rx Prescriptions (Physicians,Clinicians(addonly))
98 * ADD amendment Amendments (Physicians,Clinicians(addonly))
99 * ADD lab Lab Results (Physicians,Clinicians(addonly))
100 * ADD docs_rm Documents Delete (Administrators)
101 * Section "admin" (Administration):
102 * ADD multipledb Multipledb (Administrators)
103 * ADD menu Menu (Administrators)
104 * Section "groups" (Groups):
105 * ADD gadd View/Add/Update groups (Administrators)
106 * ADD gcalendar View/Create/Update groups appointment in calendar (Administrators,Physicians,Clinicians)
107 * ADD glog Group encounter log (Administrators,Physicians, Clinicians)
108 * ADD gdlog Group detailed log of appointment in patient record (Administrators)
109 * ADD gm Send message from the permanent group therapist to the personal therapist (Administrators)
110 * 5.0.2
111 * Section "patients" (Patients):
112 * ADD pat_rep Patient Report (Administrators)
113 * </pre>
115 * @package OpenEMR
116 * @link http://www.open-emr.org
117 * @author Brady Miller <brady.g.miller@gmail.com>
118 * @copyright Copyright (c) 2012-2017 Brady Miller <brady.g.miller@gmail.com>
119 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
122 // Checks if the server's PHP version is compatible with OpenEMR:
123 require_once(dirname(__FILE__) . "/src/Common/Compatibility/Checker.php");
124 $response = OpenEMR\Common\Compatibility\Checker::checkPhpVersion();
125 if ($response !== true) {
126 die(htmlspecialchars($response));
129 $ignoreAuth = true; // no login required
131 require_once('interface/globals.php');
133 use OpenEMR\Common\Acl\AclExtended;
135 $acl_version = AclExtended::getAclVersion();
136 if (empty($acl_version)) {
137 $acl_version = 0;
140 // Upgrade for acl_version 1
141 $upgrade_acl = 1;
142 if ($acl_version < $upgrade_acl) {
143 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
145 //Collect the ACL ID numbers.
146 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
147 //Get Administrator ACL ID number
148 $admin_write = AclExtended::getAclIdNumber('Administrators', 'write');
149 //Get Doctor ACL ID Number
150 $doc_write = AclExtended::getAclIdNumber('Physicians', 'write');
151 //Get Clinician ACL with write access ID number
152 $clin_write = AclExtended::getAclIdNumber('Clinicians', 'write');
153 //Get Clinician ACL with addonly access ID number
154 $clin_addonly = AclExtended::getAclIdNumber('Clinicians', 'addonly');
155 //Get Receptionist ACL ID number
156 $front_write = AclExtended::getAclIdNumber('Front Office', 'write');
157 //Get Accountant ACL ID number
158 $back_write = AclExtended::getAclIdNumber('Accounting', 'write');
160 //Add new object Sections
161 echo "<BR/><B>Adding new object sections</B><BR/>";
162 //Add 'Sensitivities' object section (added in 2.8.2)
163 AclExtended::addObjectSectionAcl('sensitivities', 'Sensitivities');
164 //Add 'Lists' object section (added in 3.0.2)
165 AclExtended::addObjectSectionAcl('lists', 'Lists');
166 //Add 'Placeholder' object section (added in 3.0.2)
167 AclExtended::addObjectSectionAcl('placeholder', 'Placeholder');
168 //Add 'Nation Notes' object section (added in 4.1.0)
169 AclExtended::addObjectSectionAcl('nationnotes', 'Nation Notes');
170 //Add 'Patient Portal' object section (added in 4.1.0)
171 AclExtended::addObjectSectionAcl('patientportal', 'Patient Portal');
173 //Add new Objects
174 echo "<BR/><B>Adding new objects</B><BR/>";
175 //Add 'Normal' sensitivity object, order variable is default 10 (added in 2.8.2)
176 AclExtended::addObjectAcl('sensitivities', 'Sensitivities', 'normal', 'Normal');
177 //Add 'High' sensitivity object, order variable is set to 20 (added in 2.8.2)
178 AclExtended::addObjectAclWithOrder('sensitivities', 'Sensitivities', 'high', 'High', 20);
179 //Add 'Pharmacy Dispensary' object (added in 2.8.4)
180 AclExtended::addObjectAcl('admin', 'Administration', 'drugs', 'Pharmacy Dispensary');
181 //Add 'ACL Administration' object (added in 2.8.4)
182 AclExtended::addObjectAcl('admin', 'Administration', 'acl', 'ACL Administration');
183 //Add 'Price Discounting' object (added in 2.8.4)
184 AclExtended::addObjectAcl('acct', 'Accounting', 'disc', 'Price Discounting');
185 //Add 'Default List (write,addonly optional)' object (added in 3.0.2)
186 AclExtended::addObjectAcl('lists', 'Lists', 'default', 'Default List (write,addonly optional)');
187 //Add 'State List (write,addonly optional)' object (added in 3.0.2)
188 AclExtended::addObjectAcl('lists', 'Lists', 'state', 'State List (write,addonly optional)');
189 //Add 'Country List (write,addonly optional)' object (added in 3.0.2)
190 AclExtended::addObjectAcl('lists', 'Lists', 'country', 'Country List (write,addonly optional)');
191 //Add 'Language List (write,addonly optional)' object (added in 3.0.2)
192 AclExtended::addObjectAcl('lists', 'Lists', 'language', 'Language List (write,addonly optional)');
193 //Add 'Ethnicity-Race List (write,addonly optional)' object (added in 3.0.2)
194 AclExtended::addObjectAcl('lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)');
195 //Add 'Placeholder (Maintains empty ACLs)' object (added in 3.0.2)
196 AclExtended::addObjectAcl('placeholder', 'Placeholder', 'filler', 'Placeholder (Maintains empty ACLs)');
197 //Add 'Sign Lab Results (write,addonly optional)' object (added in 3.3.0)
198 AclExtended::addObjectAcl('patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)');
199 //Add 'nationnotes' object (added in 4.1.0)
200 AclExtended::addObjectAcl('nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure');
201 //Add 'patientportal' object (added in 4.1.0)
202 AclExtended::addObjectAcl('patientportal', 'Patient Portal', 'portal', 'Patient Portal');
204 //Update already existing Objects
205 echo "<BR/><B>Upgrading objects</B><BR/>";
206 //Ensure that 'High' sensitivity object order variable is set to 20
207 AclExtended::editObjectAcl('sensitivities', 'Sensitivities', 'high', 'High', 20);
209 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
210 // (will also place in the appropriate group and CREATE a new group if needed)
211 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
212 //Add 'Physicians' ACL with 'addonly' and collect the ID number (added in 3.0.2)
213 $doc_addonly = AclExtended::addNewACL('Physicians', 'doc', 'addonly', 'Things that physicians can read and enter but not modify');
214 //Add 'Front Office' ACL with 'addonly' and collect the ID number (added in 3.0.2)
215 $front_addonly = AclExtended::addNewACL('Front Office', 'front', 'addonly', 'Things that front office can read and enter but not modify');
216 //Add 'Accounting' ACL with 'addonly' and collect the ID number (added in 3.0.2)
217 $back_addonly = AclExtended::addNewACL('Accounting', 'back', 'addonly', 'Things that back office can read and enter but not modify');
218 //Add 'Emergency Login' ACL with 'write' and collect the ID number (added in 3.3.0)
219 $emergency_write = AclExtended::addNewACL('Emergency Login', 'breakglass', 'write', 'Things that can use for emergency login, can read and modify');
221 //Update the ACLs
222 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
223 //Insert the 'super' object from the 'admin' section into the Administrators group write ACL (added in 2.8.2)
224 AclExtended::updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'super', 'Superuser', 'write');
225 //Insert the 'high' object from the 'sensitivities' section into the Administrators group write ACL (added in 2.8.2)
226 AclExtended::updateAcl($admin_write, 'Administrators', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
227 //Insert the 'normal' object from the 'sensitivities' section into the Administrators group write ACL (added in 2.8.2)
228 AclExtended::updateAcl($admin_write, 'Administrators', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
229 //Insert the 'high' object from the 'sensitivities' section into the Physicians group write ACL (added in 2.8.2)
230 AclExtended::updateAcl($doc_write, 'Physicians', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
231 //Insert the 'normal' object from the 'sensitivities' section into the Physicians group write ACL (added in 2.8.2)
232 AclExtended::updateAcl($doc_write, 'Physicians', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
233 //Insert the 'normal' object from the 'sensitivities' section into the Clinicians group addonly ACL (added in 2.8.2)
234 AclExtended::updateAcl($clin_addonly, 'Clinicians', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'addonly');
235 //Insert the 'drugs' object from the 'admin' section into the Administrators group write ACL (added in 2.8.4)
236 AclExtended::updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
237 //Insert the 'drugs' object from the 'admin' section into the Physicians group write ACL (added in 2.8.4)
238 AclExtended::updateAcl($doc_write, 'Physicians', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
239 //Insert the 'drugs' object from the 'admin' section into the Clinicians group write ACL (added in 2.8.4)
240 AclExtended::updateAcl($clin_write, 'Clinicians', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
241 //Insert the 'acl' object from the 'admin' section into the Administrators group write ACL (added in 2.8.4)
242 AclExtended::updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'acl', 'ACL Administration', 'write');
243 //Insert the 'disc' object from the 'acct' section into the Administrators group write ACL (added in 2.8.4)
244 AclExtended::updateAcl($admin_write, 'Administrators', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
245 //Insert the 'disc' object from the 'acct' section into the Accounting group write ACL (added in 2.8.4)
246 AclExtended::updateAcl($back_write, 'Accounting', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
247 //Insert the 'disc' object from the 'acct' section into the Physicians group write ACL (added in 2.8.4)
248 AclExtended::updateAcl($doc_write, 'Physicians', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
249 //Insert the 'default' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
250 AclExtended::updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'default', 'Default List (write,addonly optional)', 'write');
251 //Insert the 'state' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
252 AclExtended::updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'state', 'State List (write,addonly optional)', 'write');
253 //Insert the 'country' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
254 AclExtended::updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'country', 'Country List (write,addonly optional)', 'write');
255 //Insert the 'language' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
256 AclExtended::updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'language', 'Language List (write,addonly optional)', 'write');
257 //Insert the 'race' object from the 'lists' section into the Administrators group write ACL (added in 3.0.2)
258 AclExtended::updateAcl($admin_write, 'Administrators', 'lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)', 'write');
259 //Update ACLs for Emergency Login
260 //Insert the 'disc' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
261 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'disc', 'Price Discounting', 'write');
262 //Insert the 'bill' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
263 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'bill', 'Billing (write optional)', 'write');
264 //Insert the 'eob' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
265 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'eob', 'EOB Data Entry', 'write');
266 //Insert the 'rep' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
267 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'rep', 'Financial Reporting - my encounters', 'write');
268 //Insert the 'rep_a' object from the 'acct' section into the Emergency Login group write ACL (added in 3.3.0)
269 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'acct', 'Accounting', 'rep_a', 'Financial Reporting - anything', 'write');
270 //Insert the 'calendar' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
271 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'calendar', 'Calendar Settings', 'write');
272 //Insert the 'database' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
273 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'database', 'Database Reporting', 'write');
274 //Insert the 'forms' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
275 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'forms', 'Forms Administration', 'write');
276 //Insert the 'practice' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
277 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'practice', 'Practice Settings', 'write');
278 //Insert the 'superbill' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
279 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'superbill', 'Superbill Codes Administration', 'write');
280 //Insert the 'users' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
281 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'users', 'Users/Groups/Logs Administration', 'write');
282 //Insert the 'batchcom' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
283 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'batchcom', 'Batch Communication Tool', 'write');
284 //Insert the 'language' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
285 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'language', 'Language Interface Tool', 'write');
286 //Insert the 'super' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
287 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'super', 'Superuser', 'write');
288 //Insert the 'drugs' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
289 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'drugs', 'Pharmacy Dispensary', 'write');
290 //Insert the 'acl' object from the 'admin' section into the Emergency Login group write ACL (added in 3.3.0)
291 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'acl', 'ACL Administration', 'write');
292 //Insert the 'auth_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
293 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'auth_a', 'Authorize - any encounters', 'write');
294 //Insert the 'coding_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
295 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'coding_a', 'Coding - any encounters (write,wsome optional)', 'write');
296 //Insert the 'notes_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
297 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'notes_a', 'Notes - any encounters (write,addonly optional)', 'write');
298 //Insert the 'date_a' object from the 'encounters' section into the Emergency Login group write ACL (added in 3.3.0)
299 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'date_a', 'Fix encounter dates - any encounters', 'write');
300 //Insert the 'default' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
301 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'default', 'Default List (write,addonly optional)', 'write');
302 //Insert the 'state' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
303 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'state', 'State List (write,addonly optional)', 'write');
304 //Insert the 'country' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
305 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'country', 'Country List (write,addonly optional)', 'write');
306 //Insert the 'language' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
307 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'language', 'Language List (write,addonly optional)', 'write');
308 //Insert the 'ethrace' object from the 'lists' section into the Emergency Login group write ACL (added in 3.3.0)
309 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'lists', 'Lists', 'ethrace', 'Ethnicity-Race List (write,addonly optional)', 'write');
310 //Insert the 'appt' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
311 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'appt', 'Appointments (write,wsome optional)', 'write');
312 //Insert the 'demo' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
313 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'demo', 'Demographics (write,addonly optional)', 'write');
314 //Insert the 'med' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
315 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'med', 'Medical/History (write,addonly optional)', 'write');
316 //Insert the 'trans' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
317 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'trans', 'Transactions (write optional)', 'write');
318 //Insert the 'docs' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
319 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'docs', 'Documents (write,addonly optional)', 'write');
320 //Insert the 'notes' object from the 'patients' section into the Emergency Login group write ACL (added in 3.3.0)
321 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'notes', 'Patient Notes (write,addonly optional)', 'write');
322 //Insert the 'high' object from the 'sensitivities' section into the Emergency Login group write ACL (added in 3.3.0)
323 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'sensitivities', 'Sensitivities', 'high', 'High', 'write');
324 //Insert the 'normal' object from the 'sensitivities' section into the Emergency Login group write ACL (added in 3.3.0)
325 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'sensitivities', 'Sensitivities', 'normal', 'Normal', 'write');
326 //Insert the 'sign' object from the 'patients' section into the Physicians group write ACL (added in 3.3.0)
327 AclExtended::updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)', 'write');
328 //Insert the 'sign' object from the 'nationnotes' section into the Administrators group write ACL (added in 3.3.0)
329 AclExtended::updateAcl($admin_write, 'Administrators', 'nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure', 'write');
330 //Insert the 'sign' object from the 'nationnotes' section into the Emergency Login group write ACL (added in 3.3.0)
331 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'nationnotes', 'Nation Notes', 'nn_configure', 'Nation Notes Configure', 'write');
332 //Insert the 'patientportal' object from the 'patientportal' section into the Administrators group write ACL (added in 4.1.0)
333 AclExtended::updateAcl($admin_write, 'Administrators', 'patientportal', 'Patient Portal', 'portal', 'Patient Portal', 'write');
334 //Insert the 'patientportal' object from the 'patientportal' section into the Emergency Login group write ACL (added in 4.1.0)
335 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patientportal', 'Patient Portal', 'portal', 'Patient Portal', 'write');
337 //DONE with upgrading to this version
338 $acl_version = $upgrade_acl;
341 // Upgrade for acl_version 2
342 $upgrade_acl = 2;
343 if ($acl_version < $upgrade_acl) {
344 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
346 //Collect the ACL ID numbers.
347 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
349 //Add new object Sections
350 echo "<BR/><B>Adding new object sections</B><BR/>";
352 //Add new Objects
353 echo "<BR/><B>Adding new objects</B><BR/>";
355 //Update already existing Objects
356 echo "<BR/><B>Upgrading objects</B><BR/>";
358 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
359 // (will also place in the appropriate group and CREATE a new group if needed)
360 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
361 AclExtended::addNewACL('Physicians', 'doc', 'wsome', 'Things that physicians can read and partly modify');
362 AclExtended::addNewACL('Clinicians', 'clin', 'wsome', 'Things that clinicians can read and partly modify');
363 AclExtended::addNewACL('Front Office', 'front', 'wsome', 'Things that front office can read and partly modify');
364 AclExtended::addNewACL('Accounting', 'back', 'wsome', 'Things that back office can read and partly modify');
365 AclExtended::addNewACL('Physicians', 'doc', 'view', 'Things that physicians can only read');
366 AclExtended::addNewACL('Clinicians', 'clin', 'view', 'Things that clinicians can only read');
367 AclExtended::addNewACL('Front Office', 'front', 'view', 'Things that front office can only read');
368 AclExtended::addNewACL('Accounting', 'back', 'view', 'Things that back office can only read');
370 //Update the ACLs
371 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
373 //DONE with upgrading to this version
374 $acl_version = $upgrade_acl;
377 // Upgrade for acl_version 3
378 $upgrade_acl = 3;
379 if ($acl_version < $upgrade_acl) {
380 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
382 //Collect the ACL ID numbers.
383 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
384 //Get Administrator ACL ID number
385 $admin_write = AclExtended::getAclIdNumber('Administrators', 'write');
386 //Get Emergency ACL ID number
387 $emergency_write = AclExtended::getAclIdNumber('Emergency Login', 'write');
389 //Add new object Sections
390 echo "<BR/><B>Adding new object sections</B><BR/>";
391 //Add 'Menus' object section (added in 4.1.3)
392 AclExtended::addObjectSectionAcl('menus', 'Menus');
394 //Add new Objects
395 echo "<BR/><B>Adding new objects</B><BR/>";
396 //Add 'modules' object (added in 4.1.3)
397 AclExtended::addObjectAcl('menus', 'Menus', 'modle', 'Modules');
399 //Update already existing Objects
400 echo "<BR/><B>Upgrading objects</B><BR/>";
402 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
403 // (will also place in the appropriate group and CREATE a new group if needed)
404 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
406 //Update the ACLs
407 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
408 //Insert the 'Modules' object from the 'Menus' section into the Administrators group write ACL (added in 4.1.3)
409 AclExtended::updateAcl($admin_write, 'Administrators', 'menus', 'Menus', 'modle', 'Modules', 'write');
410 //Insert the 'Modules' object from the 'Menus' section into the Emergency Login group write ACL (added in 4.1.3)
411 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'menus', 'Menus', 'modle', 'Modules', 'write');
413 //DONE with upgrading to this version
414 $acl_version = $upgrade_acl;
417 // Upgrade for acl_version 4
418 $upgrade_acl = 4;
419 if ($acl_version < $upgrade_acl) {
420 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
422 //Collect the ACL ID numbers.
423 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
424 //Get Administrator ACL ID number
425 $admin_write = AclExtended::getAclIdNumber('Administrators', 'write');
426 //Get Doctor ACL ID Number
427 $doc_write = AclExtended::getAclIdNumber('Physicians', 'write');
428 //Get Clinician ACL with write access ID number
429 $clin_write = AclExtended::getAclIdNumber('Clinicians', 'write');
430 //Get Clinician ACL with addonly access ID number
431 $clin_addonly = AclExtended::getAclIdNumber('Clinicians', 'addonly');
432 //Get Receptionist ACL ID number
433 $front_write = AclExtended::getAclIdNumber('Front Office', 'write');
434 //Get Accountant ACL ID number
435 $back_write = AclExtended::getAclIdNumber('Accounting', 'write');
437 //Add new object Sections
438 // echo "<BR/><B>Adding new object sections</B><BR/>";
440 //Add new Objects
441 echo "<BR/><B>Adding new objects</B><BR/>";
442 // Add 'Patient Reminders (write,addonly optional)' object (added in 5.0.1)
443 AclExtended::addObjectAcl('patients', 'Patients', 'reminder', 'Patient Reminders (write,addonly optional)');
444 // Add 'Clinical Reminders/Alerts (write,addonly optional)' object (added in 5.0.1)
445 AclExtended::addObjectAcl('patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)');
446 // Add 'Disclosures (write,addonly optional)' object (added in 5.0.1)
447 AclExtended::addObjectAcl('patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)');
448 // Add 'Prescriptions (write,addonly optional)' object (added in 5.0.1)
449 AclExtended::addObjectAcl('patients', 'Patients', 'rx', 'Prescriptions (write,addonly optional)');
450 // Add 'Amendments (write,addonly optional)' object (added in 5.0.1)
451 AclExtended::addObjectAcl('patients', 'Patients', 'amendment', 'Amendments (write,addonly optional)');
452 // Add 'Lab Results (write,addonly optional)' object (added in 5.0.1)
453 AclExtended::addObjectAcl('patients', 'Patients', 'lab', 'Lab Results (write,addonly optional)');
455 //Update already existing Objects
456 // echo "<BR/><B>Upgrading objects</B><BR/>";
458 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
459 // (will also place in the appropriate group and CREATE a new group if needed)
460 // echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
462 //Update the ACLs
463 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
464 //Insert the 'reminder' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
465 AclExtended::updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'reminder', 'Patient Reminders (write,addonly optional)', 'write');
466 //Insert the 'alert' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
467 AclExtended::updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'write');
468 //Insert the 'disclosure' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
469 AclExtended::updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)', 'write');
470 //Insert the 'rx' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
471 AclExtended::updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'rx', 'Prescriptions (write,addonly optional)', 'write');
472 //Insert the 'amendment' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
473 AclExtended::updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'amendment', 'Amendments (write,addonly optional)', 'write');
474 //Insert the 'lab' object from the 'patients' section into the Physicians group write ACL (added in 5.0.1)
475 AclExtended::updateAcl($doc_write, 'Physicians', 'patients', 'Patients', 'lab', 'Lab Results (write,addonly optional)', 'write');
476 //DONE with upgrading to this version
477 $acl_version = $upgrade_acl;
480 //This is a template for a new revision, when needed
481 // Upgrade for acl_version 5
482 $upgrade_acl = 5;
483 if ($acl_version < $upgrade_acl) {
484 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
486 //Collect the ACL ID numbers.
487 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
488 //Get Accountant ACL ID number
489 $admin_write = AclExtended::getAclIdNumber('Administrators', 'write');
492 //Add new object Sections
493 echo "<BR/><B>Adding new object sections</B><BR/>";
494 // Add 'Groups' object (added in 5.0.1)
495 AclExtended::addObjectSectionAcl('groups', 'Groups');
498 //Add new Objects
499 echo "<BR/><B>Adding new objects</B><BR/>";
500 // Add 'Multipledb' object (added in 5.0.1)
501 AclExtended::addObjectAcl('admin', 'Administration', 'multipledb', 'Multipledb');
502 AclExtended::addObjectAcl('groups', 'Groups', 'gadd', 'View/Add/Update groups');
503 AclExtended::addObjectAcl('groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar');
504 AclExtended::addObjectAcl('groups', 'Groups', 'glog', 'Group encounter log');
505 AclExtended::addObjectAcl('groups', 'Groups', 'gdlog', 'Group detailed log of appointment in patient record');
506 AclExtended::addObjectAcl('groups', 'Groups', 'gm', 'Send message from the permanent group therapist to the personal therapist');
507 //Update already existing Objects
508 echo "<BR/><B>Upgrading objects</B><BR/>";
510 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
511 // (will also place in the appropriate group and CREATE a new group if needed)
512 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
514 //Update the ACLs
515 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
516 AclExtended::updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'gadd', 'View/Add/Update groups', 'write');
517 AclExtended::updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar', 'write');
518 AclExtended::updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'glog', 'Group encounter log', 'write');
519 AclExtended::updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'gdlog', 'Group detailed log of appointment in patient record', 'write');
520 AclExtended::updateAcl($admin_write, 'Administrators', 'groups', 'Groups', 'gm', 'Send message from the permanent group therapist to the personal therapist', 'write');
521 //Insert the 'Multipledb' object from the 'admin' section into the Administrators group write ACL (added in 5.0.1)
522 AclExtended::updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'multipledb', 'Multipledb', 'write');
523 //DONE with upgrading to this version
524 $acl_version = $upgrade_acl;
527 // Upgrade for acl_version 6
528 $upgrade_acl = 6;
529 if ($acl_version < $upgrade_acl) {
530 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
532 //Collect the ACL ID numbers.
533 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
534 $admin_write = AclExtended::getAclIdNumber('Administrators', 'write');
535 $doc_write = AclExtended::getAclIdNumber('Physicians', 'write');
536 $clin_addonly = AclExtended::getAclIdNumber('Clinicians', 'addonly');
537 $clin_write = AclExtended::getAclIdNumber('Clinicians', 'write');
538 $front_view = AclExtended::getAclIdNumber('Front Office', 'view');
539 $front_write = AclExtended::getAclIdNumber('Front Office', 'write');
540 $back_view = AclExtended::getAclIdNumber('Accounting', 'view');
541 $emergency_write = AclExtended::getAclIdNumber('Emergency Login', 'write');
543 //Add new object Sections
544 echo "<BR/><B>Adding new object sections</B><BR/>";
545 AclExtended::addObjectAcl('admin', 'Administration', 'menu', 'Menu');
547 //Add new Objects
548 echo "<BR/><B>Adding new objects</B><BR/>";
550 //Update already existing Objects
551 echo "<BR/><B>Upgrading objects</B><BR/>";
553 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
554 // (will also place in the appropriate group and CREATE a new group if needed)
555 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
557 //Update the ACLs
558 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
559 AclExtended::updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'menu', 'Menu', 'write');
561 AclExtended::updateAcl($admin_write, 'Administrators', 'encounters', 'Encounters', 'auth', 'Authorize - my encounters', 'write');
562 AclExtended::updateAcl($admin_write, 'Administrators', 'encounters', 'Encounters', 'coding', 'Coding - my encounters (write,wsome optional)', 'write');
563 AclExtended::updateAcl($admin_write, 'Administrators', 'encounters', 'Encounters', 'notes', 'Notes - my encounters (write,addonly optional)', 'write');
564 AclExtended::updateAcl($admin_write, 'Administrators', 'encounters', 'Encounters', 'relaxed', 'Less-private information (write,addonly optional)', 'write');
566 AclExtended::updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)', 'write');
567 AclExtended::updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'reminder', 'Patient Reminders (write,addonly optional)', 'write');
568 AclExtended::updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'write');
569 AclExtended::updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)', 'write');
570 AclExtended::updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'rx', 'Prescriptions (write,addonly optional)', 'write');
571 AclExtended::updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'amendment', 'Amendments (write,addonly optional)', 'write');
572 AclExtended::updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'lab', 'Lab Results (write,addonly optional)', 'write');
574 AclExtended::updateAcl($doc_write, 'Physicians', 'encounters', 'Encounters', 'auth', 'Authorize - my encounters', 'write');
575 AclExtended::updateAcl($doc_write, 'Physicians', 'encounters', 'Encounters', 'coding', 'Coding - my encounters (write,wsome optional)', 'write');
576 AclExtended::updateAcl($doc_write, 'Physicians', 'encounters', 'Encounters', 'notes', 'Notes - my encounters (write,addonly optional)', 'write');
577 AclExtended::updateAcl($doc_write, 'Physicians', 'encounters', 'Encounters', 'relaxed', 'Less-private information (write,addonly optional)', 'write');
579 AclExtended::updateAcl($doc_write, 'Physicians', 'groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar', 'write');
580 AclExtended::updateAcl($doc_write, 'Physicians', 'groups', 'Groups', 'glog', 'Group encounter log', 'write');
582 AclExtended::updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'trans', 'Transactions (write optional)', 'addonly');
583 AclExtended::updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'reminder', 'Patient Reminders (write,addonly optional)', 'addonly');
584 AclExtended::updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'addonly');
585 AclExtended::updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)', 'addonly');
586 AclExtended::updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'rx', 'Prescriptions (write,addonly optional)', 'addonly');
587 AclExtended::updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'amendment', 'Amendments (write,addonly optional)', 'addonly');
588 AclExtended::updateAcl($clin_addonly, 'Clinicians', 'patients', 'Patients', 'lab', 'Lab Results (write,addonly optional)', 'addonly');
590 AclExtended::updateAcl($clin_write, 'Clinicians', 'groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar', 'write');
591 AclExtended::updateAcl($clin_write, 'Clinicians', 'groups', 'Groups', 'glog', 'Group encounter log', 'write');
593 AclExtended::updateAcl($front_view, 'Front Office', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'view');
595 AclExtended::updateAcl($front_write, 'Front Office', 'groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar', 'write');
597 AclExtended::updateAcl($back_view, 'Accounting', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'view');
599 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'multipledb', 'Multipledb', 'write');
600 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'menu', 'Menu', 'write');
601 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'auth', 'Authorize - my encounters', 'write');
602 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'coding', 'Coding - my encounters (write,wsome optional)', 'write');
603 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'notes', 'Notes - my encounters (write,addonly optional)', 'write');
604 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'encounters', 'Encounters', 'relaxed', 'Less-private information (write,addonly optional)', 'write');
605 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'sign', 'Sign Lab Results (write,addonly optional)', 'write');
606 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'reminder', 'Patient Reminders (write,addonly optional)', 'write');
607 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'alert', 'Clinical Reminders/Alerts (write,addonly optional)', 'write');
608 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'disclosure', 'Disclosures (write,addonly optional)', 'write');
609 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'rx', 'Prescriptions (write,addonly optional)', 'write');
610 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'amendment', 'Amendments (write,addonly optional)', 'write');
611 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'lab', 'Lab Results (write,addonly optional)', 'write');
612 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'groups', 'Groups', 'gadd', 'View/Add/Update groups', 'write');
613 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'groups', 'Groups', 'gcalendar', 'View/Create/Update groups appointment in calendar', 'write');
614 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'groups', 'Groups', 'glog', 'Group encounter log', 'write');
615 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'groups', 'Groups', 'gdlog', 'Group detailed log of appointment in patient record', 'write');
616 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'groups', 'Groups', 'gm', 'Send message from the permanent group therapist to the personal therapist', 'write');
618 //DONE with upgrading to this version
619 $acl_version = $upgrade_acl;
623 // Upgrade for acl_version 7
624 $upgrade_acl = 7;
625 if ($acl_version < $upgrade_acl) {
626 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
628 //Collect the ACL ID numbers.
629 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
630 $admin_write = AclExtended::getAclIdNumber('Administrators', 'write');
631 $emergency_write = AclExtended::getAclIdNumber('Emergency Login', 'write');
633 //Add new object Sections
634 echo "<BR/><B>Adding new object sections</B><BR/>";
635 AclExtended::addObjectAcl('admin', 'Administration', 'manage_modules', 'Manage modules');
637 //Add new Objects
638 echo "<BR/><B>Adding new objects</B><BR/>";
640 //Update already existing Objects
641 echo "<BR/><B>Upgrading objects</B><BR/>";
643 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
644 // (will also place in the appropriate group and CREATE a new group if needed)
645 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
646 AclExtended::updateAcl($admin_write, 'Administrators', 'admin', 'Administration', 'manage_modules', 'Manage modules', 'write');
647 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'admin', 'Administration', 'manage_modules', 'Manage modules', 'write');
649 //Update the ACLs
650 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
652 //DONE with upgrading to this version
653 $acl_version = $upgrade_acl;
656 // Upgrade for acl_version 8
657 $upgrade_acl = 8;
658 if ($acl_version < $upgrade_acl) {
659 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
661 //Collect the ACL ID numbers.
662 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
663 $admin_write = AclExtended::getAclIdNumber('Administrators', 'write');
664 $emergency_write = AclExtended::getAclIdNumber('Emergency Login', 'write');
666 //Add new object Sections
667 echo "<BR/><B>Adding new object sections</B><BR/>";
668 AclExtended::addObjectAcl('patients', 'Patients', 'docs_rm', 'Documents Delete');
670 //Add new Objects
671 echo "<BR/><B>Adding new objects</B><BR/>";
673 //Update already existing Objects
674 echo "<BR/><B>Upgrading objects</B><BR/>";
676 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
677 // (will also place in the appropriate group and CREATE a new group if needed)
678 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
679 AclExtended::updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'docs_rm', 'Documents Delete', 'write');
680 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'docs_rm', 'Documents Delete', 'write');
683 //Update the ACLs
684 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
686 //DONE with upgrading to this version
687 $acl_version = $upgrade_acl;
690 // Upgrade for acl_version 9
691 $upgrade_acl = 9;
692 if ($acl_version < $upgrade_acl) {
693 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
695 //Collect the ACL ID numbers.
696 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
697 $admin_write = AclExtended::getAclIdNumber('Administrators', 'write');
698 $accounting_view = AclExtended::getAclIdNumber('Accounting', 'view');
699 $clinicians_view = AclExtended::getAclIdNumber('Clinicians', 'view');
700 $emergency_write = AclExtended::getAclIdNumber('Emergency Login', 'write');
701 $frontoffice_view = AclExtended::getAclIdNumber('Front Office', 'view');
702 $physicians_view = AclExtended::getAclIdNumber('Physicians', 'view');
704 //Add new object Sections
705 echo "<BR/><B>Adding new object sections</B><BR/>";
707 //Add new Objects
708 echo "<BR/><B>Adding new objects</B><BR/>";
709 AclExtended::addObjectAcl('patients', 'Patients', 'pat_rep', 'Patient Report');
711 //Update already existing Objects
712 echo "<BR/><B>Upgrading objects</B><BR/>";
714 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
715 // (will also place in the appropriate group and CREATE a new group if needed)
716 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
717 AclExtended::updateAcl($admin_write, 'Administrators', 'patients', 'Patients', 'pat_rep', 'Patient Report', 'write');
718 AclExtended::updateAcl($accounting_view, 'Accounting', 'patients', 'Patients', 'pat_rep', 'Patient Report', 'view');
719 AclExtended::updateAcl($clinicians_view, 'Clinicians', 'patients', 'Patients', 'pat_rep', 'Patient Report', 'view');
720 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'patients', 'Patients', 'pat_rep', 'Patient Report', 'write');
721 AclExtended::updateAcl($frontoffice_view, 'Front Office', 'patients', 'Patients', 'pat_rep', 'Patient Report', 'view');
722 AclExtended::updateAcl($physicians_view, 'Physicians', 'patients', 'Patients', 'pat_rep', 'Patient Report', 'view');
724 //Update the ACLs
725 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
727 //DONE with upgrading to this version
728 $acl_version = $upgrade_acl;
731 // Upgrade for acl_version 10
732 $upgrade_acl = 10;
733 if ($acl_version < $upgrade_acl) {
734 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
736 //Collect the ACL ID numbers.
737 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
738 $admin_write = AclExtended::getAclIdNumber('Administrators', 'write');
739 $emergency_write = AclExtended::getAclIdNumber('Emergency Login', 'write');
741 //Add new object Sections
742 echo "<BR/><B>Adding new object sections</B><BR/>";
743 AclExtended::addObjectSectionAcl('inventory', 'Inventory');
745 //Add new Objects
746 echo "<BR/><B>Adding new objects</B><BR/>";
747 AclExtended::addObjectAcl('inventory', 'Inventory', 'lots', 'Lots');
748 AclExtended::addObjectAcl('inventory', 'Inventory', 'sales', 'Sales');
749 AclExtended::addObjectAcl('inventory', 'Inventory', 'purchases', 'Purchases');
750 AclExtended::addObjectAcl('inventory', 'Inventory', 'transfers', 'Transfers');
751 AclExtended::addObjectAcl('inventory', 'Inventory', 'adjustments', 'Adjustments');
752 AclExtended::addObjectAcl('inventory', 'Inventory', 'consumption', 'Consumption');
753 AclExtended::addObjectAcl('inventory', 'Inventory', 'destruction', 'Destruction');
754 AclExtended::addObjectAcl('inventory', 'Inventory', 'reporting', 'Reporting');
756 //Update already existing Objects
757 echo "<BR/><B>Upgrading objects</B><BR/>";
758 //Rename "Pharmacy Dispensary" to "Inventory Administration".
759 AclExtended::editObjectAcl('admin', 'Administration', 'drugs', 'Inventory Administration', 10);
761 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
762 // (will also place in the appropriate group and CREATE a new group if needed)
763 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
765 //Update the ACLs
766 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
767 AclExtended::updateAcl($admin_write, 'Administrators', 'inventory', 'Inventory', 'lots', 'Lots', 'write');
768 AclExtended::updateAcl($admin_write, 'Administrators', 'inventory', 'Inventory', 'sales', 'Sales', 'write');
769 AclExtended::updateAcl($admin_write, 'Administrators', 'inventory', 'Inventory', 'purchases', 'Purchases', 'write');
770 AclExtended::updateAcl($admin_write, 'Administrators', 'inventory', 'Inventory', 'transfers', 'Transfers', 'write');
771 AclExtended::updateAcl($admin_write, 'Administrators', 'inventory', 'Inventory', 'adjustments', 'Adjustments', 'write');
772 AclExtended::updateAcl($admin_write, 'Administrators', 'inventory', 'Inventory', 'consumption', 'Consumption', 'write');
773 AclExtended::updateAcl($admin_write, 'Administrators', 'inventory', 'Inventory', 'destruction', 'Destruction', 'write');
774 AclExtended::updateAcl($admin_write, 'Administrators', 'inventory', 'Inventory', 'reporting', 'Reporting', 'write');
775 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'inventory', 'Inventory', 'lots', 'Lots', 'write');
776 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'inventory', 'Inventory', 'sales', 'Sales', 'write');
777 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'inventory', 'Inventory', 'purchases', 'Purchases', 'write');
778 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'inventory', 'Inventory', 'transfers', 'Transfers', 'write');
779 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'inventory', 'Inventory', 'adjustments', 'Adjustments', 'write');
780 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'inventory', 'Inventory', 'consumption', 'Consumption', 'write');
781 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'inventory', 'Inventory', 'destruction', 'Destruction', 'write');
782 AclExtended::updateAcl($emergency_write, 'Emergency Login', 'inventory', 'Inventory', 'reporting', 'Reporting', 'write');
784 //DONE with upgrading to this version
785 $acl_version = $upgrade_acl;
788 // Upgrade for acl_version 11
789 $upgrade_acl = 11;
790 if ($acl_version < $upgrade_acl) {
791 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
793 //Collect the ACL ID numbers.
794 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
795 $clin_write = AclExtended::getAclIdNumber('Clinicians', 'write');
797 //Add new object Sections
798 echo "<BR/><B>Adding new object sections</B><BR/>";
800 //Add new Objects
801 echo "<BR/><B>Adding new objects</B><BR/>";
803 //Update already existing Objects
804 echo "<BR/><B>Upgrading objects</B><BR/>";
806 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
807 // (will also place in the appropriate group and CREATE a new group if needed)
808 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
810 //Update the ACLs
811 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
812 AclExtended::updateAcl($clin_write, 'Clinicians', 'encounters', 'Encounters', 'auth', 'Authorize - my encounters', 'write');
813 AclExtended::updateAcl($clin_write, 'Clinicians', 'encounters', 'Encounters', 'notes', 'Notes - my encounters (write,addonly optional)', 'write');
815 //DONE with upgrading to this version
816 $acl_version = $upgrade_acl;
819 // Upgrade for acl_version 12
820 $upgrade_acl = 12;
821 if ($acl_version < $upgrade_acl) {
822 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
824 //Collect the ACL ID numbers.
825 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
826 $accounting_view = AclExtended::getAclIdNumber('Accounting', 'view');
827 $frontoffice_view = AclExtended::getAclIdNumber('Front Office', 'view');
828 $frontoffice_write = AclExtended::getAclIdNumber('Front Office', 'write');
830 //Add new object Sections
831 echo "<BR/><B>Adding new object sections</B><BR/>";
833 //Add new Objects
834 echo "<BR/><B>Adding new objects</B><BR/>";
836 //Update already existing Objects
837 echo "<BR/><B>Upgrading objects</B><BR/>";
839 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
840 // (will also place in the appropriate group and CREATE a new group if needed)
841 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
843 //Update the ACLs
844 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
845 AclExtended::shiftAcl($accounting_view, 'Accounting', 'patients', 'Patients', 'pat_rep', 'Patient Report', 'view');
846 AclExtended::shiftAcl($frontoffice_view, 'Front Office', 'patients', 'Patients', 'pat_rep', 'Patient Report', 'view');
847 AclExtended::shiftAcl($frontoffice_write, 'Front Office', 'patients', 'Patients', 'trans', 'Transactions (write,wsome optional)', 'write');
848 AclExtended::shiftAcl($frontoffice_write, 'Front Office', 'patients', 'Patients', 'notes', 'Patient Notes (write,wsome optional)', 'write');
851 //DONE with upgrading to this version
852 $acl_version = $upgrade_acl;
855 /* This is a template for a new revision, when needed
856 // Upgrade for acl_version 13
857 $upgrade_acl = 13;
858 if ($acl_version < $upgrade_acl) {
859 echo "<B>UPGRADING ACCESS CONTROLS TO VERSION " . $upgrade_acl . ":</B></BR>";
861 //Collect the ACL ID numbers.
862 echo "<B>Checking to ensure all the proper ACL(access control list) are present:</B></BR>";
864 //Add new object Sections
865 echo "<BR/><B>Adding new object sections</B><BR/>";
867 //Add new Objects
868 echo "<BR/><B>Adding new objects</B><BR/>";
870 //Update already existing Objects
871 echo "<BR/><B>Upgrading objects</B><BR/>";
873 //Add new ACLs here (will return the ACL ID of newly created or already existant ACL)
874 // (will also place in the appropriate group and CREATE a new group if needed)
875 echo "<BR/><B>Adding ACLs(Access Control Lists) and groups</B><BR/>";
877 //Update the ACLs
878 echo "<BR/><B>Updating the ACLs(Access Control Lists)</B><BR/>";
880 //DONE with upgrading to this version
881 $acl_version = $upgrade_acl;
885 //All done
886 AclExtended::setAclVersion($acl_version);
887 echo "DONE upgrading access controls";