diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a02554ec5..f2bbb7bc06 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,14 +13,21 @@ * Fixed `Route::withQueryParam()` to accept array values # v1.4.4 -## 04/12/2018 +## 05/11/2018 1. [](#new) + * Added support for `Uri::post()` and `Uri::getConentType()` * Added a new `Medium:thumbnailExists()` function [#1966](https://github.com/getgrav/grav/issues/1966) + * Added `authorized` support for 2FA +1. [](#improved) + * Added default configuration for images [#1979](https://github.com/getgrav/grav/pull/1979) + * Added dedicated PHPUnit assertions [#1990](https://github.com/getgrav/grav/pull/1990) 1. [](#bugfix) + * Use `array_key_exists` instead of `in_array + array_keys` [#1991](https://github.com/getgrav/grav/pull/1991) * Fixed an issue with `custom_base_url` always causing 404 errors * Improve support for regex redirects with query and params [#1983](https://github.com/getgrav/grav/issues/1983) * Changed collection-based date sorting to `SORT_REGULAR` for better server compatibility [#1910](https://github.com/getgrav/grav/issues/1910) + * Fix hardcoded string in modular blueprint [#1933](https://github.com/getgrav/grav/pull/1993) # v1.4.3 ## 04/12/2018 diff --git a/system/src/Grav/Common/User/User.php b/system/src/Grav/Common/User/User.php index c1e628d507..8baec6333d 100644 --- a/system/src/Grav/Common/User/User.php +++ b/system/src/Grav/Common/User/User.php @@ -17,6 +17,9 @@ class User extends Data { + protected $authenticated; + protected $authorized; + /** * Load user account. * @@ -102,6 +105,55 @@ public static function remove($username) return false; } + + public function offsetExists($offset) + { + if ($offset === 'authenticated') { + return null !== $this->authenticated; + } + if ($offset === 'authorized') { + return null !== $this->authorized; + } + + return parent::offsetExists($offset); + } + + public function offsetGet($offset) + { + if ($offset === 'authenticated') { + return null !== $this->authenticated ? $this->authenticated : false; + } + if ($offset === 'authorized') { + return null !== $this->authorized ? $this->authorized : $this->authenticated; + } + + return parent::offsetGet($offset); + } + + public function offsetSet($offset, $value) + { + if ($offset === 'authenticated') { + $this->authenticated = (bool)$value; + } + if ($offset === 'authorized') { + $this->authorized = (bool)$value; + } + + parent::offsetSet($offset, $value); + } + + public function offsetUnset($offset) + { + if ($offset === 'authenticated') { + $this->authenticated = null; + } + if ($offset === 'authorized') { + $this->authorized = null; + } + + parent::offsetUnset($offset); + } + /** * Authenticate user. *