Refactor user session handling and permissions management

- Updated session variables to use 'authorization' array instead of 'username' for user identification across multiple files.
- Introduced a new function `getUserPermissions` to consolidate user permissions retrieval based on assigned roles.
- Modified API calls to use the new authorization structure and updated endpoints to v2.
- Enhanced language support by adding 'PL' to the list of supported languages.
- Cleaned up redundant code and improved session management during user login and registration processes.
- Added a new API endpoint for fetching user permissions based on user ID.
This commit is contained in:
“VeLiTi”
2026-01-19 15:29:16 +01:00
parent 782050c3ca
commit 24481279d5
99 changed files with 683 additions and 539 deletions

View File

@@ -353,7 +353,7 @@ $page_rows_folders = 25; //marketing folders
//------------------------------------------
// Languages supported
//------------------------------------------
$supportedLanguages = ['US', 'NL', 'DE', 'ES','PT'];
$supportedLanguages = ['US', 'NL', 'DE', 'ES','PL','PT'];
//------------------------------------------
// Pricing

View File

@@ -1,27 +1,27 @@
<?php
/*Standard*/
define('standard_profile','dashboard,profile,application,firmwaretool,histories,history,servicereport,servicereports,equipment,equipments,products_software');
define('standard_profile','application,firmwaretool,histories,history,servicereport,servicereports,dashboard,profile,equipment,equipments,products_software');
/*Superuser*/
define('superuser_profile','admin,dashboard,profile,application,assets,firmwaretool,histories,history,history_manage,marketing,partner,partners,servicereport,servicereports,equipment,equipment_manage,equipment_manage_edit,equipments,equipments_mass_update,product,product_manage,products,products_software,products_versions,user,user_manage,users');
define('superuser_profile','application,assets,firmwaretool,histories,history,history_manage,marketing,partner,partners,servicereport,servicereports,admin,dashboard,profile,equipment,equipment_manage,equipment_manage_edit,equipments,equipments_mass_update,product,product_manage,products,products_software,products_versions,user,user_manage,users');
/*Admin*/
define('admin_profile','account,accounts,admin,dashboard,profile,application,assets,buildtool,buildtool,cartest,cartest_manage,cartests,changelog,communication,communication_send,communications,firmwaretool,histories,history,history_manage,marketing,partner,partners,sales,servicereport,servicereports,software_available,software_download,software_update,softwaretool,contract,contract_manage,contracts,equipment,equipment_data,equipment_healthindex,equipment_manage,equipment_manage_edit,equipments,equipments_mass_update,product,product_manage,products,products_software,products_software_assignment,products_software_assignments,products_software_assignments,products_versions,report_build,report_contracts_billing,report_healthindex,reporting,rma,rma_history,rma_history_manage,rma_manage,rmas,user,user_manage,users');
define('admin_profile','application,assets,buildtool,buildtool,cartest,cartest_manage,cartests,changelog,communication,communication_send,communications,firmwaretool,histories,history,history_manage,marketing,partner,partners,sales,servicereport,servicereports,software_available,software_download,software_update,softwaretool,account,accounts,admin,dashboard,profile,contract,contract_manage,contracts,equipment,equipment_data,equipment_healthindex,equipment_history,equipment_manage,equipment_manage_edit,equipments,equipments_mass_update,product,product_manage,products,products_software,products_software_assignment,products_software_assignments,products_software_assignments,products_software_licenses,products_versions,report_build,report_contracts_billing,report_healthindex,reporting,rma,rma_history,rma_history_manage,rma_manage,rmas,user,user_manage,users');
/*AdminPlus*/
define('adminplus_profile','account,account_manage,accounts,admin,config,dashboard,profile,settings,api,application,appointment,assets,billing,buildtool,buildtool,cartest,cartest_manage,cartests,catalog,categories,category,changelog,checkout,com_log,communication,communication_send,communications,cronjob,debug,dev,discount,discounts,factuur,firmwaretool,functions,generate_download_token,histories,history,history_manage,identity,identity_dealers,initialize,invoice,language,licenses,logfile,mailer,maintenance,marketing,marketing_delete,marketing_files,marketing_folders,marketing_migrate,marketing_tags,marketing_update,marketing_upload,media,media_manage,media_scanner,media_upload,order,orders,partner,partners,payment,placeorder,pricelists,pricelists_items,pricelists_manage,profiles,register,render_service_report,reset,sales,security,service,servicereport,servicereports,shipping,shipping_manage,shopping_cart,software_available,software_download,software_update,softwaretool,tax,taxes,test,transactions,transactions_items,translation_manage,translations,translations_details,unscribe,upgrades,uploader,vin,webhook_mollie,webhook_paypal,contract,contract_manage,contracts,dealer,dealer_manage,dealers,dealers_media,equipment,equipment_data,equipment_healthindex,equipment_history,equipment_manage,equipment_manage_edit,equipments,equipments_mass_update,product,product_manage,products,products_attributes,products_attributes_items,products_attributes_manage,products_categories,products_configurations,products_media,products_software,products_software_assignment,products_software_assignments,products_software_assignments,products_software_licenses,products_software_upgrade_paths,products_software_upgrade_paths_manage,products_software_version,products_software_version_access_rules_manage,products_software_version_manage,products_software_versions,products_versions,report_build,report_contracts_billing,report_healthindex,report_usage,reporting,rma,rma_history,rma_history_manage,rma_manage,rmas,user,user_credentials,user_manage,users');
define('adminplus_profile','access_element,access_element_manage,access_elements,api,application,appointment,assets,billing,buildtool,buildtool,cartest,cartest_manage,cartests,catalog,categories,category,changelog,checkout,com_log,communication,communication_send,communications,cronjob,debug,dev,discount,discounts,factuur,firmwaretool,functions,generate_download_token,histories,history,history_manage,identity,identity_dealers,initialize,invoice,language,licenses,logfile,mailer,maintenance,marketing,marketing_delete,marketing_files,marketing_folders,marketing_migrate,marketing_tags,marketing_update,marketing_upload,media,media_manage,media_scanner,media_upload,order,orders,partner,partners,payment,placeorder,pricelists,pricelists_items,pricelists_manage,profiles,register,render_service_report,reset,role_access_permissions,sales,security,service,servicereport,servicereports,shipping,shipping_manage,shopping_cart,software_available,software_download,software_update,softwaretool,tax,taxes,test,transactions,transactions_items,translation_manage,translations,translations_details,unscribe,upgrades,uploader,vin,webhook_mollie,webhook_paypal,account,account_manage,accounts,admin,config,dashboard,profile,settings,contract,contract_manage,contracts,dealer,dealer_manage,dealers,dealers_media,equipment,equipment_data,equipment_healthindex,equipment_history,equipment_manage,equipment_manage_edit,equipments,equipments_mass_update,product,product_manage,products,products_attributes,products_attributes_items,products_attributes_manage,products_categories,products_configurations,products_media,products_software,products_software_assignment,products_software_assignments,products_software_assignments,products_software_licenses,products_software_upgrade_paths,products_software_upgrade_paths_manage,products_software_version,products_software_version_access_rules_manage,products_software_version_manage,products_software_versions,products_versions,report_build,report_builder,report_contracts_billing,report_healthindex,report_usage,reporting,rma,rma_history,rma_history_manage,rma_manage,rmas,user,user_credentials,user_manage,user_role,user_role_assignments,user_role_manage,user_roles,users');
/*Build*/
define('build','dashboard,profile,application,buildtool,buildtool,firmwaretool,products_software');
define('build','application,buildtool,buildtool,firmwaretool,dashboard,profile,products_software');
/*Commerce*/
define('commerce','admin,dashboard,profile,application,catalog,categories,category,checkout,discount,discounts,identity,invoice,media,media_manage,order,orders,partner,partners,placeorder,pricelists,pricelists_items,pricelists_manage,shipping,shipping_manage,shopping_cart,taxes,transactions,transactions_items,translation_manage,translations,translations_details,uploader,product,product_manage,products,products_attributes,products_attributes_items,products_attributes_manage,products_categories,products_configurations,products_media,products_software,products_versions,user,user_manage,users');
define('commerce','application,catalog,categories,category,checkout,discount,discounts,identity,invoice,media,media_manage,order,orders,partner,partners,placeorder,pricelists,pricelists_items,pricelists_manage,shipping,shipping_manage,shopping_cart,taxes,transactions,transactions_items,translation_manage,translations,translations_details,uploader,admin,dashboard,profile,product,product_manage,products,products_attributes,products_attributes_items,products_attributes_manage,products_categories,products_configurations,products_media,products_software,products_versions,user,user_manage,users');
/*Distribution*/
define('distribution','admin,dashboard,profile,application,assets,firmwaretool,histories,history,history_manage,marketing,partner,partners,servicereport,servicereports,equipment,equipment_manage,equipment_manage_edit,equipments,equipments_mass_update,product,product_manage,products,products_software,products_versions,user,user_manage,users');
define('distribution','application,assets,firmwaretool,histories,history,history_manage,marketing,partner,partners,servicereport,servicereports,admin,dashboard,profile,equipment,equipment_manage,equipment_manage_edit,equipments,equipments_mass_update,product,product_manage,products,products_software,products_versions,user,user_manage,users');
/*Firmware*/
define('firmware','application,software_available,software_download,software_update,softwaretool,transactions,transactions_items,products_software_versions');
/*Garage*/
define('garage','dashboard,profile,application,cartest,cartest_manage,cartests,products_versions');
define('garage','application,cartest,cartest_manage,cartests,dashboard,profile,products_versions');
/*Interface*/
define('interface','application,firmwaretool,invoice,payment,transactions,transactions_items,contract,contracts,equipment_manage,equipments,products_software,products_versions,users');
/*Service*/
define('service','admin,dashboard,profile,application,assets,firmwaretool,histories,history,history_manage,marketing,partner,partners,servicereport,servicereports,equipment,equipment_manage,equipments,products_software,user,user_manage,users');
define('service','application,assets,firmwaretool,histories,history,history_manage,marketing,partner,partners,servicereport,servicereports,admin,dashboard,profile,equipment,equipment_manage,equipments,products_software,user,user_manage,users');
/*Other*/
define('other','admin,dashboard,profile,application,assets,firmwaretool,histories,history,history_manage,marketing,partner,partners,servicereport,servicereports,equipment,equipment_manage,equipments,products_software');
define('other','application,assets,firmwaretool,histories,history,history_manage,marketing,partner,partners,servicereport,servicereports,admin,dashboard,profile,equipment,equipment_manage,equipments,products_software');
?>

View File

@@ -4,6 +4,9 @@
// All individual views and APIs - Profile ++++++++++++++
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++
$all_views = [
"access_element",
"access_element_manage",
"access_elements",
"account",
"account_manage",
"accounts",
@@ -112,6 +115,7 @@ $all_views = [
"register",
"render_service_report",
"report_build",
"report_builder",
"report_contracts_billing",
"report_healthindex",
"report_usage",
@@ -122,6 +126,7 @@ $all_views = [
"rma_history_manage",
"rma_manage",
"rmas",
"role_access_permissions",
"sales",
"security",
"service",
@@ -149,6 +154,10 @@ $all_views = [
"user",
"user_credentials",
"user_manage",
"user_role",
"user_role_assignments",
"user_role_manage",
"user_roles",
"users",
"vin",
"webhook_mollie",