Exemplo n.º 1
2
 /**
  * Delete
  * @param $CODE
  * @return array
  * @throws \Exception
  */
 public static function Delete($CODE)
 {
     $group = new \CGroup();
     $user = new \CUser();
     if (!empty($CODE)) {
         $by = "ID";
         $order = "asc";
         $dbGroup = $group->GetList($by, $order, array('STRING_ID' => $CODE));
         if ($arGroup = $dbGroup->Fetch()) {
             $arReturn = $arGroup;
         }
     } else {
         throw new BimException('Empty group code');
     }
     if (intval($arReturn['ID']) > 0) {
         $arUsers = $group->GetGroupUser($arReturn['ID']);
         foreach ($arUsers as $UserID) {
             $arGroup = $user->GetUserGroup($UserID);
             $arGroup[] = "3";
             $user->SetUserGroup($UserID, $arGroup);
         }
         $res = $group->Delete($arReturn['ID']);
         if (is_object($res)) {
             return $arReturn['ID'];
         } else {
             throw new BimException($group->LAST_ERROR);
         }
     } else {
         throw new BimException('Group not found');
     }
 }
Exemplo n.º 2
0
 /**
  * Удаляет группу
  * @return bool
  */
 public function delete()
 {
     $id = $this->getAttribute('id')->getValue();
     if ($id > 0) {
         $group = new CGroup();
         $DB->StartTransaction();
         if (!$group->Delete($id)) {
             $DB->Rollback();
             throw new Exception('Delete error');
         }
         $DB->Commit();
     } else {
         return false;
     }
 }
Exemplo n.º 3
0
            {
                $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));
    } else {
        if ($createNewSaleUser) {
            if ($groupId > 0) {
                $group = new CGroup();
                $group->Delete($groupId);
            }
            if ($userId > 0) {
                CUser::Delete($userId);
            }
        }
    }
}
if ($_SERVER["REQUEST_METHOD"] == "GET" && $_REQUEST["clear_crm_stat"] == "Y" && $saleModulePermissions >= "W" && check_bitrix_sessid()) {
    if (!isset($_REQUEST["clear_crm_stat_url"])) {
        COption::SetOptionString("sale", "~crm_integration", "");
    } else {
        $ar = array();
        foreach ($arCrmIntegration as $k => $v) {
            if ($k != $_REQUEST["clear_crm_stat_url"]) {
                $ar[$k] = $v;
Exemplo n.º 4
0
	}

	foreach($arID as $ID)
	{
		if(strlen($ID)<=0)
			continue;

		switch($_REQUEST['action'])
		{
		case "delete":
			if($ID>2)
			{
				@set_time_limit(0);
				$DB->StartTransaction();
				$group = new CGroup();
				if(!$group -> Delete($ID))
				{
					$DB->Rollback();
					$lAdmin->AddGroupError(GetMessage("DELETE_ERROR"), $ID);
				}
				$DB->Commit();
			}
			else
				$lAdmin->AddGroupError(GetMessage("MAIN_ERROR_GROUP").$ID.GetMessage("MAIN_ERROR_GROUP_DELETE"));
			break;
		case "activate":
		case "deactivate":
			if($ID>2)
			{
				$ob = new CGroup();
				$arFields["ACTIVE"] = ($_REQUEST['action']=="activate"?"Y":"N");
Exemplo n.º 5
0
 /**
  * @var string $group
  */
 protected function UserGroupDelete($groupName)
 {
     $id = $this->UserGetGroupIdByCode($groupName);
     if ($id) {
         global $DB;
         $group = new \CGroup();
         $DB->StartTransaction();
         if (!$group->Delete($id)) {
             $DB->Rollback();
             $error = "Can't delete group {$groupName}";
         }
         $DB->Commit();
         echo "Delete group {$groupName}";
         if (isset($error)) {
             throw new \Exception($error);
         }
     }
 }