Partial changes for new access control system.
[fa-stable.git] / includes / access_levels.inc
1 <?php
2 /**********************************************************************
3     Copyright (C) FrontAccounting, LLC.
4         Released under the terms of the GNU General Public License, GPL, 
5         as published by the Free Software Foundation, either version 3 
6         of the License, or (at your option) any later version.
7     This program is distributed in the hope that it will be useful,
8     but WITHOUT ANY WARRANTY; without even the implied warranty of
9     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
10     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
11 ***********************************************************************/
12 //
13 /*
14         This table is introduced only for additional grouping of sales areas,
15         and should be consistent with convention used above.
16 */
17
18 define('SM_SALES', 1<<8);
19 define('SM_PURCH', 2<<8);
20 define('SM_ITEMS', 3<<8);
21 define('SM_MANUF', 4<<8);
22 define('SM_DIM', 5<<8);
23 define('SM_GL', 6<<8);
24 define('SM_SETUP', 7<<8);
25
26 $security_modules = array(
27  SM_SALES => _("Sales"),
28  SM_PURCH => _("Purchases"),
29  SM_ITEMS => _("Items and Inventory"),
30  SM_MANUF => _("Manufacturing"),
31  SM_DIM => _("Dimensions"),
32  SM_GL => _("Banking & General Ledger"),
33  SM_SETUP => _("Setup")
34 );
35
36 //      Access areas used in FrontAccounting. 
37 //      Constants defined below should be used wherever access rights for current
38 //      user are checked. Set of allowed access areas is retrieved during login from
39 //      security_roles table using role granted to user as a key, and stored 
40 //      in user profile for use during login session.
41 //      
42 //----------------------------------------------------------------------------------
43 // Sales module
44 //
45 define('SA_CUSTOMER',   SM_SALES|1);
46 define('SA_SALESGROUP', SM_SALES|2);
47 define('SA_PRICE',              SM_SALES|3);
48 define('SA_SALESMAN',   SM_SALES|4);
49 define('SA_SALESAREA',  SM_SALES|5);
50 define('SA_STATUS',     SM_SALES|6);
51 define('SA_STEMPLATE',  SM_SALES|7);
52 define('SA_SRECURRENT', SM_SALES|8);
53
54 define('SA_SALESORDER',         SM_SALES|11);
55 define('SA_SALESDELIVERY',      SM_SALES|12);
56 define('SA_SALESINVOICE',       SM_SALES|13);
57 define('SA_SALESCREDITINV', SM_SALES|14);
58 define('SA_SALESCREDIT',        SM_SALES|15);
59 define('SA_SALESPAYMNT',        SM_SALES|16);
60
61 define('SA_SALESALLOC', SM_SALES|21);
62 define('SA_SALESANALYTIC', SM_SALES|22);
63 define('SA_SALESMANREP', SM_SALES|23);
64 define('SA_SALESVARREP', SM_SALES|24);
65
66 //
67 // Purchasing module 
68 //
69 define('SA_SUPPLIER', SM_PURCH|1);
70
71 define('SA_PURCHASEORDER', SM_PURCH|11);
72 define('SA_GRN', SM_PURCH|12);
73 define('SA_SUPPLIERINVOICE', SM_PURCH|13);
74 define('SA_SUPPLIERCREDIT', SM_PURCH|14);
75 define('SA_SUPPLIERPAYMNT', SM_PURCH|15);
76
77 define('SA_SUPPLIERALLOC', SM_PURCH|21);
78 define('SA_SUPPLIERANALYTIC', SM_PURCH|22);
79 define('SA_SUPPLIERMANREP', SM_PURCH|23);
80 define('SA_SUPPLIERVARREP', SM_PURCH|24);
81
82 //
83 // Inventory module 
84 //
85 define('SA_ITEM', SM_ITEMS|1);
86 define('SA_FORITEMCODE', SM_ITEMS|2);
87 define('SA_SALESKIT', SM_ITEMS|3);
88 define('SA_ITEMCATEGORY', SM_ITEMS|4);
89 define('SA_INVENTORYLOCATION', SM_ITEMS|5);
90 define('SA_INVENTORYMOVETYPE', SM_ITEMS|6);
91 define('SA_ITEMTAXTYPE', SM_ITEMS|7);
92 define('SA_UOM', SM_ITEMS|8);
93 define('SA_REORDER', SM_ITEMS|9);
94
95 define('SA_LOCATIONTRANSFER', SM_ITEMS|11);
96 define('SA_INVENTORYADJUSTMENT', SM_ITEMS|12);
97
98 define('SA_ITEMSANALYTIC', SM_ITEMS|21);
99 define('SA_ITEMSMANREP', SM_ITEMS|22);
100 define('SA_ITEMSVARREP', SM_ITEMS|23);
101
102 define('SA_SALESPRICING', SM_ITEMS|31);
103 define('SA_PURCHASEPRICING', SM_ITEMS|32);
104 define('SA_STANDARDCOST', SM_ITEMS|33);
105
106 //
107 // Manufacturing module 
108 //
109 define('SA_BOM', SM_MANUF|1);
110 define('SA_WORKCENTRE', SM_MANUF|2);
111
112 define('SA_WORKORDERENTRY', SM_MANUF|11);
113 define('SA_WORKORDEROPERATION', SM_MANUF|12);
114
115 define('SA_WORKORDERANALYTIC', SM_MANUF|21);
116 define('SA_WORKORDERMANREP', SM_MANUF|22);
117 define('SA_WORKORDERVARREP', SM_MANUF|23);
118
119 //
120 // Dimension module 
121 //
122 define('SA_DIMENSION', SM_DIM|1);
123
124 define('SA_DIMENSIONOPERATION', SM_DIM|11);
125
126 define('SA_DIMENSIONANALYTIC', SM_DIM|21);
127 define('SA_DIMENSIONMANREP', SM_DIM|22);
128 define('SA_DIMENSIONVARREP', SM_DIM|23);
129
130 //
131 // Banking and General Ledger module 
132 //
133 define('SA_BANKACCOUNT', SM_GL|1);
134 define('SA_QUICKENTRY', SM_GL|2);
135 define('SA_CURRENCY', SM_GL|3);
136 define('SA_EXCHANGERATE', SM_GL|4);
137 define('SA_GLACCOUNT', SM_GL|5);
138 define('SA_GLACCOUNTGROUP', SM_GL|6);
139 define('SA_GLACCOUNTCLASS', SM_GL|7);
140
141 define('SA_PAYMENT', SM_GL|11);
142 define('SA_DEPOSIT', SM_GL|12);
143 define('SA_BANKACCOUNTTRANSFER', SM_GL|13);
144 define('SA_JOURNALENTRY', SM_GL|14);
145 define('SA_BUDGETENTRY', SM_GL|15);
146 define('SA_RECONCILE', SM_GL|16);
147
148 define('SA_GLANALYTIC', SM_GL|21);
149 define('SA_GLMANREP', SM_GL|22);
150 define('SA_GLVARREP', SM_GL|23);
151
152 //
153 // Setup module 
154 //
155 define('SA_SETUPCOMPANY', SM_SETUP|1);
156 define('SA_SETUPUSER', SM_SETUP|2);
157 define('SA_SETUPFORM', SM_SETUP|3);
158 define('SA_SETUPTAX', SM_SETUP|4);
159 define('SA_SETUPFISCALYEAR', SM_SETUP|5);
160 define('SA_PRINTPROFILE', SM_SETUP|6);
161 define('SA_PAYMENTTERM', SM_SETUP|7);
162 define('SA_SHIPPING', SM_SETUP|8);
163 define('SA_SETUPPOS', SM_SETUP|9);
164 define('SA_SETUPPRINTER', SM_SETUP|10);
165
166 define('SA_VOIDTRANSACTION', SM_SETUP|11);
167 define('SA_VIEWPRINTTRANSACTION', SM_SETUP|12);
168 define('SA_ATTACHDOCUMENT', SM_SETUP|13);
169 define('SA_BACKUP', SM_SETUP|14);
170 define('SA_CREATECOMPANY', SM_SETUP|15);
171 define('SA_CREATELANGUAGE', SM_SETUP|16);
172 define('SA_CREATEMODULES', SM_SETUP|17);
173 define('SA_SOFTWAREUPGRADE', SM_SETUP|18);
174
175 /*
176         This table stores security area ranges. It is used by security_role 
177         table administration interface. Every extension module can add their
178         own security areas set by adding new entries here.
179 */
180 $security_areas = array(
181         // database table crud operations and administrative areas
182         SA_CUSTOMER => _("Sales customer and branches"),
183                 _("Sales groups"),
184                 _("Sales prices"),
185                 _("Sales staff"),
186                 _("Sales areas"),
187                 _("Credit status definitions"),
188                 _("Sales templates"),
189                 _("Recurrent invoices definitions"),
190         // documents, transactions entry
191         SA_SALESORDER => _("Sales order entry"),
192                 _("Sales deliveries"),
193                 _("Sales invoices"),
194                 _("Sales credit notes against invoice"),
195                 _("Sales freehand credit notes"),
196                 _("Customer payments"),
197         // maintenance and analytics
198         SA_SALESALLOC => _("Customer allocations"),
199                 _("Customer analytical reports and inquiries"),
200                 _("Sales reports"),
201                 _("Sales other reports and inquires"),
202         // database table crud operations and administrative areas
203         SA_SUPPLIER => _("Suppliers"),
204         // documents, transactions entry
205         SA_PURCHASEORDER => _("Purchase Order Entry"),
206                 _("Outstanding Purchase Orders"),
207                 _("Supplier Invoices"),
208                 _("Supplier Credit Notes"),
209                 _("Supplier Payments"),
210         // maintenance and analytics
211         SA_SUPPLIERALLOC => _("Supplier allocations"),
212                 _("Supplier analytical reports and inquiries"),
213                 _("Supplier reports"),
214                 _("Supplier other reports and inquiries"),
215         // database table crud operations and administrative areas
216         SA_ITEM => _("Items"),
217                 _("Foreign Item Codes"),
218                 _("Sales Kits"),
219                 _("Item Categories"),
220                 _("Inventory Locations"),
221                 _("Inventory Movement Types"),
222                 _("Item Tax Types"),
223                 _("Unit of Measures"),
224                 _("Reorder Levels"),
225         // documents, transactions entry
226         SA_LOCATIONTRANSFER => _("Inventory Location Transfers"),
227                 _("Inventory Adjustments"),
228         // maintenance and analytics
229         SA_ITEMSANALYTIC => _("Items analytical reports and inquiries"),
230                 _("Inventory reports"),
231                 _("Inventory other reports and inquiries"),
232         SA_SALESPRICING => _("Item Sales Pricing"),
233                 _("Item Purchasing Pricing"),
234                 _("Item Standard Costs"),
235         // database table crud operations and administrative areas
236         SA_BOM => _("Bill of Materials"),
237                 _("Work Centres"),
238         // documents, transactions entry
239         SA_WORKORDERENTRY => _("Work Order Entries"),
240                 _("Work Order Operations"),
241         // maintenance and analytics
242         SA_WORKORDERANALYTIC => _("Work Order analytical reports and inquiries"),
243                 _("Work Order Reports"),
244                 _("Work Order other reports and inquiries"),
245         // database table crud operations and administrative areas
246         SA_DIMENSION => _("Dimensions"),
247         // documents, transactions entry
248         SA_DIMENSIONOPERATION => _("Dimension Operations"),
249         // maintenance and analytics
250         SA_DIMENSIONANALYTIC => _("Dimension analytical reports and inquiries"),
251                 _("Dimension Reports"),
252                 _("Dimension other reports and inquiries"),
253         // database table crud operations and administrative areas
254         SA_BANKACCOUNT => _("Bank Accounts"),
255                 _("Quick Entries"),
256                 _("Currencies"),
257                 _("Exchange Rates"),
258                 _("GL Accounts"),
259                 _("GL Account Groups"),
260                 _("GL Account Classes"),
261         // documents, transactions entry
262         SA_PAYMENT => _("Bank Payments"),
263                 _("Bank Deposits"),
264                 _("Bank Account Transfers"),
265                 _("Journal Entries"),
266                 _("Budget Entries"),
267                 _("Bank Reconcile"),
268         // maintenance and analytics
269         SA_GLANALYTIC => _("Bank and GL analytical reports and inquiries"),
270                 _("Bank and GL Reports"),
271                 _("Bank and GL other reports and inquiries"),
272         // database table crud operations and administrative areas
273         SA_SETUPCOMPANY => _("Company Setup"),
274                 _("Users Setup"),
275                 _("Forms Setup"),
276                 _("Taxes"),
277                 _("Fiscal Years"),
278                 _("Print Profiles"),
279                 _("Payment Terms"),
280                 _("Shipping"),
281                 _("Point of Sales"),
282                 _("Printer Setup"),
283         // documents, transactions entry
284         SA_VOIDTRANSACTION => _("Voiding Transactions"),
285                 _("Viev and Print Transactions"),
286                 _("Attaching Documents"),
287                 _("Backup and Restore"),
288                 _("Install/Update Companies"),
289                 _("Install/Update Languages"),
290                 _("Install/Upgrade Modules"),
291                 _("Software Upgrades")
292 );
293 ?>