forked from nuvoleweb/integration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
integration.module
57 lines (51 loc) · 1.41 KB
/
integration.module
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
<?php
/**
* @file
* Module file.
*/
include_once 'includes/integration.entity.inc';
include_once 'includes/integration.hooks.inc';
use Drupal\integration\Backend\Configuration\BackendConfiguration;
/**
* Implements hook_permission().
*/
function integration_permission() {
return [
'administer backends' => [
'title' => t('Administer integration layer backends'),
],
];
}
/**
* Determines whether the given user can perform actions on an entity.
*
* @param string $op
* Operation being performed: 'view', 'update', 'create' or 'delete'.
* @param BackendConfiguration|NULL $backend
* Optionally an entity to check access for.
* @param object|NULL $account
* The user to check for. Leave it to NULL to check for the global user.
* @param string|NULL $entity_type
* The entity type of the entity to check for.
*
* @return bool
* Whether access is allowed or not.
*
* @see entity_type_supports()
* @see integration_producer_entity_info()
*/
function integration_backend_access($op, $backend, $account, $entity_type) {
return user_access('administer backends');
}
/**
* Load backend entity given its machine name.
*
* @param string $machine_name
* Backend configuration entity machine name.
*
* @return BackendConfiguration
* Backend configuration entity.
*/
function integration_load_backend($machine_name) {
return entity_load_single('integration_backend', $machine_name);
}