예제 #1
0
 public static function getAllowableUserGroups($documentType)
 {
     $storageId = self::getStorageIdByType($documentType);
     if (!$storageId) {
         throw new CBPArgumentNullException('documentType');
     }
     /** @var Storage $storage */
     $storage = Storage::loadById($storageId, array('ROOT_OBJECT'));
     if (!$storage) {
         throw new CBPArgumentNullException('documentType');
     }
     if ($storage->getProxyType() instanceof ProxyType\Group) {
         if (Loader::includeModule("socialnetwork")) {
             $resultUserGroups = array();
             $resultUserGroups["author"] = Loc::getMessage("DISK_USER_GROUPS_AUTHOR");
             $resultUserGroups[SONET_ROLES_OWNER] = Loc::getMessage("DISK_USER_GROUPS_OWNER");
             $resultUserGroups[SONET_ROLES_MODERATOR] = Loc::getMessage("DISK_USER_GROUPS_MODS");
             $resultUserGroups[SONET_ROLES_USER] = Loc::getMessage("DISK_USER_GROUPS_MEMBERS");
             return $resultUserGroups;
         }
     } else {
         $resultUserGroups = array('Author' => Loc::getMessage("DISK_USER_GROUPS_AUTHOR"));
         $groupIds = array(1);
         foreach (Driver::getInstance()->getRightsManager()->getSpecificRights($storage->getRootObject()) as $right) {
             if (preg_match("/^G(\\d+)\$/", $right['ACCESS_CODE'], $match)) {
                 $groupIds[] = $match[1];
             }
         }
         unset($right);
         //Crutch for Bitrix24 context (user group management is not supported)
         if (ModuleManager::isModuleInstalled('bitrix24')) {
             $siteId = \CAllSite::getDefSite();
             $employeeGroup = \CGroup::getList($by = '', $order = '', array('STRING_ID' => 'EMPLOYEES_' . $siteId, 'STRING_ID_EXACT_MATCH' => 'Y'))->fetch();
             if ($employeeGroup) {
                 $employeeGroupId = (int) $employeeGroup['ID'];
                 if (!in_array($employeeGroupId, $groupIds, true)) {
                     $groupIds[] = $employeeGroupId;
                 }
             }
         }
         $dbGroupsList = \CGroup::getListEx(array('NAME' => 'ASC'), array('ID' => $groupIds));
         while ($group = $dbGroupsList->fetch()) {
             $resultUserGroups[$group['ID']] = $group['NAME'];
         }
         return $resultUserGroups;
     }
 }
예제 #2
0
// sites
$slaSiteList = CTicketSLA::GetSiteArrayForAllSLA();

// groups
$slaGroupList = CTicketSLA::GetGroupArrayForAllSLA();

// groups info
$groupIds = array();
foreach ($slaGroupList as $slaId => $groups)
{
	$groupIds = array_merge($groupIds, $groups);
}
$groupIds = array_unique($groupIds);

$slaGroupNames = array();
$res = CGroup::getList($by=null, $order=null, array('ID' => join('|', $groupIds)));
while ($arRes = $res->Fetch())
{
	$slaGroupNames[$arRes['ID']] = $arRes['NAME'];
}

// users info
$slaResponsiblesInfo = array();
$slaResponsibles = array_unique($slaResponsibles);

if ($slaResponsibles)
{
	$res = CUser::getList($by=null, $order=null, array('ID' => join('|', $slaResponsibles)));
	while ($arRes = $res->Fetch())
	{
		$slaResponsiblesInfo[$arRes['ID']] = array(