Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature - Grupos de seguridad - Reglas de herencia por módulo #3

Merged
merged 89 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from 82 commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
c5b0517
export commit
juanSTIC Jan 2, 2024
8177741
test commit
juanSTIC Jan 2, 2024
7e43ec0
disable main inherit code if there is custom rule
juanSTIC Jan 2, 2024
ddb797d
view enhancements
juanSTIC Jan 3, 2024
495306b
commit
juanSTIC Jan 3, 2024
d7bf68f
test file (for deletion after)
juanSTIC Jan 3, 2024
17a5ac6
Merge remote-tracking branch 'origin/develop' into feature/CustomSecu…
juanSTIC Jan 3, 2024
62df58d
wip
juanSTIC Jan 3, 2024
84f9899
wip
juanSTIC Jan 4, 2024
783e662
first funcional version
juanSTIC Jan 4, 2024
a4f1267
wip
juanSTIC Jan 4, 2024
b47e92a
documentation & format
juanSTIC Jan 4, 2024
bc49205
rename files & classes
juanSTIC Jan 4, 2024
52d7f2d
add license
juanSTIC Jan 4, 2024
c337030
tunning
juanSTIC Jan 4, 2024
6364179
icon & styles
juanSTIC Jan 4, 2024
78dc51c
icons
juanSTIC Jan 4, 2024
eb82cc7
add config variable management
juanSTIC Jan 4, 2024
ab2b1b7
rules advise
juanSTIC Jan 4, 2024
cce1f6f
check config
juanSTIC Jan 4, 2024
6fdc2c0
some tunnigs
juanSTIC Jan 5, 2024
37d94c5
renaming
juanSTIC Jan 5, 2024
7e3446e
remove wrong folders
juanSTIC Jan 5, 2024
aef9cd7
wip
juanSTIC Jan 5, 2024
c2f8eaf
fix subpanel obtaid id
juanSTIC Jan 5, 2024
8aac65b
labels
juanSTIC Jan 5, 2024
cfe5a11
labels fixes
juanSTIC Jan 5, 2024
3c698d5
Delete modules/stic_Security_Groups_Rules/createRecordTest.php
juanSTIC Jan 8, 2024
984220b
Improving translation
jalbaiges Jan 8, 2024
41f5c26
Improving translation
jalbaiges Jan 8, 2024
7e0e4a3
Improving translation
jalbaiges Jan 8, 2024
6c756d8
1) fix deleted condition
juanSTIC Jan 8, 2024
dd13317
Improving translation
jalbaiges Jan 8, 2024
dd6685a
Merge branch 'feature/CustomSecurityGroups' of github.com:SinergiaTIC…
juanSTIC Jan 8, 2024
294a0a2
Improving translation
jalbaiges Jan 8, 2024
206f165
Improving translation
jalbaiges Jan 8, 2024
298f5d8
Improving translation
jalbaiges Jan 8, 2024
82c3efb
Improving translation
jalbaiges Jan 8, 2024
6ed3e78
Improving translation
jalbaiges Jan 8, 2024
3a6bb82
Improving translation
jalbaiges Jan 8, 2024
33eb80a
Improving translation
jalbaiges Jan 8, 2024
efebce0
Minor fix
jalbaiges Jan 8, 2024
c3beb05
Minor fix
jalbaiges Jan 8, 2024
d32df41
Improving translation
jalbaiges Jan 8, 2024
d3a359e
Imp
jalbaiges Jan 8, 2024
2b571aa
Improving translation
jalbaiges Jan 8, 2024
c48880c
intermediate util.php version
juanSTIC Jan 8, 2024
baf62e9
parent for rarent
enricsinergia Jan 9, 2024
3cf4062
same list source
juanSTIC Jan 9, 2024
4361c1a
status 0
juanSTIC Jan 9, 2024
89a07b2
wip
juanSTIC Jan 9, 2024
1ea0b04
Merge branches 'feature/CustomSecurityGroups' and 'feature/CustomSecu…
juanSTIC Jan 9, 2024
583e89f
some fixes
juanSTIC Jan 9, 2024
483ed10
some fixes
juanSTIC Jan 10, 2024
382c0bd
fixes from comments
juanSTIC Jan 10, 2024
6eb8c50
format
juanSTIC Jan 10, 2024
e038aaa
Delete modules/stic_Security_Groups_Rules/createRecordTest.php
juanSTIC Jan 10, 2024
b1a5e48
remove admin condition
juanSTIC Jan 10, 2024
686ab42
Merge branch 'feature/CustomSecurityGroups' of github.com:SinergiaTIC…
juanSTIC Jan 10, 2024
8a1e053
fix concactenated name
juanSTIC Jan 10, 2024
8e6dfc1
add noninheritable rules for user
juanSTIC Jan 11, 2024
e91322c
remove duplicate groups before save
juanSTIC Jan 11, 2024
6ca4979
disable many side relationships
juanSTIC Jan 11, 2024
c293c4f
non-inheritable user groups corrected
enricsinergia Jan 12, 2024
f5c7d90
ensure $field['name'] is not empty
juanSTIC Jan 12, 2024
05602a6
remove improper files
juanSTIC Jan 12, 2024
048b591
last wip
juanSTIC Jan 16, 2024
cafe118
with Alberto proposal
juanSTIC Jan 16, 2024
59fcb57
relationship list ready
juanSTIC Jan 16, 2024
03918cb
tunnig apply inheritance
juanSTIC Jan 16, 2024
1d2d4ff
avoid placeholder in selectize
juanSTIC Jan 17, 2024
3ae0c18
minor fix eng language
AlbertoSTIC Jan 17, 2024
9847e69
fix function name
juanSTIC Jan 17, 2024
b017da7
fix get related id from subpanel
juanSTIC Jan 17, 2024
a425fae
move sugar_config variable to config.php
juanSTIC Jan 17, 2024
d4e0f84
show message in all views
juanSTIC Jan 17, 2024
e86267c
tunnig get related Id
juanSTIC Jan 17, 2024
6e43000
fix get relationships
juanSTIC Jan 17, 2024
b332bae
Minor change comment
AlbertoSTIC Jan 17, 2024
10633b7
comments
juanSTIC Jan 17, 2024
e15adc6
Merge branch 'feature/CustomSecurityGroups' of github.com:SinergiaTIC…
juanSTIC Jan 17, 2024
4379c40
remove dashlet files
juanSTIC Jan 17, 2024
1040702
Improving translation
jalbaiges Jan 17, 2024
940412d
Improving translation
jalbaiges Jan 17, 2024
1ed1c2a
Improving translation
jalbaiges Jan 17, 2024
258c124
Improving translation
jalbaiges Jan 17, 2024
0fe5e79
Minor fix
jalbaiges Jan 17, 2024
ee0aa3e
function rename & complet
juanSTIC Jan 18, 2024
9188209
Merge branch 'feature/CustomSecurityGroups' of github.com:SinergiaTIC…
juanSTIC Jan 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,11 @@
// STIC Custom 20220422 JCH - publish JS variables
// STIC#708
// STIC#760
// https://github.com/SinergiaTIC/SinergiaCRM/pull/3
'js_available' => array(
0 => 'stic_datetime_combo_minute_interval',
1 => 'stic_sinergiada_public',
2 => 'stic_security_groups_rules_enabled',
),
// END STIC

