mirror of
https://github.com/getgrav/grav.git
synced 2026-03-06 04:21:34 +01:00
Merge branch 'develop' of github.com:getgrav/grav into 1.7
# Conflicts: # CHANGELOG.md
This commit is contained in:
@@ -56,7 +56,8 @@
|
||||
* Fixed `url()` not returning a path to non-existing file (`user-data://shop` => `/user/data/shop`) if it is set to fail gracefully
|
||||
* Fixed `url()` returning false on unknown streams, such as `ftp://domain.com`, they should be treated as external URL
|
||||
* Fixed Flex User to have permissions to save and delete his own user
|
||||
|
||||
* Fixed new Flex User creation not being possible because of username could not be given
|
||||
|
||||
# v1.6.11
|
||||
## 06/21/2019
|
||||
|
||||
|
||||
@@ -12,5 +12,7 @@ form:
|
||||
type: text
|
||||
label: PLUGIN_ADMIN.USERNAME
|
||||
help: PLUGIN_ADMIN.USERNAME_HELP
|
||||
unset-disabled@: true
|
||||
unset-readonly@: true
|
||||
validate:
|
||||
required: true
|
||||
|
||||
@@ -27,3 +27,11 @@ config:
|
||||
title: Accounts
|
||||
icon: fa-users
|
||||
authorize: ['admin.users', 'admin.accounts', 'admin.super']
|
||||
|
||||
form:
|
||||
fields:
|
||||
username:
|
||||
flex-disabled@: exists
|
||||
flex-readonly@: exists
|
||||
validate:
|
||||
required: true
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
namespace Grav\Common\User\FlexUser;
|
||||
|
||||
use Grav\Common\Data\Blueprint;
|
||||
use Grav\Common\Grav;
|
||||
use Grav\Common\Media\Interfaces\MediaCollectionInterface;
|
||||
use Grav\Common\Page\Media;
|
||||
@@ -381,6 +382,31 @@ class User extends FlexObject implements UserInterface, MediaManipulationInterfa
|
||||
return $this->getBlueprint()->extra($this->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return Blueprint
|
||||
*/
|
||||
public function getBlueprint(string $name = '')
|
||||
{
|
||||
$blueprint = clone parent::getBlueprint($name);
|
||||
|
||||
$blueprint->addDynamicHandler('flex', function (array &$field, $property, array &$call) {
|
||||
$params = (array)$call['params'];
|
||||
$method = array_shift($params);
|
||||
|
||||
if (method_exists($this, $method)) {
|
||||
$value = $this->{$method}(...$params);
|
||||
if (\is_array($value) && isset($field[$property]) && \is_array($field[$property])) {
|
||||
$field[$property] = array_merge_recursive($field[$property], $value);
|
||||
} else {
|
||||
$field[$property] = $value;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return $blueprint->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return unmodified data as raw string.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user