-
Notifications
You must be signed in to change notification settings - Fork 2
/
gpapi.php
79 lines (71 loc) · 2.89 KB
/
gpapi.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
/*-------------------------------------------------------+
| Greenpeace.at API |
| Copyright (C) 2017 SYSTOPIA |
+--------------------------------------------------------+
| This program is released as free software under the |
| Affero GPL license. You can redistribute it and/or |
| modify it under the terms of this license which you |
| can read by viewing the included agpl.txt or online |
| at www.gnu.org/licenses/agpl.html. Removal of this |
| copyright header is strictly prohibited without |
| written permission from the original author(s). |
+--------------------------------------------------------*/
require_once 'gpapi.civix.php';
/**
* Implements hook_civicrm_config().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_config
*/
function gpapi_civicrm_config(&$config) {
_gpapi_civix_civicrm_config($config);
}
/**
* Implements hook_civicrm_install().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_install
*/
function gpapi_civicrm_install() {
_gpapi_civix_civicrm_install();
}
/**
* Implements hook_civicrm_enable().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_enable
*/
function gpapi_civicrm_enable() {
_gpapi_civix_civicrm_enable();
}
/**
* Define custom (Drupal) permissions
*/
function gpapi_civicrm_permission(&$permissions) {
$permissions['access OSF API'] = 'GP-API: access OSF API';
$permissions['access Engage API'] = 'GP-API: access Engage API';
$permissions['access Newsletter API'] = 'GP-API: access Newsletter API';
}
/**
* Set permissions for runner/engine API call
*/
function gpapi_civicrm_alterAPIPermissions($entity, $action, &$params, &$permissions) {
// OSF
$permissions['o_s_f']['submit'] = ['access OSF API'];
$permissions['o_s_f']['donation'] = ['access OSF API'];
$permissions['o_s_f']['order'] = ['access OSF API'];
$permissions['o_s_f']['contract'] = ['access OSF API'];
$permissions['o_s_f']['getcampaigns'] = ['access OSF API'];
$permissions['o_s_f']['getproducts'] = ['access OSF API'];
$permissions['o_s_f']['getcontact'] = ['access OSF API'];
$permissions['o_s_f']['getcontract'] = ['access OSF API'];
$permissions['o_s_f']['updatecontract'] = ['access OSF API'];
// Engage
$permissions['engage']['signpetition'] = ['access Engage API'];
$permissions['engage']['getcampaigns'] = ['access Engage API'];
$permissions['engage']['getmedia'] = ['access Engage API'];
$permissions['engage']['getpetitions'] = ['access Engage API'];
$permissions['engage']['startcase'] = ['access Engage API'];
// Newsletter
$permissions['newsletter']['subscribe'] = ['access Newsletter API'];
$permissions['newsletter']['unsubscribe'] = ['access Newsletter API'];
$permissions['newsletter']['getgroups'] = ['access Newsletter API'];
}