Expand All @@ -574,4 +576,9 @@
'js_custom_version' => 1,
'stic_show_update_alert' => 0,
// END STIC

// STIC-Custom 20240117 JCH - Security Groups Module Rules activation config
// https://github.com/SinergiaTIC/SinergiaCRM/pull/3
'stic_security_groups_rules_enabled' => false,
// END STIC
);
6 changes: 5 additions & 1 deletion custom/Extension/application/Ext/Include/SticModules.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
$moduleList[] = 'stic_Medication_Log';
$moduleList[] = 'stic_Medication';
$moduleList[] = 'stic_Prescription';
$moduleList[] = 'stic_Security_Groups_Rules';
$moduleList[] = 'stic_Grants';
$moduleList[] = 'stic_Centers';

Expand Down Expand Up @@ -87,6 +88,7 @@
$beanList['stic_Medication_Log'] = 'stic_Medication_Log';
$beanList['stic_Medication'] = 'stic_Medication';
$beanList['stic_Prescription'] = 'stic_Prescription';
$beanList['stic_Security_Groups_Rules'] = 'stic_Security_Groups_Rules';
$beanList['stic_Grants'] = 'stic_Grants';
$beanList['stic_Centers'] = 'stic_Centers';

Expand Down Expand Up @@ -121,17 +123,18 @@
$beanFiles['stic_Medication_Log'] = 'modules/stic_Medication_Log/stic_Medication_Log.php';
$beanFiles['stic_Medication'] = 'modules/stic_Medication/stic_Medication.php';
$beanFiles['stic_Prescription'] = 'modules/stic_Prescription/stic_Prescription.php';
$beanFiles['stic_Security_Groups_Rules'] = 'modules/stic_Security_Groups_Rules/stic_Security_Groups_Rules.php';
$beanFiles['stic_Grants'] = 'modules/stic_Grants/stic_Grants.php';
$beanFiles['stic_Centers'] = 'modules/stic_Centers/stic_Centers.php';


