-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy_example.services.inc
More file actions
108 lines (101 loc) · 2.62 KB
/
deploy_example.services.inc
File metadata and controls
108 lines (101 loc) · 2.62 KB
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
/**
* @file
* deploy_example.services.inc
*/
/**
* Implements hook_default_services_endpoint().
*/
function deploy_example_default_services_endpoint() {
$export = array();
/* Deploy */
$enabled_resources = array();
$available_resources = services_get_resources();
foreach ($available_resources as $type => $data) {
if (in_array($type, array('system', 'user'))) {
continue;
}
$enabled_resources[$type] = array('operations' => array());
foreach (array_keys($data['operations']) as $operation) {
switch ($operation) {
case 'create':
case 'retrieve':
case 'update':
$enabled_resources[$type]['operations'][$operation] = array('enabled' => TRUE);
break;
}
}
}
$enabled_resources['user'] = array(
'actions' => array(
'login' => array(
'enabled' => '1',
),
'logout' => array(
'enabled' => '1',
),
'token' => array(
'enabled' => '1',
),
),
);
$endpoint = new stdClass();
$endpoint->disabled = FALSE;
$endpoint->api_version = 3;
$endpoint->name = 'deploy';
$endpoint->server = 'rest_server';
$endpoint->path = 'deploy';
$endpoint->authentication = array(
'services' => 'services',
);
$endpoint->server_settings = array(
'formatters' => array(
'json' => TRUE,
),
'parsers' => array(
'application/json' => TRUE,
),
);
$endpoint->resources = $enabled_resources;
$endpoint->debug = variable_get('deploy_example_debug', 0);
$export['deploy'] = $endpoint;
/* Entity Diff */
$endpoint = new stdClass();
$endpoint->disabled = FALSE;
$endpoint->api_version = 3;
$endpoint->name = 'entity_diff';
$endpoint->server = 'rest_server';
$endpoint->path = 'entity-diff';
$endpoint->authentication = array(
'services_basic_auth' => 'services_basic_auth',
);
$endpoint->server_settings = array(
'formatters' => array(
'json' => TRUE,
'bencode' => FALSE,
'jsonp' => FALSE,
'php' => FALSE,
'xml' => FALSE,
),
'parsers' => array(
'application/json' => TRUE,
'application/vnd.php.serialized' => FALSE,
'application/x-www-form-urlencoded' => FALSE,
'application/xml' => FALSE,
'multipart/form-data' => FALSE,
'text/xml' => FALSE,
),
);
$endpoint->resources = array(
'deploy' => array(
'targeted_actions' => array(
'diff' => array(
'enabled' => '1',
),
),
),
);
$endpoint->debug = variable_get('deploy_example_debug', 0);
$export['entity_diff'] = $endpoint;
return $export;
}