You are here

function pmp_permissions_create_permission in Public Media Platform API Integration 7

Creates PMPAPI permission object from a group GUID, list type, and operation.

Parameters

$group string: A permissions group GUID.

$blacklist boolean: Whether or not the permission should be a blacklist

Return value

object A permissions object, if a permission is needed, or NULL.

4 calls to pmp_permissions_create_permission()
PMPAPIPermissionsWebTestCase::createNodeWithPermissions in pmpapi_permissions/tests/pmpapi_permissions.test
pmpapi_permissions_entity_presave in pmpapi_permissions/pmpapi_permissions.module
Implements hook_entity_presave().
pmpapi_permissions_set_file_permissions in pmpapi_permissions/pmpapi_permissions.module
Creates a PMP permission object from fields, then attaches it to the file object in the form.
pmpapi_permissions_set_node_permissions in pmpapi_permissions/pmpapi_permissions.module
Creates a PMP permission object from fields, then attaches it to the node object in the form.

File

pmpapi_permissions/pmpapi_permissions.module, line 283

Code

function pmp_permissions_create_permission($group, $blacklist = FALSE, $operation = 'read') {
  $permission = NULL;
  if ($group !== NULL) {
    $permission = new stdClass();
    $permission->href = variable_get('pmpapi_base_url') . '/docs/' . $group;
    $permission->operation = $operation;
    if ($blacklist) {

      // If blacklist == FALSE, don't even bother to add a blacklist property.
      $permission->blacklist = TRUE;
    }
  }
  return $permission;
}