// Modules in $modInvisList are hidden in the main menu, in reporting and as subpanels
$modInvisList[] = 'stic_Settings';
$modInvisList[] = 'stic_Validation_Actions';
$modInvisList[] = 'stic_Web_Forms';
$modInvisList[] = 'stic_Incorpora';
$modInvisList[] = 'stic_Import_Validation';
$modInvisList[] = 'stic_Validation_Results';
$modInvisList[] = 'stic_Security_Groups_Rules';

// Modules that have been hidden with $modInvisList, but have to be shown as subpanels
$modules_exempt_from_availability_check['stic_Validation_Actions'] = 'stic_Validation_Actions';
Expand All @@ -143,6 +146,7 @@
// Modules that should be accessed only by administrators through the Admin page
$adminOnlyList['stic_Settings'] = array('all' => 1);
$adminOnlyList['stic_Validation_Actions'] = array('all' => 1);
$adminOnlyList['stic_Security_Groups_Rules'] = array('all' => 1);

// Totally hide FP_Events because it can be confused with stic_Events
$modInvisList[] = 'FP_events';
Expand Down
2 changes: 2 additions & 0 deletions custom/Extension/application/Ext/Language/ca_ES.SticLang.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
$app_list_strings['moduleList']['stic_Medication_Log'] = 'Registre de medicació';
$app_list_strings['moduleList']['stic_Medication'] = 'Medicaments';
$app_list_strings['moduleList']['stic_Prescription'] = 'Prescripcions mèdiques';
$app_list_strings['moduleList']['stic_Security_Groups_Rules'] = 'Grups de Seguretat - Regles per mòduls';
$app_list_strings['moduleList']['stic_Grants'] = 'Ajuts';
$app_list_strings['moduleList']['stic_Centers'] = 'Centres';
$app_list_strings['moduleListSingular']['Accounts'] = 'Organització';
Expand Down Expand Up @@ -140,6 +141,7 @@
$app_list_strings['moduleListSingular']['stic_Medication_Log'] = 'Registre de medicació';
$app_list_strings['moduleListSingular']['stic_Medication'] = 'Medicament';
$app_list_strings['moduleListSingular']['stic_Prescription'] = 'Prescripció mèdica';
$app_list_strings['moduleListSingular']['stic_Security_Groups_Rules'] = 'Grups de Seguretats - Regla per mòdul';
$app_list_strings['moduleListSingular']['stic_Grants'] = 'Ajut';
$app_list_strings['moduleListSingular']['stic_Centers'] = 'Centre';
$app_list_strings['parent_type_display']['Accounts'] = 'Organitzacions';
Expand Down
5 changes: 3 additions & 2 deletions custom/Extension/application/Ext/Language/en_us.SticLang.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
$app_list_strings['moduleList']['stic_Prescription'] = 'Prescriptions';
$app_list_strings['moduleList']['stic_Grants'] = 'Grants';
$app_list_strings['moduleList']['stic_Centers'] = 'Centers';
$app_list_strings['moduleList']['stic_Security_Groups_Rules'] = 'Security Groups Module Rules';
$app_list_strings['moduleListSingular']['Accounts'] = 'Account';
$app_list_strings['moduleListSingular']['Contacts'] = 'Contact';
$app_list_strings['moduleListSingular']['Leads'] = 'Lead';
Expand Down Expand Up @@ -141,8 +142,7 @@
$app_list_strings['moduleListSingular']['stic_Medication_Log'] = 'Medication Log';
$app_list_strings['moduleListSingular']['stic_Medication'] = 'Medicine';
$app_list_strings['moduleListSingular']['stic_Prescription'] = 'Prescription';
$app_list_strings['moduleListSingular']['stic_Grants'] = 'Grant';
$app_list_strings['moduleListSingular']['stic_Centers'] = 'Center';
$app_list_strings['moduleListSingular']['stic_Security_Groups_Rules'] = 'Security Groups Module Rule';
$app_list_strings['parent_type_display']['Accounts'] = 'Accounts';
$app_list_strings['parent_type_display']['Contacts'] = 'Contacts';
$app_list_strings['parent_type_display']['Leads'] = 'Leads';
Expand Down Expand Up @@ -3214,3 +3214,4 @@
$app_list_strings['aow_date_type_list']['month'] = 'Months';
$app_list_strings['aow_date_type_list']['year'] = 'Years'; // New STIC item
$app_list_strings['aow_date_type_list']['business_hours'] = 'Business hours';

