コード例 #1
0
 function inherit(&$focus, $isUpdate)
 {
     SecurityGroup::assign_default_groups($focus, $isUpdate);
     //this must be first because it does not check for dups
     //don't do inheritance if popup selector method is chosen and a user is making the request...
     if (isset($sugar_config['securitysuite_popup_select']) && $sugar_config['securitysuite_popup_select'] == true && isset($_REQUEST['action']) && $_REQUEST['action'] == 'Save') {
         return;
     }
     SecurityGroup::inherit_creator($focus, $isUpdate);
     SecurityGroup::inherit_assigned($focus, $isUpdate);
     SecurityGroup::inherit_parent($focus, $isUpdate);
 }
コード例 #2
0
 function inherit(&$focus, $isUpdate)
 {
     global $sugar_config;
     SecurityGroup::assign_default_groups($focus, $isUpdate);
     //this must be first because it does not check for dups
     SecurityGroup::inherit_assigned($focus, $isUpdate);
     SecurityGroup::inherit_parent($focus, $isUpdate);
     //don't do creator inheritance if popup selector method is chosen and a user is making the request...
     //don't if saving from a popup (subpanel_field_name check. Save2 is the action but to be safe use the subpanel check)
     if (isset($sugar_config['securitysuite_popup_select']) && $sugar_config['securitysuite_popup_select'] == true && isset($_REQUEST['action']) && $_REQUEST['action'] == 'Save' || !empty($_REQUEST['subpanel_field_name'])) {
         //check to see if a member of more than 1 group...if not then just inherit the one.
         //Otherwise, this is taken on the edit view on create now
         $groupFocus = new SecurityGroup();
         $security_modules = $groupFocus->getSecurityModules();
         if (in_array($focus->module_dir, array_keys($security_modules))) {
             //check if user is in more than 1 group. If so then set the session var otherwise inherit it's only group
             global $current_user;
             $memberships = $groupFocus->getMembershipCount($current_user->id);
             if ($memberships > 1) {
                 return;
             }
         }
     }
     SecurityGroup::inherit_creator($focus, $isUpdate);
 }
コード例 #3
0
 public function testassign_default_groups()
 {
     //unset and reconnect Db to resolve mysqli fetch exeception
     global $db;
     unset($db->database);
     $db->checkConnection();
     $account = new Account();
     $account->id = 1;
     //execute the method and test if it works and does not throws an exception.
     try {
         SecurityGroup::assign_default_groups($account, false);
         $this->assertTrue(true);
     } catch (Exception $e) {
         $this->fail();
     }
 }