Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Extensions
OSDI
Commits
40420853
Commit
40420853
authored
Aug 28, 2018
by
andy gu
Browse files
\Merge branch 'master' of
https://github.com/4ndygu/civicrm_osdi
into remove_root_endpoint
parents
548281b6
57a38700
Changes
1
Hide whitespace changes
Inline
Side-by-side
CRM/Osdi/Page/Webhook.php
View file @
40420853
...
...
@@ -36,7 +36,7 @@ class CRM_Osdi_Page_Webhook extends CRM_Core_Page {
*
*/
public
function
run
()
{
header
(
'Content-Type:application/hal+json'
,
TRUE
);
// Check CMS's permission for (presumably) anonymous users.
if
(
CRM_Core_Config
::
singleton
()
->
userPermissionClass
->
isModulePermissionSupported
()
&&
!
CRM_Osdi_Permission
::
check
(
'allow webhook posts'
))
{
header
(
'Content-Type:application/hal+json'
,
TRUE
,
500
);
...
...
@@ -65,7 +65,7 @@ class CRM_Osdi_Page_Webhook extends CRM_Core_Page {
if
(
$object
==
NULL
)
{
header
(
'Content-Type:application/hal+json'
,
TRUE
,
500
);
print
"Missing allow webhook posts permission
.
"
;
print
"Missing allow webhook posts permission
, no Object header set
"
;
CRM_Utils_System
::
civiExit
();
// parent::run();
...
...
@@ -88,6 +88,8 @@ class CRM_Osdi_Page_Webhook extends CRM_Core_Page {
header
(
'Content-Type:application/hal+json'
,
TRUE
,
200
);
print
json_encode
(
$result
[
"values"
]);
CRM_Utils_System
::
civiExit
();
return
;
}
elseif
(
$_SERVER
[
'REQUEST_METHOD'
]
===
'POST'
)
{
$contact
=
json_decode
(
file_get_contents
(
'php://input'
),
TRUE
);
...
...
@@ -211,6 +213,8 @@ class CRM_Osdi_Page_Webhook extends CRM_Core_Page {
}
header
(
'Content-Type:application/hal+json'
,
TRUE
,
200
);
print
json_encode
(
convertContactOSDI
(
$result
[
"values"
][
0
],
array
()),
JSON_PRETTY_PRINT
);
CRM_Utils_System
::
civiExit
();
return
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment