I have tried to find infromation about SecuritySuite and code examples but either my google search powers are no longer good or there just isnāt anything out there.
I have two departments "Insuranceā and āInvestmentsā (For now). Each department has different information that needs to be entered on the Accounts Module. So on the accounts screen Insurance fills out some fields and Investments fills out other fields and each department should not see the fields related to another department. I can show and hide panels in EditView or DetailView just like I did in another module but in order to do this I need to know what Security Group and Role the user has (Since iām using Groups and Roleās). Of course if you have a solution that would be easier let me know.
+1
Ok iāve been digging through come and still hitting google up for more data and I discovered that if anyone is looking for information on this topic do not search for SecurityGroups instead search for āsuitecrm Team [additional text to include]ā and you will get a much better return. Ok so a little bit of what I have managed to get wroking
<?php
require_once('data/BeanFactory.php');
global $current_user;
$u_id = $current_user->id; // This stores the id of the current user
// * Insurance Related Part
// Grab the SecurityGroups Bean so we can collect needed information
$insurance_group = BeanFactory::getBean('SecurityGroups');
// Grab the 'Insurance Group' Group as long as it is not deleted
$insurance_group->retrieve_by_string_fields(array('name'=>'Insurance Group','deleted'=>0));
// Assign the id of 'Insurance Group' to $ins_group_id so we can check it
$ins_group_id = $insurance_group->id;
// load relationship to see if the our collected data matches
// the information is stored in the database under the table
// 'securitygroups_users'
$insurance_group->load_relationship([color=#00ffff]'users'[/color]);
// * Investment Related Part
// Grab the SecurityGroups Bean so we can collect needed information
$investment_group = BeanFactory::getBean('SecurityGroups');
// Grab the 'Investment Group' Group as long as it is not deleted
$investment_group->retrieve_by_string_fields(array('name'=>'Investment Group','deleted'=>0));
// Assign the id of 'Investment Group' to $ins_group_id so we can check it
$inv_group_id = $investment_group->id;
As you can see the highlighted part is where I am running into difficulty.
- Is there a relationship name for this, iāve tried āsecuritygroups_usersā and many combinations but nothing works.
- after looking at the securitygroups.php file I noticed that all references to the āsecuritygroups_usersā table are done
using sql. Is this the way it has to be done or am I just missing something. Also included some of my code in the event
that someone else needed some information on it too