public function ProtectionRule::hasProtection in User protect 8
Returns if the given protection is enabled on this rule.
Parameters
string $protection: The protection to check.
Return value
bool TRUE if the protection is enabled. FALSE otherwise.
Overrides ProtectionRuleInterface::hasProtection
1 call to ProtectionRule::hasProtection()
- ProtectionRule::isProtected in src/
Entity/ ProtectionRule.php - Checks if a given operation on an user should be protected.
File
- src/
Entity/ ProtectionRule.php, line 336
Class
- ProtectionRule
- Defines the Protection rule entity.
Namespace
Drupal\userprotect\EntityCode
public function hasProtection($protection) {
if ($this
->getProtections()
->has($protection)) {
return $this
->getProtection($protection)
->isEnabled();
}
return FALSE;
}