You are here

function _node_registration_secret_access in Node registration 7

Checks whether the given or global user has access to a registration by checking ownership or the registration's secret.

1 call to _node_registration_secret_access()
node_registration_access in includes/node_registration.api.inc
All Registration access callbacks. Just like node.module has node_access.

File

includes/node_registration.api.inc, line 601
Registration API functions.

Code

function _node_registration_secret_access($registration, $account = NULL) {
  global $user;
  $account or $account = $user;

  // Authenticated.
  if ($account->uid) {

    // User is author.
    if ($registration->uid == $account->uid) {
      return TRUE;
    }
  }
  else {

    // Anonymous registration with matching secret.
    if (!$registration->uid && isset($_GET['secret']) && $_GET['secret'] == $registration->secret) {
      return TRUE;
    }
  }
  return FALSE;
}