本文整理汇总了PHP中SecurityGroup::assign_default_groups方法的典型用法代码示例。如果您正苦于以下问题:PHP SecurityGroup::assign_default_groups方法的具体用法?PHP SecurityGroup::assign_default_groups怎么用?PHP SecurityGroup::assign_default_groups使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SecurityGroup
的用法示例。
在下文中一共展示了SecurityGroup::assign_default_groups方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: inherit
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: inherit
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: testassign_default_groups
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();
}
}