3 changes: 3 additions & 0 deletions custom/Extension/application/Ext/Language/es_ES.SticLang.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
$app_list_strings['moduleList']['stic_Medication_Log'] = 'Registro de medicación';
$app_list_strings['moduleList']['stic_Medication'] = 'Medicamentos';
$app_list_strings['moduleList']['stic_Prescription'] = 'Prescripciones médicas';
$app_list_strings['moduleList']['stic_Security_Groups_Rules'] = 'Grupos de Seguridad - Reglas por módulos';
$app_list_strings['moduleList']['stic_Grants'] = 'Ayudas';
$app_list_strings['moduleList']['stic_Centers'] = 'Centros';
$app_list_strings['moduleListSingular']['Accounts'] = 'Organización';
Expand Down Expand Up @@ -140,6 +141,7 @@
$app_list_strings['moduleListSingular']['stic_Medication_Log'] = 'Registro de medicación';
$app_list_strings['moduleListSingular']['stic_Medication'] = 'Medicamento';
$app_list_strings['moduleListSingular']['stic_Prescription'] = 'Prescripción médica';
$app_list_strings['moduleListSingular']['stic_Security_Groups_Rules'] = 'Grupos de Seguridad - Regla por módulo';
$app_list_strings['moduleListSingular']['stic_Grants'] = 'Ayuda';
$app_list_strings['moduleListSingular']['stic_Centers'] = 'Centro';
$app_list_strings['parent_type_display']['Accounts'] = 'Organizaciones';
Expand Down Expand Up @@ -3246,3 +3248,4 @@
$app_list_strings['map_relate_type_list']['Opportunities'] = 'Subvenciones';
$app_list_strings['map_relate_type_list']['Project'] = 'Proyectos';
$app_list_strings['map_relate_type_list']['Prospects'] = 'Público Objetivo';

