예제 #1
0
$userGroupID = "";
$dbGroup = CGroup::GetList($by = "", $order = "", array("STRING_ID" => "content_editor"));
if ($arGroup = $dbGroup->Fetch()) {
    $userGroupID = $arGroup["ID"];
} else {
    $group = new CGroup();
    $arFields = array("ACTIVE" => "Y", "C_SORT" => 300, "NAME" => GetMessage("SALE_WIZARD_CONTENT_EDITOR"), "DESCRIPTION" => GetMessage("SALE_WIZARD_CONTENT_EDITOR_DESCR"), "USER_ID" => array(), "STRING_ID" => "content_editor");
    $userGroupID = $group->Add($arFields);
    $DB->Query("INSERT INTO b_sticker_group_task(GROUP_ID, TASK_ID)\tSELECT " . intVal($userGroupID) . ", ID FROM b_task WHERE NAME='stickers_edit' AND MODULE_ID='fileman'", false, "FILE: " . __FILE__ . "<br> LINE: " . __LINE__);
}
if (IntVal($userGroupID) > 0) {
    WizardServices::SetFilePermission(array($siteID, "/bitrix/admin"), array($userGroupID => "R"));
    $rsTasks = CTask::GetList(array(), array("MODULE_ID" => "main", "SYS" => "Y", "BINDIG" => "module", "LETTER" => "P"));
    if ($arTask = $rsTasks->Fetch()) {
        CGroup::SetModulePermission($userGroupID, $arTask["MODULE_ID"], $arTask["ID"]);
    }
    $rsTasks = CTask::GetList(array(), array("MODULE_ID" => "fileman", "SYS" => "Y", "BINDIG" => "module", "LETTER" => "F"));
    if ($arTask = $rsTasks->Fetch()) {
        CGroup::SetModulePermission($userGroupID, $arTask["MODULE_ID"], $arTask["ID"]);
    }
    $SiteDir = "";
    if (WIZARD_SITE_ID != "s1") {
        $SiteDir = "/site_" . WIZARD_SITE_ID;
    }
    WizardServices::SetFilePermission(array($siteID, $SiteDir . "/index.php"), array($userGroupID => "W"));
    WizardServices::SetFilePermission(array($siteID, $SiteDir . "/about/"), array($userGroupID => "W"));
    WizardServices::SetFilePermission(array($siteID, $SiteDir . "/news/"), array($userGroupID => "W"));
    WizardServices::SetFilePermission(array($siteID, $SiteDir . "/catalog/"), array($userGroupID => "W"));
    WizardServices::SetFilePermission(array($siteID, $SiteDir . "/personal/"), array($userGroupID => "W"));
}
COption::SetOptionString("eshop", "wizard_installed", "Y", false, WIZARD_SITE_ID);
예제 #2
0
         if ($rcode == "ER") {
             $errorMessage .= substr($responseBody, 2) . "<br />";
         } elseif ($rcode != "OK") {
             $errorMessage .= GetMessage("SPTEN_SCRM_ERR_ANSWER") . "<br />";
         } else {
             $crmUrl4Import = trim(substr($responseBody, 2));
         }
     }
 }
 if (empty($errorMessage)) {
     if ($createNewSaleUser) {
         $APPLICATION->SetGroupRight("sale", $groupId, "W", false);
         //$APPLICATION->SetGroupRight("catalog", $groupId, "R", false);
         CGroup::SetModulePermission($groupId, "catalog", CTask::GetIdByLetter("R", "catalog"));
         //$APPLICATION->SetGroupRight("main", $groupId, "R", false);
         CGroup::SetModulePermission($groupId, "main", CTask::GetIdByLetter("R", "main"));
         $opt = COption::GetOptionString("sale", "1C_SALE_GROUP_PERMISSIONS", "");
         $opt .= ($opt != "" ? "," : "") . $groupId;
         COption::SetOptionString("sale", "1C_SALE_GROUP_PERMISSIONS", $opt);
         function GetAccessArrTmp()
         {
             $PERM = array();
             @(include $_SERVER["DOCUMENT_ROOT"] . "/bitrix/.access.php");
             return $PERM;
         }
         $arFPermsTmp = GetAccessArrTmp();
         $arFPerms = array_key_exists("admin", $arFPermsTmp) ? $arFPermsTmp["admin"] : array();
         $arFPerms[$groupId . ""] = "R";
         $APPLICATION->SetFileAccessPermission(array(SITE_ID, "/bitrix/admin"), $arFPerms);
     }
     LocalRedirect($APPLICATION->GetCurPage() . "?lang=" . LANGUAGE_ID . "&success=Y&crm_imp_url=" . urlencode(($crmUrlScheme == 'ssl://' ? "https" : "http") . "://" . $crmUrlHost . ":" . $crmUrlPort . $crmUrl4Import) . "&crm_url=" . urlencode(($crmUrlScheme == 'ssl://' ? "https" : "http") . "://" . $crmUrlHost . ":" . $crmUrlPort));
예제 #3
0
 function RestoreSecurity($arExcludeGroups = array())
 {
     $arBackup = CControllerClient::GetBackup();
     if (!is_array($arBackup)) {
         return true;
     }
     if (is_array($arBackup["security"])) {
         foreach ($arBackup["security"] as $group_code => $perms) {
             if (in_array($group_code, $arExcludeGroups)) {
                 continue;
             }
             if (($group_id = CGroup::GetIDByCode($group_code)) > 0) {
                 foreach ($perms as $module_id => $level) {
                     CGroup::SetModulePermission($group_id, $module_id, $level);
                 }
                 if (isset($arBackup["security_subord_groups"][$group_code])) {
                     CGroup::SetSubordinateGroups($group_id, $arBackup["security_subord_groups"][$group_code]);
                 }
             }
             unset($arBackup["security"][$group_code]);
             unset($arBackup["security_subord_groups"][$group_code]);
         }
         if (count($arBackup["security"]) <= 0) {
             unset($arBackup["security"]);
         }
         CControllerClient::SetBackup($arBackup);
     }
     return true;
 }