You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
2.7 KiB
Plaintext
46 lines
2.7 KiB
Plaintext
<?php
|
|
|
|
function fulcrm_webhook_permission() {
|
|
return array( 'administer fulcrm webhooks' => array( 'title' => t('Administer fulcrm webhooks'),
|
|
'description' => t('Perform main installation/administration tasks for fulcrm webhooks.'),
|
|
),
|
|
);
|
|
}
|
|
|
|
function fulcrm_webhook_menu() {
|
|
/*
|
|
$items[ 'admin/config/services/fulcrm' ] = array( 'page callback' => 'system_admin_menu_block_page',
|
|
'file' => 'system.admin.inc',
|
|
'file path' => drupal_get_path('module', 'system'),
|
|
'title' => 'fulcrm',
|
|
'description' => 'Configuration integration with fulcrm.org.',
|
|
'position' => 'right',
|
|
'access callback' => 'user_access',
|
|
'access arguments' => array('access administration pages'),
|
|
);
|
|
*/
|
|
$items[ 'admin/config/services/fulcrm/webhook' ] = array( 'page callback' => 'fulcrm_webhook_admin',
|
|
'file' => 'fulcrm_webhook.admin.inc',
|
|
'title' => 'fulcrm webhooks',
|
|
'description' => 'Configure webhooks for fulcrm.org.',
|
|
'access callback' => 'user_access',
|
|
'access arguments' => array('administer fulcrm webhooks'),
|
|
);
|
|
$items[ 'services/fulcrm/webhook/%' ] = array( 'page callback' => 'fulcrm_webhook_webhook',
|
|
'page arguments' => array(3),
|
|
'type' => MENU_CALLBACK,
|
|
'access callback' => 'user_access',
|
|
'access arguments' => array('access content'),
|
|
);
|
|
|
|
return $items;
|
|
}
|
|
|
|
function fulcrm_webhook_webhook( $uuid ) {
|
|
if ( $uuid === variable_get( 'fulcrm_webhook_url' ) ) {
|
|
drupal_json_output( array( 'status' => 'ok' ) );
|
|
} else {
|
|
drupal_json_output( array( 'error' => 'incorrect webhook UUID' ) );
|
|
}
|
|
}
|