2 changes: 2 additions & 0 deletions custom/Extension/application/Ext/Language/gl_ES.SticLang.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
$app_list_strings['moduleList']['stic_Medication_Log'] = 'Rexistro de medicación';
$app_list_strings['moduleList']['stic_Medication'] = 'Medicamentos';
$app_list_strings['moduleList']['stic_Prescription'] = 'Prescricións médicas';
$app_list_strings['moduleList']['stic_Security_Groups_Rules'] = 'Grupos de Seguridade - Regras por módulos';
$app_list_strings['moduleList']['stic_Grants'] = 'Ayudas';
$app_list_strings['moduleList']['stic_Centers'] = 'Centros';
$app_list_strings['moduleListSingular']['Accounts'] = 'Organización';
Expand Down Expand Up @@ -142,6 +143,7 @@
$app_list_strings['moduleListSingular']['stic_Prescription'] = 'Prescrición médica';
$app_list_strings['moduleListSingular']['stic_Grants'] = 'Ayuda';
$app_list_strings['moduleListSingular']['stic_Centers'] = 'Centro';
$app_list_strings['moduleListSingular']['stic_Security_Groups_Rules'] = 'Grupos de Seguridade - Regra por módulo';
$app_list_strings['parent_type_display']['Accounts'] = 'Organizacións';
$app_list_strings['parent_type_display']['Contacts'] = 'Persoas';
$app_list_strings['moduleListSingular']['stic_Job_Applications'] = 'Candidatura';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@
$mod_strings['LBL_MODIFIED_USER'] = 'Modificat per';
$mod_strings['LBL_MODIFIED_ID'] = 'Modificat per (ID)';
$mod_strings['LBL_STIC_PANEL_RECORD_DETAILS'] = 'Detalls del registre';
$mod_strings['LBL_STIC_GENERAL_INFORMATION'] = 'Dades generals';
$mod_strings['LBL_STIC_GENERAL_INFORMATION'] = 'Dades generals';
$mod_strings['LBL_STIC_SECURITY_GROUPS_RULES_ENABLED'] = 'Habilita les regles per mòduls';
$mod_strings['LBL_STIC_SECURITY_GROUPS_RULES_ENABLED_INFO'] = 'Les regles definides per a cada mòdul tindran preferència sobre les regles generals definides aquí.';
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@
$mod_strings['LBL_MODIFIED_USER'] = 'Modified By';
$mod_strings['LBL_MODIFIED_ID'] = 'Modified By (ID)';
$mod_strings['LBL_STIC_PANEL_RECORD_DETAILS'] = 'Record details';
$mod_strings['LBL_STIC_GENERAL_INFORMATION'] = 'Overview';
$mod_strings['LBL_STIC_GENERAL_INFORMATION'] = 'Overview';
$mod_strings['LBL_STIC_SECURITY_GROUPS_RULES_ENABLED'] = 'Enable module rules';
$mod_strings['LBL_STIC_SECURITY_GROUPS_RULES_ENABLED_INFO'] = 'The rules defined for each module will take precedence over the general rules defined here.';
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@
$mod_strings['LBL_MODIFIED_ID'] = 'Modificado por (ID)';
$mod_strings['LBL_STIC_PANEL_RECORD_DETAILS'] = 'Detalles del registro';
$mod_strings['LBL_STIC_GENERAL_INFORMATION'] = 'Datos generales';
$mod_strings['LBL_STIC_SECURITY_GROUPS_RULES_ENABLED'] = 'Habilitar las reglas por módulos';
$mod_strings['LBL_STIC_SECURITY_GROUPS_RULES_ENABLED_INFO'] = 'Las reglas definidas para cada módulo tendrán preferencia sobre las reglas generales definidas aquí.';
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@
$mod_strings['LBL_MODIFIED_ID'] = 'Modificado por (ID)';
$mod_strings['LBL_STIC_PANEL_RECORD_DETAILS'] = 'Detalles do rexistro';
$mod_strings['LBL_STIC_GENERAL_INFORMATION'] = 'Datos xerais';
$mod_strings['LBL_STIC_SECURITY_GROUPS_RULES_ENABLED'] = 'Habilitar as regras por módulos';
$mod_strings['LBL_STIC_SECURITY_GROUPS_RULES_ENABLED_INFO'] = 'Las reglas definidas para cada módulo tendrán preferencia sobre las reglas generales definidas aquí.';
45 changes: 45 additions & 0 deletions custom/Extension/modules/SecurityGroups/Ext/Menus/Menu.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
if (!defined('sugarEntry') || !sugarEntry) {
die('Not A Valid Entry Point');
}

