class SupportTicketPreviewAccessCheck in Support Ticketing System 8
Determines access to support_ticket previews.
Hierarchy
- class \Drupal\support_ticket\Access\SupportTicketPreviewAccessCheck implements AccessInterface
Expanded class hierarchy of SupportTicketPreviewAccessCheck
1 string reference to 'SupportTicketPreviewAccessCheck'
- support_ticket.services.yml in modules/
support_ticket/ support_ticket.services.yml - modules/support_ticket/support_ticket.services.yml
1 service uses SupportTicketPreviewAccessCheck
File
- modules/
support_ticket/ src/ Access/ SupportTicketPreviewAccessCheck.php, line 20 - Contains \Drupal\support_ticket\Access\SupportTicketPreviewAccessCheck.
Namespace
Drupal\support_ticket\AccessView source
class SupportTicketPreviewAccessCheck implements AccessInterface {
/**
* The entity manager.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
*/
protected $entityManager;
/**
* Constructs a EntityCreateAccessCheck object.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
*/
public function __construct(EntityManagerInterface $entity_manager) {
$this->entityManager = $entity_manager;
}
/**
* Checks access to the support_ticket preview page.
*
* @param \Drupal\Core\Session\AccountInterface $account
* The currently logged in account.
* @param \Drupal\support_ticket\SupportTicketInterface $support_ticket_preview
* The support_ticket that is being previewed.
*
* @return string
* A \Drupal\Core\Access\AccessInterface constant value.
*/
public function access(AccountInterface $account, SupportTicketInterface $support_ticket_preview) {
if ($support_ticket_preview
->isNew()) {
$access_controller = $this->entityManager
->getAccessControlHandler('support_ticket');
return $access_controller
->createAccess($support_ticket_preview
->bundle(), $account, [], TRUE);
}
else {
return $support_ticket_preview
->access('update', $account, TRUE);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SupportTicketPreviewAccessCheck:: |
protected | property | The entity manager. | |
SupportTicketPreviewAccessCheck:: |
public | function | Checks access to the support_ticket preview page. | |
SupportTicketPreviewAccessCheck:: |
public | function | Constructs a EntityCreateAccessCheck object. |