DBObject1core/cmdb,view_in_guifalseautoincrementpriv_lnk_action_notif_to_contactidfalsetrueaction_idActionNotificationfalseDEL_AUTOcontact_idContactfalseDEL_AUTOtrigger_idTriggerfalseDEL_AUTOsubscribedtruefalse102030401020304010203040ActionNotificationcmdbAbstractObjectgrant_by_profile,core/cmdb,applicationfalseautoincrementpriv_action_newsroomidtitlefalsemessagefalseicontrue9696256256priority12344falsetest_recipient_idtruePersonDEL_MANUALrecipientsfalseurl$this->url()$false1020304050601020102030405010203040 /**
*
* Create EventNotificationNewsroom for each recipient
* @param $oTrigger
* @param $aContextArgs
*
* @return void
* @throws \ArchivedObjectException
* @throws \CoreCannotSaveObjectException
* @throws \CoreException
* @throws \CoreUnexpectedValue
* @throws \CoreWarning
* @throws \MySQLException
* @throws \OQLException
*/falsepublicGet('recipients'));
$oPotentialRecipientsSearch->AllowAllData();
$oPotentialRecipientsSet = new DBObjectSet($oPotentialRecipientsSearch, array(), $aContextArgs);
$bIsAsync = $this->IsAsynchronous();
[$sPreviousLanguage, $aPreviousPluginProperties] = $this->SetNotificationLanguage();
$sMessage = MetaModel::ApplyParams($this->Get('message'), $aContextArgs);
$sTitle = MetaModel::ApplyParams($this->Get('title'), $aContextArgs);
$sUrl = MetaModel::ApplyParams($this->Get('url'), $aContextArgs);
$iObjectId = 0;
$sObjectClass = null;
if (array_key_exists('this->object()', $aContextArgs)) {
$iObjectId = $aContextArgs['this->object()']->GetKey();
$sObjectClass = get_class($aContextArgs['this->object()']);
}
if ($this->IsBeingTested()) {
// If action is being tested, send notification to the test recipient only, no matter what (unsubscribed, disabled, no access to the backoffice, ...)
$iTestRecipientId = $this->Get('test_recipient_id');
if ($iTestRecipientId > 0) {
$aRecipientsIds[] = $iTestRecipientId;
}
} else {
// Otherwise, find the recipients to which we can actually send the notification among all the potential ones
while ($oPotentialRecipient = $oPotentialRecipientsSet->Fetch()) {
// Skip recipients that have no users
if ($oPotentialRecipient instanceof Person && UserRights::GetUserFromPerson($oPotentialRecipient, false) === null) {
continue;
}
// Skip potential recipient that have no user with access to the backoffice
$oPotentialRecipientUsersSearch = DBObjectSearch::FromOQL("SELECT User WHERE contactid = " . $oPotentialRecipient->GetKey() . " AND status = 'enabled'");
$oPotentialRecipientUsersSearch->AllowAllData();
$oPotentialRecipientUsersSet = new DBObjectSet($oPotentialRecipientUsersSearch);
$oPortalDispatcher = new PortalDispatcher('backoffice');
// - Check if the user has access to the backoffice
$bHasAccessToBackoffice = false;
while ($oPotentialRecipientUser = $oPotentialRecipientUsersSet->Fetch()) {
// Skip potential recipients with user that don't have access to the backoffice
if (false === $oPortalDispatcher->IsUserAllowed($oPotentialRecipientUser)) {
continue;
}
$bHasAccessToBackoffice = true;
break;
}
// - Skip it if necessary
if (false === $bHasAccessToBackoffice) {
continue;
}
// Skip potential recipients that have unsubscribed
if (!\Combodo\iTop\Service\Notification\NotificationsService::GetInstance()->IsSubscribed($oTrigger, $this, $oPotentialRecipient)) {
continue;
}
$aRecipientsIds[] = $oPotentialRecipient->GetKey();
// Register subscription even though the notification is not sent yet
\Combodo\iTop\Service\Notification\NotificationsService::GetInstance()->RegisterSubscription($oTrigger, $this, $oPotentialRecipient);
}
}
try {
if ($bIsAsync === true) {
AsyncSendNewsroom::AddToQueue($this->GetKey(), $oTrigger->GetKey(), $aRecipientsIds, $sMessage, $sTitle, $sUrl, $iObjectId, $sObjectClass);
} else {
foreach ($aRecipientsIds as $iRecipientId) {
$oEvent = Combodo\iTop\Service\Notification\Event\EventNotificationNewsroomService::MakeEventFromAction($this, $iRecipientId, $oTrigger->GetKey(), $sMessage, $sTitle, $sUrl, $iObjectId, $sObjectClass);
$oEvent->DBInsertNoReload();
}
}
} catch (CoreCannotSaveObjectException $e) {
ExceptionLog::LogException($e);
foreach($aRecipientsIds as $iRecipientId) {
$oEvent = Combodo\iTop\Service\Notification\Event\EventNotificationNewsroomService::MakeEventFromAction($this,
$iRecipientId,
$oTrigger->GetKey(),
Dict::S('Core:EventNotificationNewsroom:ErrorOnDBInsert'),
Dict::S('Core:EventNotificationNewsroom:ErrorNotificationNotSent'),
$sUrl,
$iObjectId,
$sObjectClass
);
$oEvent->DBInsertNoReload();
}
}
$this->SetNotificationLanguage($sPreviousLanguage, $aPreviousPluginProperties['language_code'] ?? null);
}
]]>truepublicGet('notifications.itop.send_asynchronously');
}
]]>EventNotificationcmdbAbstractObjectcore/cmdb,view_in_guifalseautoincrementpriv_event_newsroomidtitlefalseicontruepriority12344falseurlfalse_blankreadyesnonofalseread_datetruecontact_idContactfalse10203040506070801020102030405010203040REST Services UserOnly users having this profile are allowed to use the REST Web Services (unless 'secure_rest_services' is set to false
in the configuration file).
cmdbAbstractObjectcore,grant_by_profilePersoncmdbAbstractObjectaddon/userrights,grant_by_profilecmdbAbstractObjectaddon/userrights,grant_by_profile1UserURP_ProfilescmdbAbstractObjectaddon/userrights,grant_by_profileUserOrganizationcmdbAbstractObjectgrant_by_profile,core/cmdbcmdbAbstractObjectgrant_by_profile,core/cmdbcmdbAbstractObjectcore/cmdb,view_in_gui,grant_by_profileUserContactcmdbAbstractObjectcore/cmdb,view_in_gui,grant_by_profileSynchroDataSourcecmdbAbstractObjectapplication, grant_by_profileAuditCategorycmdbAbstractObjectapplication, grant_by_profilecmdbAbstractObjectapplication, grant_by_profilecmdbAbstractObjectcore/cmdb,view_in_gui,application,grant_by_profilecmdbAbstractObjectgrant_by_profile,core/cmdb,applicationActionTriggercmdbAbstractObjectbizmodelActiongrant_by_profile,core/cmdbDBObjectcore/cmdb,view_in_guiEventcore/cmdb,view_in_guiTriggerActionsqltruestringlinked_classtruestringext_key_to_metruestringext_key_to_remotetruestringsqltruestringclass_attcodetruestringextkey_attcodetruestringtarget_attcodetruestringitem_codetruestringrelation_codetruestringfrom_classtruestringneighbour_idtruestringenabled_modetruestringmin_up_modetruestringmin_up_typetruestringhandler_classtruestringclass_fieldtruestringquery_fieldtruestringdisplay_stylefalsestringtargetfalsestringdefault_valuefalsestringattribute_definition_listfalsestringattribute_definition_exclusion_listfalsestringclass_exclusion_listfalsestringmin_uptruenumbercount_minfalsenumber0count_maxfalsenumber0max_combo_lengthfalsenumbermin_autocomplete_charsfalsenumberdisplay_max_widthfalsenumber128display_max_heightfalsenumber128storage_max_widthfalsenumber256storage_max_heightfalsenumber256max_itemsfalsenumber12tag_code_max_lenfalsenumber20enabledtruebooleanduplicatesfalsebooleanfalseis_null_allowedfalsebooleanfalseallow_target_creationfalsebooleanis_user_editablefalsebooleantruewith_php_constraintfalsebooleanfalsewith_php_computationfalsebooleanfalsecreate_temporary_objectfalsebooleanfalseon_target_deletefalsephptargetclasstruestringgoal_computingfalsestring'DefaultMetricComputer'working_time_computingfalsestringDashlet{{query.selected_class}}bars{{query.selected_class}}{{aggregation_function.value != 'count'}}{{query.selected_class}}numeric{{order_by.value = 'function'}}descDashletbizmodelDashlet{{query.selected_class}}enum{{query.selected_class}}{{group_by.value}}