/*********************************************************************************
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address [email protected].
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/

global $mod_strings, $app_strings, $sugar_config, $current_user;

if ($current_user->is_admin == true) {
$module_menu[] = array("index.php?module=stic_Security_Groups_Rules&action=index&return_module=stic_Security_Groups_Rules&return_action=DetailView", translate('LBL_MODULE_NAME', 'stic_Security_Groups_Rules'), "stic_Security_Groups_Rules", 'stic_Security_Groups_Rules');
}
14 changes: 14 additions & 0 deletions custom/modules/SecurityGroups/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,20 @@
<em>{MOD.LBL_INBOUND_EMAIL_DESC}</em>
</td>
</tr>
<tr>
<td class="dataLabel">
{MOD.LBL_STIC_SECURITY_GROUPS_RULES_ENABLED}
</td>
<td class="dataField">
<input name="stic_security_groups_rules_enabled" tabindex='1' value="1" class="checkbox" type="checkbox" {stic_security_groups_rules_enabled}>
</td>
</tr>
<tr>
<td colspan="2" class="dataField">
<em>{MOD.LBL_STIC_SECURITY_GROUPS_RULES_ENABLED_INFO}</em>
</td>

</tr>
</table>
</td></tr>
</table>
Expand Down
9 changes: 9 additions & 0 deletions custom/modules/SecurityGroups/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,15 @@
}
$xtpl->assign('securitysuite_inherit_assigned', $securitysuite_inherit_assigned);

// STIC CUSTOM - JCH - 20240104 - Set config for activate/deactivate custom modules inherit
// https://github.com/SinergiaTIC/SinergiaCRM/pull/3
$stic_security_groups_rules_enabled = '';
if (isset($sugar_config['stic_security_groups_rules_enabled']) && $sugar_config['stic_security_groups_rules_enabled'] == true) {
$stic_security_groups_rules_enabled = 'CHECKED';
}
$xtpl->assign('stic_security_groups_rules_enabled', $stic_security_groups_rules_enabled);
// END STIC CUSTOM


// securitysuite_inbound_email
$securitysuite_inbound_email = '';
Expand Down
6 changes: 6 additions & 0 deletions modules/SecurityGroups/SaveConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@
$cfg->config['securitysuite_inherit_assigned'] = ($_REQUEST['securitysuite_inherit_assigned'] == 1) ? true : false;
// save securitysuite_inbound_email setting
$cfg->config['securitysuite_inbound_email'] = ($_REQUEST['securitysuite_inbound_email'] == 1) ? true : false;

// STIC CUSTOM - JCH - 20240104 - Set config for activate/deactivate custom modules inherit
// https://github.com/SinergiaTIC/SinergiaCRM/pull/3
// save stic_security_groups_rules_enabled setting
$cfg->config['stic_security_groups_rules_enabled'] = ($_REQUEST['stic_security_groups_rules_enabled'] == 1) ? true : false;
// END STIC CUSTOM

if (!isset($cfg->config['addAjaxBannedModules'])) {
$cfg->config['addAjaxBannedModules'] = array();
Expand Down
21 changes: 21 additions & 0 deletions modules/SecurityGroups/SecurityGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,27 @@ public static function groupHasAccess($module, $id, $action = '')
public static function inherit($focus, $isUpdate)
{
global $sugar_config;

AlbertoSTIC marked this conversation as resolved.
Show resolved Hide resolved
// STIC-CUSTOM JCH 2024-02-02 Do not apply global inheritance rules if a custom rule is defined for current module and $sugar_config['stic_security_groups_rules_enabled'] === true.
// https://github.com/SinergiaTIC/SinergiaCRM/pull/3

if ($sugar_config['stic_security_groups_rules_enabled'] === true && $isUpdate === false) {

// Check for a custom rule for the module in stic_Security_Groups_Rules
$customRuleQuery = "SELECT count(*) FROM stic_security_groups_rules WHERE name='{$focus->module_dir}' AND deleted=0 AND active=true";
$customRuleCount = $focus->db->getOne($customRuleQuery);

// If a custom rule is defined for current module, apply custom rules and exit the function
if ($customRuleCount == 1) {
require_once 'modules/stic_Security_Groups_Rules/Utils.php';
stic_Security_Groups_RulesUtils::applyCustomInheritance($focus);

// This prevents the application of default inheritance global rules
return;
}
}
// END STIC CUSTOM

self::assign_default_groups($focus, $isUpdate); //this must be first because it does not check for dups
// STIC custom - JCH - 20221128 - Don't apply assigned user inheritance when saving an existing record
// STIC#929
Expand Down
Loading