You are here

public function EntityLegalDocument::userMustAgree in Entity Legal 7

Same name and namespace in other branches
  1. 7.2 entity_legal.entity.inc \EntityLegalDocument::userMustAgree()

Checks to see if a given user can agree to this document.

Parameters

bool $new_user: Whether or not the user to check is a new user signup or not.

object $account: The user account to check the access permissions of. Defaults to the current user if none is provided.

Return value

bool Can a user agree to this document.

File

./entity_legal.entity.inc, line 240
Entity API main classes used by entity_legal module.

Class

EntityLegalDocument
Legal Document entity with revision support.

Code

public function userMustAgree($new_user = FALSE, $account = NULL) {

  // User cannot agree unless there is a published version.
  if (!$this
    ->getPublishedVersion()) {
    return FALSE;
  }
  if ($new_user) {
    return !empty($this->require_signup);
  }
  else {
    return !empty($this->require_existing) && user_access($this
      ->getPermissionExistingUser(), $account);
  }
}