You are here

public function NodeAccess::canUserDeleteNode in Permissions by Term 8.2

Same name and namespace in other branches
  1. 8 src/Service/NodeAccess.php \Drupal\permissions_by_term\Service\NodeAccess::canUserDeleteNode()

Parameters

$uid:

$nodeType:

$nid:

Return value

bool

File

src/Service/NodeAccess.php, line 137

Class

NodeAccess
Class NodeAccess

Namespace

Drupal\permissions_by_term\Service

Code

public function canUserDeleteNode($uid, $nodeType, $nid) {
  $user = $this
    ->getUserInstance($uid);
  if ($user
    ->hasPermission('delete any ' . $nodeType . ' content')) {
    return TRUE;
  }
  if ($this
    ->isNodeOwner($nid, $uid) && $this
    ->canDeleteOwnNode($uid, $nodeType)) {
    return TRUE;
  }
  return FALSE;
}