Module Builder Security Groups Management

Can anyone offer some direction on using Security Groups Management on a custom module created in Module Builder? I created a Vacation module… and my first attempt was a many to one relationship to security groups management, but alas, the user in the security group couldn’t see records assigned to his security group despite the role being setup appropriately to allow for this. I saw in the CONTACTS module, it was a many to many relationship to Security Groups Management, so I changed it and redeployed the VACATION module and repaired the database but alas, the user still can’t see the records to which he is given permission through group membership.

I’m hoping someone has succeeded in this and can help. The only differences I can see to my implementation vs. CONTACTS are…

  1. The relationship was made from security_groups to contacts whereas I’m making it from contacts to security_groups
    AND
  2. The display panel from contacts is blank in the CONTACTS relationship whereas mine is “default” since I cannot make it blank through the relationships management interface.

Any help is appreciated… (and before you say it @pawan6782, Security Groups are still working in my other modules :S )

Thanks,
sieberta

OK, figured this one out on my own…

  1. If you have SecuritySuite Premium, there is a tool called “hookup tool” that creates the relationship for you.
  2. If you don’t have the paid-for version, you can create the many-to-many relationship and then edit the metadata file that creates the relationship.

The details are here: http://dl.sugarforge.org/securitysuite/securitysuite-old/OlderFiles/SecuritySuite_Documentation_2.1.pdf

And for copy/paste purposes, you can use my example…

$dictionary["vaca_vacation_securitygroups"] = array(
  'true_relationship_type' => 'many-to-many',
  'relationships' =>
  array(
  	'vaca_vacation_securitygroups' =>
  	array(
  		'lhs_module' => 'SecurityGroups',
  		'lhs_table' => 'securitygroups',
  		'lhs_key' => 'id',
  		'rhs_module' => 'vaca_Vacation',
  		'rhs_table' => 'vaca_vacation',
  		'rhs_key' => 'id',
  		'join_table' => 'securitygroups_records',
  		'join_key_lhs' => 'securitygroup_id',
  		'join_key_rhs' => 'record_id',
  		'relationship_type' => 'many-to-many',
  		'relationship_role_column' => 'module',
  		'relationship_role_column_value' => 'vaca_Vacation',
  	),
  ),
 );

This information was extremely difficult to find… I’m hoping to do my part to contribute to the documentation of SuiteCRM and included Modules.

The other thing that was unclear to me from the documentation PDF was whether or not I was to include the key at the beginning of the module name… and the answer is yes, in all locations you include the key.

sieberta

5 Likes

it is useful, thank you sieberta

can buy it, it support SuiteCRM also.

https://www.sugaroutfitters.com/addons/securitysuite

1 Like

Hi sieberta,

Thanks for you help.

My original module file is: mi modulo original es: fph_historia_clinica

ihave the automatic generate relationshi file: fph_historia_clinica_securitygroups_1_fph_historia_clinica.php
in (custom/Extension/modules/fph_historia_clinica/Ext/Layoutdefs)

which are the correct data ?

‘rhs_module’ => ‘YOURMODULENAME’,
‘rhs_table’ => ‘YOURCUSTOMMODULE’,

thanks.

Very THANK YOU for this post, it helps me.

SecuritySuite_Documentation_2.1.zip (334.9 KB)

For anyone trying to implement this, the link to original documentation does not work. I found a copy and have uploaded it here.

Also…KEY!!! Do not just edit the file. If you just edit it as instructed it will not work. You have to remove all other code from the file and replace it exactly with only the code in the documentaiton (with the appropriate substitutions for your module name). Then do a role repair, I also did a quick repair and rebuild and it works.