Example #1
0
	function GetTasks()
	{
		$arTasks = Array();
		$res = CTask::GetList(Array('LETTER' => 'asc'), Array('MODULE_ID' => 'fileman', 'BINDING' => 'stickers'));
		while($arRes = $res->Fetch())
		{
			$name = '';
			if ($arRes['SYS'])
				$name = GetMessage('TASK_NAME_'.strtoupper($arRes['NAME']));
			if (strlen($name) == 0)
				$name = $arRes['NAME'];
			$arTasks[$arRes['ID']] = Array('title' => $name, 'letter' => $arRes['LETTER']);
		}
		return $arTasks;
	}
Example #2
0
 function GetTasks()
 {
     IncludeModuleLangFile($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/fileman/admin/task_description.php");
     $arTasks = array();
     $res = CTask::GetList(array('LETTER' => 'asc'), array('MODULE_ID' => 'fileman', 'BINDING' => 'stickers'));
     while ($arRes = $res->Fetch()) {
         $name = '';
         if ($arRes['SYS']) {
             $name = GetMessage('TASK_NAME_' . strtoupper($arRes['NAME']));
         }
         if (strlen($name) == 0) {
             $name = $arRes['NAME'];
         }
         $arTasks[$arRes['ID']] = array('title' => $name, 'letter' => $arRes['LETTER']);
     }
     return $arTasks;
 }
Example #3
0
 public static function GetAccessTasks($binging = 'calendar_section')
 {
     \Bitrix\Main\Localization\Loc::loadLanguageFile($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/calendar/admin/task_description.php");
     if (is_array(self::$arAccessTask[$binging])) {
         return self::$arAccessTask[$binging];
     }
     $bIntranet = self::IsIntranetEnabled();
     $arTasks = array();
     $res = CTask::GetList(array('ID' => 'asc'), array('MODULE_ID' => 'calendar', 'BINDING' => $binging));
     while ($arRes = $res->Fetch()) {
         if (!$bIntranet && (strtolower($arRes['NAME']) == 'calendar_view_time' || strtolower($arRes['NAME']) == 'calendar_view_title')) {
             continue;
         }
         $name = '';
         if ($arRes['SYS']) {
             $name = GetMessage('TASK_NAME_' . strtoupper($arRes['NAME']));
         }
         if (strlen($name) == 0) {
             $name = $arRes['NAME'];
         }
         $arTasks[$arRes['ID']] = array('name' => $arRes['NAME'], 'title' => $name);
     }
     self::$arAccessTask[$binging] = $arTasks;
     return $arTasks;
 }
Example #4
0
	</tr>
	<tr>
		<td align="center" colspan="2">
			<table border="0" cellspacing="1" cellpadding="2" width="100%" class="internal">
				<tr class="heading">
					<td valign="middle" align="center" nowrap>
						<?echo GetMessage("FILEMAN_FOLDER_ACCESS_GROUP")?>
					</td>
					<td valign="top" align="center" nowrap>
						<?echo GetMessage("FILEMAN_FOLDER_ACCESS_LEVEL")?>
					</td>
				</tr>
				<?
				$arPermTypes = Array();

				$res = CTask::GetList(Array('LETTER' => 'asc'), Array('MODULE_ID' => 'main','BINDING' => 'file'));
				while($arRes = $res->Fetch())
				{
					$name = '';
					if ($arRes['SYS'])
						$name = GetMessage(strtoupper($arRes['NAME']));
					if (strlen($name) == 0)
						$name = $arRes['NAME'];

					$arPermTypes[$arRes['ID']] = Array(
						'title' => $name,
						'letter' => $arRes['LETTER']
					);
				}
				$arPermTypes['NOT_REF'] = Array(
					'title' => GetMessage("FILEMAN_FOLDER_ACCESS_INHERIT"),
Example #5
0
	if (isset($PERM[$name]) && is_array($PERM[$name]))
		$arUserGroupsID = array_merge($arUserGroupsID, array_keys($PERM[$name]));

	if (strlen($currentPath)<=0)
		break;
}

foreach($arUserGroupsID as $key=>$val)
	if(preg_match('/^[0-9]+$/', $val))
		$arUserGroupsID[$key] = "G".$val;

$arUserGroupsID = array_unique($arUserGroupsID);

//Get all tasks
$arPermTypes = array();
$obTask = CTask::GetList(array("LETTER" => "ASC"), array("MODULE_ID" => "main", "BINDING" => "file"));
while($arTask = $obTask->Fetch())
	$arPermTypes[$arTask["ID"]] = CTask::GetLangTitle($arTask["NAME"]);

//Current file/folder permissions
$currentPermission = array();
if($io->FileExists($documentRoot.$assignFolderName.".access.php"))
{
	$PERM = array();
	include($io->GetPhysicalName($documentRoot.$assignFolderName.".access.php"));

	foreach($PERM as $file => $arPerm)
		foreach($arPerm as $code => $permission)
			$currentPermission[$file][(preg_match('/^[0-9]+$/', $code)? "G".$code : $code)] = $permission;
}
Example #6
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule("timeman")) {
    return;
}
if (!WIZARD_IS_RERUN) {
    $arAccessRights = array(WIZARD_EMPLOYEES_GROUP => 'N', WIZARD_PERSONNEL_DEPARTMENT_GROUP => 'R', WIZARD_DIRECTION_GROUP => 'T');
    $arTaskIDs = array();
    $dbRes = CTask::GetList(array(), array('MODULE_ID' => 'timeman', 'SYS' => 'Y', 'LETTER' => implode('|', $arAccessRights)));
    while ($arRes = $dbRes->Fetch()) {
        $arTaskIDs[$arRes['LETTER']] = $arRes['ID'];
    }
    $arTasksForModule = array();
    foreach ($arAccessRights as $group => $letter) {
        $APPLICATION->SetGroupRight('timeman', $group, $letter);
        $arTasksForModule[$group] = array('ID' => $arTaskIDs[$letter]);
    }
    CGroup::SetTasksForModule('timeman', $arTasksForModule);
    if (CModule::IncludeModule('iblock')) {
        $fields_file = $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/timeman/install/fields.php";
        if (file_exists($fields_file)) {
            include $fields_file;
        }
        $dep = new CIBlockSection();
        if ($ib = COption::GetOptionInt('intranet', 'iblock_structure', false)) {
            $entity_id = 'IBLOCK_' . $ib . '_SECTION';
        }
        $arFields = array("UF_TM_TIME" => "16:00", "UF_TM_DAY" => 5);
Example #7
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
global $DBType;
require_once $_SERVER['DOCUMENT_ROOT'] . "/bitrix/modules/main/classes/" . strtolower($DBType) . "/favorites.php";
__IncludeLang(GetLangFileName(dirname(__FILE__) . "/lang/", "/" . basename(__FILE__)));
//Change site name
$obSite = new CSite();
$obSite->Update("s1", array("NAME" => COption::GetOptionString("main", "site_name", GetMessage("DEFAULT_SITE_NAME"))));
//Edit profile task
$editProfileTask = false;
$dbResult = CTask::GetList(array(), array("NAME" => "main_change_profile"));
if ($arTask = $dbResult->Fetch()) {
    $editProfileTask = $arTask["ID"];
}
//admin security policy
$z = CGroup::GetByID(1);
if ($res = $z->Fetch()) {
    if ($res["SECURITY_POLICY"] == "") {
        $group = new CGroup();
        $arGroupPolicy = array("SESSION_TIMEOUT" => 15, "SESSION_IP_MASK" => "255.255.255.255", "MAX_STORE_NUM" => 1, "STORE_IP_MASK" => "255.255.255.255", "STORE_TIMEOUT" => 60 * 24 * 3, "CHECKWORD_TIMEOUT" => 60, "PASSWORD_LENGTH" => 10, "PASSWORD_UPPERCASE" => "Y", "PASSWORD_LOWERCASE" => "Y", "PASSWORD_DIGITS" => "Y", "PASSWORD_PUNCTUATION" => "Y", "LOGIN_ATTEMPTS" => 3);
        $arFields = array("SECURITY_POLICY" => serialize($arGroupPolicy));
        $group->Update(1, $arFields);
    }
}
//Registered users group
$dbResult = CGroup::GetList($by, $order, array("STRING_ID" => "REGISTERED_USERS"));
if ($dbResult->Fetch()) {
    return;
 function SetTaskSecurity($task_id, $module_id, $arOperations, $letter = '')
 {
     $ID = 0;
     $dbr_task = CTask::GetList(array(), array('NAME' => $task_id, 'MODULE_ID' => $module_id, "BINDING" => 'module'));
     if ($ar_task = $dbr_task->Fetch()) {
         if ($ar_task['SYS'] == 'Y') {
             return false;
         }
         $ID = $ar_task['ID'];
     }
     $arFields = array("NAME" => $task_id, "LETTER" => $letter, "BINDING" => 'module', "MODULE_ID" => $module_id);
     if ($ID > 0) {
         $res = CTask::Update($arFields, $ID);
     } else {
         $ID = CTask::Add($arFields);
         $res = $ID > 0;
         if ($res) {
             $arBackup = CControllerClient::GetBackup();
             $arBackup['security_task'][] = $ID;
             CControllerClient::SetBackup($arBackup);
         }
     }
     if ($res) {
         CTask::SetOperations($ID, $arOperations, true);
     }
 }
Example #9
0
 function GetIdByLetter($letter, $module, $binding = 'module')
 {
     global $DB;
     static $TASK_LETTER_CACHE = array();
     if (!$letter) {
         return false;
     }
     if (!isset($TASK_LETTER_CACHE)) {
         $TASK_LETTER_CACHE = array();
     }
     $k = strtoupper($letter . '_' . $module . '_' . $binding);
     if (isset($TASK_LETTER_CACHE[$k])) {
         return $TASK_LETTER_CACHE[$k];
     }
     $z = CTask::GetList(array(), array("LETTER" => $letter, "MODULE_ID" => $module, "BINDING" => $binding, "SYS" => "Y"));
     if ($r = $z->Fetch()) {
         $TASK_LETTER_CACHE[$k] = $r['ID'];
         if ($r['ID']) {
             return $r['ID'];
         }
     }
     return false;
 }
while ($arRes = $db_groups->Fetch()) {
    $arGroups[] = $arRes;
}
if ($REQUEST_METHOD == "POST" && strlen($saveperm) > 0 && check_bitrix_sessid()) {
    $arTaskPerm = array();
    for ($i = 0, $l = count($arGroups); $i < $l; $i++) {
        $id = $arGroups[$i]['ID'];
        if (isset($_POST['g_' . $id]) && intVal($_POST['g_' . $id]) > 0) {
            $arTaskPerm[$id] = intVal($_POST['g_' . $id]);
        }
    }
    CMedialib::SaveAccessPermissions($curColId, $arTaskPerm);
}
$arGroupTask = CMedialib::GetAccessPermissionsArray($curColId, $ctRes['Collections']);
$arTasks = array();
$res = CTask::GetList(array('LETTER' => 'asc'), array('MODULE_ID' => 'fileman', 'BINDING' => 'medialib'));
while ($arRes = $res->Fetch()) {
    $name = $arRes['TITLE'];
    if (strlen($name) == 0) {
        $name = $arRes['NAME'];
    }
    $arTasks[$arRes['ID']] = array('title' => $name, 'letter' => $arRes['LETTER']);
}
?>

<form method="POST" action="<?php 
echo $APPLICATION->GetCurPage();
?>
?" name="ml_access_form">
<input type="hidden" name="site" value="<?php 
echo htmlspecialcharsbx($site);
Example #11
0
        CGroup::SetTasks($groupID, $arTasksID, true);
    }
    //Set tasks binding to file
    foreach ($arGroup["TASKS_FILE"] as $arFile) {
        $taskName = $arFile[0];
        $filePath = $arFile[1];
        $dbResult = CTask::GetList(array(), array("NAME" => $taskName));
        if ($arTask = $dbResult->Fetch()) {
            CExtranetWizardServices::SetFilePermission(array(WIZARD_SITE_ID, $filePath), array($groupID => "T_" . $arTask["ID"]));
        }
    }
}
// set view perms for employee groups
$rsGroupEmployees = CGroup::GetList($by = "c_sort", $order = "asc", array("STRING_ID" => "EMPLOYEES%"));
while ($arGroupEmployees = $rsGroupEmployees->Fetch()) {
    $dbResult = CTask::GetList(array(), array("NAME" => "fm_folder_access_read"));
    if ($arTask = $dbResult->Fetch()) {
        CExtranetWizardServices::SetFilePermission(array(WIZARD_SITE_ID, WIZARD_SITE_DIR), array($arGroupEmployees["ID"] => "T_" . $arTask["ID"]));
    }
}
$APPLICATION->SetGroupRight("fileman", WIZARD_EXTRANET_ADMIN_GROUP, "F");
$task_id = CTask::GetIdByLetter("F", "fileman");
if (intval($task_id) > 0) {
    CGroup::SetTasksForModule("fileman", array(WIZARD_EXTRANET_ADMIN_GROUP => array("ID" => $task_id)));
}
CWizardUtil::ReplaceMacros(WIZARD_SITE_PATH . "/.top.menu.php", array("EXTRANET_ADMIN_GROUP_ID" => $ExtranetAdminGroupID));
$rsUser = CUser::GetList($by = "ID", $order = "desc", array("GROUPS_ID" => array(1)));
while ($arAdminUser = $rsUser->Fetch()) {
    $arUserGroups = CUser::GetUserGroup($arAdminUser["ID"]);
    if (is_array($arUserGroups) && !in_array(WIZARD_EXTRANET_GROUP, $arUserGroups)) {
        $arUserGroups[] = WIZARD_EXTRANET_GROUP;
Example #12
0
 static function GetTasks()
 {
     static $arTasks = null;
     if ($arTasks == null) {
         $rs = CTask::GetList(array("LETTER" => "asc"), array("MODULE_ID" => "iblock", "BINDING" => "iblock", "SYS" => "Y"));
         $arTasks = array();
         while ($ar = $rs->Fetch()) {
             $arTasks[$ar["LETTER"]] = $ar["ID"];
         }
     }
     return $arTasks;
 }
# mailto:sources@bitrixsoft.com              #
##############################################
*/
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/controller/prolog.php";
$MOD_RIGHT = $APPLICATION->GetGroupRight("controller");
if ($MOD_RIGHT < "W") {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
IncludeModuleLangFile(__FILE__);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/controller/include.php";
$err_mess = "File: " . __FILE__ . "<br>Line: ";
$arThirdSettings = CControllerGroupSettings::Get3rdPartyOptions();
$subordinate_id = COperation::GetIDByName('edit_subordinate_users');
$arMainSubordinateTask = array();
$db_task = CTask::GetList(array("MODULE_ID" => "asc", "LETTER" => "asc"), array("BINDING" => 'module'));
while ($ar_task = $db_task->GetNext()) {
    if (!isset($arTasksModules[$ar_task['MODULE_ID']])) {
        $arTasksModules[$ar_task['MODULE_ID']] = array("reference" => array(), "reference_id" => array());
    }
    $arTasksModules[$ar_task['MODULE_ID']]["reference"][] = '[' . ($ar_task['LETTER'] ? $ar_task['LETTER'] : '..') . '] ' . CTask::GetLangTitle($ar_task['NAME']);
    $arTasksModules[$ar_task['MODULE_ID']]["reference_id"][] = $ar_task['NAME'];
    if ($ar_task['MODULE_ID'] == 'main') {
        $arOpInTask = CTask::GetOperations($ar_task['ID']);
        if (in_array($subordinate_id, $arOpInTask)) {
            $arMainSubordinateTask[] = $ar_task['NAME'];
        }
    }
}
if ($REQUEST_METHOD == "POST" && $COUNTER_UPDATE_PERIOD_TYPE != '' && (strlen($save) > 0 || strlen($apply) > 0) && $MOD_RIGHT >= "W") {
    if ($COUNTER_UPDATE_PERIOD_TYPE == 'H') {
 protected function loadIblockTasks()
 {
     if ($this->iblockTasks !== null) {
         return;
     }
     $rs = CTask::GetList(array("LETTER" => "asc"), array("MODULE_ID" => "iblock", "BINDING" => "iblock"));
     $this->iblockTasks = array();
     while ($row = $rs->fetch()) {
         $this->iblockTasks[$row["ID"]] = $row;
     }
     return;
 }
Example #15
0
	public static function GetAccessTasks($binging = 'calendar_section')
	{
		if (is_array(self::$arAccessTask[$binging]))
			return self::$arAccessTask[$binging];

		$bIntranet = self::IsIntranetEnabled();
		$arTasks = Array();
		$res = CTask::GetList(Array('ID' => 'asc'), Array('MODULE_ID' => 'calendar', 'BINDING' => $binging));
		while($arRes = $res->Fetch())
		{
			if (!$bIntranet && (strtolower($arRes['NAME']) == 'calendar_view_time' || strtolower($arRes['NAME']) == 'calendar_view_title'))
				continue;

			$name = '';
			if ($arRes['SYS'])
				$name = GetMessage('TASK_NAME_'.strtoupper($arRes['NAME']));
			if (strlen($name) == 0)
				$name = $arRes['NAME'];

			$arTasks[$arRes['ID']] = array(
				'name' => $arRes['NAME'],
				'title' => $name
			);
		}

		self::$arAccessTask[$binging] = $arTasks;

		return $arTasks;
	}
Example #16
0
	public static function GeneratePHPInstall($arValues)
	{
		$str = '';
		$arDefValues = $arValues["default"]["options"];
		$arInfo = CControllerGroupSettings::GetData();

		if(isset($arValues["default"]["modules"]))
		{
			$vArr = '';
			foreach($arInfo as $module_id=>$arProp)
			{
				if($module_id == 'main')
					continue;

				if(in_array($module_id, $arValues["default"]["modules"]))
					$vArr .= '"'.$module_id.'"=>"Y", ';
				else
					$vArr .= '"'.$module_id.'"=>"N", ';
			}
			$str .= 'CControllerClient::SetModules(Array('.$vArr.'));'."\r\n";
		}
		else
			$str .= 'CControllerClient::RestoreModules();'."\r\n";

		foreach($arInfo as $mname=>$arProp)
		{
				if(!is_array($arProp["options"]) || count($arProp["options"])<=0)
					continue;
				$arOptions = $arProp["options"];
				foreach($arOptions as $id=>$arOptionParams)
				{
					if(isset($arDefValues[$mname][$id]))
						$str .= 'CControllerClient::SetOptionString("'.EscapePHPString($mname).'", "'.EscapePHPString($id).'", "'.EscapePHPString($arDefValues[$mname][$id]).'");'."\r\n";
					elseif(substr($id, 0, 2)!='__')
						$str .= 'CControllerClient::RestoreOption("'.EscapePHPString($mname).'", "'.EscapePHPString($id).'");'."\r\n";
				}
		}

		$arSecurity = $arValues["default"]["security"];
		if($arSecurity["limit_admin"] == "Y")
			$str .= 'CControllerClient::SetOptionString("main", "~controller_limited_admin", "Y");'."\r\n";
		else
			$str .= 'CControllerClient::SetOptionString("main", "~controller_limited_admin", "N");'."\r\n";

		$subordinate_id = COperation::GetIDByName('edit_subordinate_users');

		$arGroups = Array();
		$arUniqTasks = Array();
		if(is_array($arSecurity["groups"]))
		{
			foreach($arSecurity["groups"] as $group_id=>$arPermissions)
			{
				$arDefinedPermissions = Array();
				$arUnDefinedPermissions = Array();
				$bSubOrdGroups = false;
				foreach($arInfo as $module_id=>$arProp)
				{
					if(isset($arPermissions[$module_id]))
					{
						$arDefinedPermissions[$module_id] = $arPermissions[$module_id];

						$task_id = $arPermissions[$module_id];

						if(strlen($task_id)>1 && (!is_array($arUniqTasks[$module_id]) || !in_array($task_id, $arUniqTasks[$module_id])))
						{
							$arUniqTasks[$module_id][] = $task_id;
							$dbr_task = CTask::GetList(Array(), Array('NAME'=>$task_id, 'MODULE_ID'=>$module_id, "BINDING" => 'module'));
							if($ar_task = $dbr_task->Fetch())
							{
								if($module_id == 'main' || $ar_task['SYS']!='Y')
								{
									$arOperations = CTask::GetOperations($ar_task["ID"], true);

									if($ar_task['SYS']!='Y')
									{
										$str .= 'CControllerClient::SetTaskSecurity('.CControllerGroupSettings::__PHPToString($task_id).', '.CControllerGroupSettings::__PHPToString($module_id).', '.CControllerGroupSettings::__PHPToString($arOperations).', '.CControllerGroupSettings::__PHPToString($ar_task["LETTER"]).');'."\r\n";
									}

									if($module_id == 'main' && in_array('edit_subordinate_users', $arOperations))
									{
										$bSubOrdGroups = true;
									}
								}
							}
						}
					}
					else
						$arUnDefinedPermissions[] = $module_id;
				}

				$str .= 'CControllerClient::RestoreGroupSecurity('.CControllerGroupSettings::__PHPToString($group_id).', '.CControllerGroupSettings::__PHPToString($arUnDefinedPermissions).');'."\r\n";

				if($bSubOrdGroups)
				{
					$arSGroupsTmp = preg_split("/[\r\n,;]+/", $arSecurity["subord_groups"][$group_id]);
					$arSGroups = array();
					foreach($arSGroupsTmp as $sGroupTmp)
					{
						$sGroupTmp = trim($sGroupTmp);
						if ($sGroupTmp != '')
							$arSGroups[] = $sGroupTmp;
					}

					$str .= 'CControllerClient::SetGroupSecurity('.CControllerGroupSettings::__PHPToString($group_id).', '.CControllerGroupSettings::__PHPToString($arDefinedPermissions).', '.CControllerGroupSettings::__PHPToString($arSGroups).');'."\r\n";
				}
				else
					$str .= 'CControllerClient::SetGroupSecurity('.CControllerGroupSettings::__PHPToString($group_id).', '.CControllerGroupSettings::__PHPToString($arDefinedPermissions).');'."\r\n";

				$arGroups[] = $group_id;
			}
		}

		$str .= 'CControllerClient::RestoreSecurity('.CControllerGroupSettings::__PHPToString($arGroups).');'."\r\n";

		$arThirdSettings = CControllerGroupSettings::Get3rdPartyOptions();
		foreach($arThirdSettings as $obOption)
		{
			$str .= $obOption->GetOptionPHPCode($arValues);
		}

		return $str;
	}
Example #17
0
        $rsData = CTask::GetList(array($by => $order), $arFilter);
        while ($arRes = $rsData->Fetch()) {
            $arID[] = $arRes['ID'];
        }
    }
    if ($_REQUEST['action'] == "delete") {
        foreach ($arID as $ID) {
            if (strlen($ID) <= 0) {
                continue;
            }
            CTask::Delete($ID);
        }
    }
}
// инициализация списка - выборка данных.
$rsData = CTask::GetList(array($by => $order), $arFilter);
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
// установке параметров списка
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("PAGES")));
// заголовок списка
$lAdmin->AddHeaders(array(array("id" => "ID", "content" => "ID", "sort" => "id", "default" => false, "align" => "right"), array("id" => "NAME", "content" => GetMessage("NAME"), "sort" => "", "default" => true), array("id" => "LETTER", "content" => GetMessage("LETTER"), "sort" => "letter", "default" => true), array("id" => "DESCRIPTION", "content" => GetMessage("MAIN_DESCRIPTION"), "sort" => "", "default" => true), array("id" => "MODULE_ID", "content" => GetMessage("MAIN_MODULE_ID"), "sort" => "module_id", "default" => true), array("id" => "SYS", "content" => GetMessage("SYS"), "sort" => "sys", "default" => true), array("id" => "BINDING", "content" => GetMessage("BINDING"), "sort" => "binding", "default" => true)));
// построение списка
while ($arRes = $rsData->NavNext(true, "f_")) {
    $row =& $lAdmin->AddRow($f_ID, $arRes, "task_edit.php?lang=" . LANGUAGE_ID . "&ID=" . $f_ID, GetMessage("MAIN_EDIT_TITLE"));
    $row->AddViewField("ID", "<a href='task_edit.php?lang=" . LANGUAGE_ID . "&ID=" . $f_ID . "' title='" . GetMessage("MAIN_EDIT_TITLE") . "'>" . $f_ID . "</a>");
    $sys = strtoupper($f_SYS) == 'Y';
    //$row->AddViewField("NAME", $f_TITLE);
    $row->AddViewField("NAME", "<a href='task_edit.php?lang=" . LANGUAGE_ID . "&ID=" . $f_ID . "' title='" . GetMessage("MAIN_EDIT_TITLE") . "'>" . $f_TITLE . "</a>");
    $row->AddViewField("DESCRIPTION", $f_DESC);
    $module_id_ = $f_MODULE_ID;
Example #18
0
     //Set tasks binding to module
     $arTasksID = array();
     foreach ($arGroup["TASKS_MODULE"] as $taskName) {
         $dbResult = CTask::GetList(array(), array("NAME" => $taskName));
         if ($arTask = $dbResult->Fetch()) {
             $arTasksID[] = $arTask["ID"];
         }
     }
     if (!empty($arTasksID)) {
         CGroup::SetTasks($groupID, $arTasksID, true);
     }
     //Set tasks binding to file
     foreach ($arGroup["TASKS_FILE"] as $arFile) {
         $taskName = $arFile[0];
         $filePath = $arFile[1];
         $dbResult = CTask::GetList(array(), array("NAME" => $taskName));
         if ($arTask = $dbResult->Fetch()) {
             WizardServices::SetFilePermission(array(WIZARD_SITE_ID, $filePath), array($groupID => "T_" . $arTask["ID"]));
         }
     }
     if ($arGroup["STRING_ID"] == "EMPLOYEES_" . WIZARD_SITE_ID) {
         WizardServices::SetFilePermission(array(WIZARD_SITE_ID, WIZARD_SITE_DIR), array("*" => 'D'));
         WizardServices::SetFilePermission(array(WIZARD_SITE_ID, WIZARD_SITE_DIR), array($groupID => 'R'));
     }
     if (WIZARD_IS_RERUN === false) {
         if ($arGroup["STRING_ID"] == "EMPLOYEES_" . WIZARD_SITE_ID) {
             COption::SetOptionString("main", "new_user_registration_def_group", $groupID);
         }
     }
 }
 if (!WIZARD_IS_RERUN) {
Example #19
0
 function CopyCommentRights($ID, $arFields)
 {
     if (empty($arFields['LOG_ID'])) {
         return false;
     }
     if (empty(self::$storedFileIdsByComment[$arFields['SOURCE_ID']])) {
         return false;
     }
     $arRights0 = array();
     $rConst = 0;
     $rs = CTask::GetList(array("LETTER" => "asc"), array("MODULE_ID" => "iblock", "LETTER" => "R"));
     if ($ar = $rs->Fetch()) {
         $rConst = $ar["ID"];
     } else {
         return false;
     }
     $dbRight = CSocNetLogRights::GetList(array(), array("LOG_ID" => $arFields["LOG_ID"]));
     $i = 1;
     while ($arRight = $dbRight->Fetch()) {
         /*$arRights0["n" .$i] = Array(
         			"GROUP_CODE" => $arRight["GROUP_CODE"],
         			"TASK_ID" => $rConst,
         		);*/
         $gc = $arRight["GROUP_CODE"];
         if (array_key_exists($gc, $arRights0) && $arRights0[$gc]["TASK_ID"] >= $rConst) {
             continue;
         }
         $arRights0[$gc] = array("KEY" => "n" . $i, "GROUP_CODE" => $gc, "TASK_ID" => $rConst);
         $i++;
     }
     $arFilesID = self::$storedFileIdsByComment[$arFields['SOURCE_ID']];
     $arFiles = array();
     foreach ($arFilesID as $id) {
         $id = intval($id);
         if (intval($id) > 0) {
             $arFiles[] = $id;
         }
     }
     if (!$arFiles) {
         return;
     }
     $ibe = new CIBlockElement();
     $dbWDFile = $ibe->GetList(array(), array('ID' => $arFiles, 'SHOW_NEW' => 'Y'), false, false, array('ID', 'NAME', 'SECTION_ID', 'IBLOCK_ID', 'WF_NEW'));
     while ($dbWDFile && ($arWDFile = $dbWDFile->Fetch())) {
         $arRights1 = $arRights0;
         $ob = new CIBlockElementRights($arWDFile['IBLOCK_ID'], $arWDFile['ID']);
         $ar = $ob->GetRights();
         foreach ($ar as $k => $v) {
             $gc = $v["GROUP_CODE"];
             if (array_key_exists($gc, $arRights1) && $arRights1[$gc]["TASK_ID"] >= $v["TASK_ID"]) {
                 continue;
             }
             $arRights1[$gc] = array("KEY" => $k, "GROUP_CODE" => $gc, "TASK_ID" => $v["TASK_ID"]);
         }
         $arRights2 = array();
         foreach ($arRights1 as $v) {
             $arRights2[$v["KEY"]] = array("GROUP_CODE" => $v["GROUP_CODE"], "TASK_ID" => $v["TASK_ID"]);
         }
         $ob->SetRights($arRights2);
     }
 }
Example #20
0
	public static function GetRightsList($bTitle = true)
	{
		global $DB;
		$arResult = array();

		$rs = CTask::GetList(
			array("LETTER"=>"asc"),
			array(
				"MODULE_ID" => "iblock",
			)
		);

		while($ar = $rs->Fetch())
			$arResult[$ar["ID"]] = $bTitle? $ar["TITLE"]: $ar["NAME"];

		return $arResult;
	}
Example #21
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);
Example #22
0
 protected static function getRightsTasks()
 {
     if (self::$cachedTasks === null) {
         $iterator = CTask::GetList(array("LETTER" => "asc"), array("MODULE_ID" => "iblock", "BINDING" => "iblock"));
         while ($ar = $iterator->fetch()) {
             self::$cachedTasks[$ar["LETTER"]] = $ar;
         }
     }
     return self::$cachedTasks;
 }
Example #23
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (WIZARD_IS_RERUN) {
    return;
}
if (!CModule::IncludeModule("fileman")) {
    return;
}
$arAccessRights = array(WIZARD_PORTAL_ADMINISTRATION_GROUP => 'F', WIZARD_PERSONNEL_DEPARTMENT_GROUP => 'F');
$arTaskIDs = array();
$dbRes = CTask::GetList(array(), array('MODULE_ID' => 'fileman', 'SYS' => 'Y', 'LETTER' => implode('|', $arAccessRights), 'BINDING' => 'module'));
while ($arRes = $dbRes->Fetch()) {
    $arTaskIDs[$arRes['LETTER']] = $arRes['ID'];
}
$arTasksForModule = array();
foreach ($arAccessRights as $group => $letter) {
    $APPLICATION->SetGroupRight('fileman', $group, $letter);
    $arTasksForModule[$group] = array('ID' => $arTaskIDs[$letter]);
}
CGroup::SetTasksForModule('fileman', $arTasksForModule);
Example #24
0
 private static function EnsureSharedFileSectionCreated($blockID, $siteID = SITE_ID)
 {
     $siteID = strval($siteID);
     $blockID = intval($blockID);
     if ($blockID <= 0 || $siteID === '') {
         return 0;
     }
     $blockSection = new CIBlockSection();
     $dbSections = $blockSection->GetList(array(), array('XML_ID' => 'VI_CALLS', 'IBLOCK_ID' => $blockID, 'CHECK_PERMISSIONS' => 'N'), false, array('ID'));
     $arSection = $dbSections->Fetch();
     if (is_array($arSection)) {
         $blockSectionID = intval($arSection['ID']);
     }
     if ($blockSectionID <= 0) {
         $dbSite = CSite::GetByID($siteID);
         $arSite = $dbSite->Fetch();
         IncludeModuleLangFile(__FILE__, $arSite && isset($arSite['LANGUAGE_ID']) ? $arSite['LANGUAGE_ID'] : false);
         $blockSectionID = $blockSection->Add(array('IBLOCK_ID' => $blockID, 'ACTIVE' => 'Y', 'NAME' => GetMessage('VI_DISK_CALL_RECORD_SECTION'), 'IBLOCK_SECTION_ID' => 0, 'CHECK_PERMISSIONS' => 'N', 'XML_ID' => 'VI_CALLS'));
         if (CIBlock::GetArrayByID($blockID, "RIGHTS_MODE") === "E") {
             $rightObject = CWebDavIblock::_get_ib_rights_object('IBLOCK', 0, $blockID);
             $existsRights = $rightObject->GetRights();
             $rs = CTask::GetList(array("LETTER" => "asc"), array("MODULE_ID" => "iblock", "BINDING" => "iblock", "SYS" => "Y"));
             $arTasks = array();
             while ($ar = $rs->Fetch()) {
                 $arTasks[$ar["NAME"]] = $ar["ID"];
             }
             $newRights = array();
             $i = 0;
             foreach ($existsRights as $existsRight) {
                 $newRights['n' . $i] = array('GROUP_CODE' => $existsRight['GROUP_CODE'], 'TASK_ID' => $arTasks['iblock_deny']);
                 $i++;
             }
             $rightObject = CWebDavIblock::_get_ib_rights_object('SECTION', $blockSectionID, $blockID);
             $rightObject->SetRights($newRights);
             $rights['n' . $i] = array('GROUP_CODE' => '', 'TASK_ID' => $arTasks['iblock_deny']);
             CWebDavIblock::appendRightsOnSections(array(array('ID' => $blockSectionID, 'IBLOCK_ID' => $blockID)), array('W' => array('G1')));
         }
     }
     return $blockSectionID;
 }