silverstripe-framework/src/Security/NullSecurityToken.php

78 lines
1.3 KiB
PHP
Raw Permalink Normal View History

<?php
namespace SilverStripe\Security;
2016-09-09 08:43:05 +02:00
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Forms\FieldList;
/**
* Specialized subclass for disabled security tokens - always returns
* TRUE for token checks. Use through {@link SecurityToken::disable()}.
*/
class NullSecurityToken extends SecurityToken
{
2016-11-29 00:31:16 +01:00
/**
2020-12-21 22:23:23 +01:00
* @param string $compare
* @return bool
2016-11-29 00:31:16 +01:00
*/
public function check($compare)
{
return true;
}
2016-11-29 00:31:16 +01:00
/**
* @param HTTPRequest $request
* @return Boolean
*/
public function checkRequest($request)
{
return true;
}
2016-11-29 00:31:16 +01:00
/**
* @param FieldList $fieldset
* @return false
*/
public function updateFieldSet(&$fieldset)
{
// Remove, in case it was added beforehand
$fieldset->removeByName($this->getName());
2016-11-29 00:31:16 +01:00
return false;
}
2016-11-29 00:31:16 +01:00
/**
2020-12-21 22:23:23 +01:00
* @param string $url
* @return string
2016-11-29 00:31:16 +01:00
*/
public function addToUrl($url)
{
return $url;
}
2016-11-29 00:31:16 +01:00
/**
2020-12-21 22:23:23 +01:00
* @return string
2016-11-29 00:31:16 +01:00
*/
public function getValue()
{
return null;
}
2016-11-29 00:31:16 +01:00
/**
2020-12-21 22:23:23 +01:00
* @param string $val
2016-11-29 00:31:16 +01:00
*/
public function setValue($val)
{
// no-op
}
2016-11-29 00:31:16 +01:00
/**
2020-12-21 22:23:23 +01:00
* @return string
2016-11-29 00:31:16 +01:00
*/
public function generate()
{
return null;
}
}