class ContextCurrentUserAuth in TMGMT Translator Smartling 8
Same name and namespace in other branches
- 8.4 src/Context/ContextCurrentUserAuth.php \Drupal\tmgmt_smartling\Context\ContextCurrentUserAuth
- 8.2 src/Context/ContextCurrentUserAuth.php \Drupal\tmgmt_smartling\Context\ContextCurrentUserAuth
- 8.3 src/Context/ContextCurrentUserAuth.php \Drupal\tmgmt_smartling\Context\ContextCurrentUserAuth
Hierarchy
- class \Drupal\tmgmt_smartling\Context\ContextCurrentUserAuth
Expanded class hierarchy of ContextCurrentUserAuth
1 string reference to 'ContextCurrentUserAuth'
1 service uses ContextCurrentUserAuth
File
- src/
Context/ ContextCurrentUserAuth.php, line 9
Namespace
Drupal\tmgmt_smartling\ContextView source
class ContextCurrentUserAuth {
/**
* @var AccountInterface
*/
protected $currentAccount;
/**
* ContextCurrentUserAuth constructor.
* @param AccountInterface $account
*/
public function __construct(AccountInterface $account) {
$this->currentAccount = $account;
}
/**
* Returns cookies of the needed user.
*
* @param string $name
* @return string
* @throws WrongUsernameException
*/
public function getCookies($name) {
if ($this->currentAccount
->getAccountName() !== $name) {
throw new WrongUsernameException('You tried to authenticate with a username that is different from the current user. This feature wasn\'t implemented yet.');
}
return session_name() . "=" . session_id();
}
public function getCurrentAccount() {
return $this->currentAccount;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContextCurrentUserAuth:: |
protected | property | ||
ContextCurrentUserAuth:: |
public | function | Returns cookies of the needed user. | |
ContextCurrentUserAuth:: |
public | function | ||
ContextCurrentUserAuth:: |
public | function | ContextCurrentUserAuth constructor. |