SugarCRM Users Logic Hooks - Design Tips: "SugarCRM Users Logic Hooks
Custom Logic Hooks are a great way of adding functionality to SugarCRM. The logic hook below was used to establish a default role for new users. This was required for the automatic LDAP Users functionality that is built into SugarCRM. This logic hook was used with SugarCRM CE 5.2 in a production environment.
view source
print?
01.
view source
print?
01.id}'';
14. $result = $bean->db->query($query, true);
15.
16. // Only update role when creating a new user.
17. if ($bean->db->getRowCount($result) == 0 && $_REQUEST['module'] == 'Users' && $_REQUEST['action'] == 'Save') {
18.
19. $query = 'SELECT id FROM acl_roles WHERE name = '$role_name'';
20. $result = $bean->db->query($query, true);
21.
22. if($bean->db->getRowCount($result) == 1) {
23.
24. $row = $bean->db->fetchByAssoc($result);
25. $bean->load_relationship('aclroles');
26. $bean->aclroles->add($row['id']);
27. require_once('modules/ACL/install_actions.php');
28.
29. } else {
30. sugar_die('Role does not exist! Contact the system administrator');
31. }
32. }
33. }
34.
35.}
36.?>
Отправлено через панель инструментов Google:"
Комментариев нет:
Отправить комментарий