mirror of
https://github.com/getgrav/grav.git
synced 2026-07-20 04:52:15 +02:00
Renamed flex types for simplicity
This commit is contained in:
@@ -2,127 +2,7 @@ title: Flex User Accounts
|
||||
description: Manage your User Accounts in Flex.
|
||||
type: flex-objects
|
||||
|
||||
# Extends user account
|
||||
# Deprecated in Grav 1.7.0-rc.4: file was renamed.
|
||||
extends@:
|
||||
type: account
|
||||
context: blueprints://user
|
||||
|
||||
# Flex configuration
|
||||
config:
|
||||
# Administration Configuration (needs Flex Objects plugin)
|
||||
admin:
|
||||
# Admin router
|
||||
router:
|
||||
path: '/accounts/users'
|
||||
actions:
|
||||
configure:
|
||||
path: '/accounts/configure'
|
||||
redirects:
|
||||
'/user': '/accounts/users'
|
||||
'/accounts': '/accounts/users'
|
||||
|
||||
# Permissions
|
||||
permissions:
|
||||
# Primary permissions
|
||||
admin.users:
|
||||
type: crudpl
|
||||
label: User Accounts
|
||||
admin.configuration.users:
|
||||
type: default
|
||||
label: Accounts Configuration
|
||||
|
||||
# Admin menu
|
||||
menu:
|
||||
base:
|
||||
location: '/accounts'
|
||||
route: '/accounts/users'
|
||||
index: 0
|
||||
title: PLUGIN_ADMIN.ACCOUNTS
|
||||
icon: fa-users
|
||||
authorize: ['admin.users.list', 'admin.super']
|
||||
priority: 6
|
||||
|
||||
# Admin template type (folder)
|
||||
template: grav-accounts
|
||||
|
||||
# List view
|
||||
list:
|
||||
# Fields shown in the list view
|
||||
fields:
|
||||
username:
|
||||
link: edit
|
||||
search: true
|
||||
email:
|
||||
search: true
|
||||
fullname:
|
||||
search: true
|
||||
# Extra options
|
||||
options:
|
||||
per_page: 20
|
||||
order:
|
||||
by: username
|
||||
dir: asc
|
||||
|
||||
# Edit view
|
||||
edit:
|
||||
title:
|
||||
template: '{{ object.fullname ?? object.username }} <{{ object.email }}>'
|
||||
|
||||
# Configure view
|
||||
configure:
|
||||
hidden: true
|
||||
authorize: 'admin.configuration.users'
|
||||
form: 'accounts'
|
||||
title:
|
||||
template: "{{ 'PLUGIN_ADMIN.ACCOUNTS'|tu }} {{ 'PLUGIN_ADMIN.CONFIGURATION'|tu }}"
|
||||
|
||||
# Site Configuration
|
||||
site:
|
||||
# Hide from flex types
|
||||
hidden: true
|
||||
templates:
|
||||
collection:
|
||||
# Lookup for the template layout files for collections of objects
|
||||
paths:
|
||||
- 'flex/{TYPE}/collection/{LAYOUT}{EXT}'
|
||||
object:
|
||||
# Lookup for the template layout files for objects
|
||||
paths:
|
||||
- 'flex/{TYPE}/object/{LAYOUT}{EXT}'
|
||||
defaults:
|
||||
# Default template {TYPE}; overridden by filename of this blueprint if template folder exists
|
||||
type: grav-accounts
|
||||
# Default template {LAYOUT}; can be overridden in render calls (usually Twig in templates)
|
||||
layout: default
|
||||
|
||||
# Data Configuration
|
||||
data:
|
||||
object: 'Grav\Common\Flex\Users\UserObject'
|
||||
collection: 'Grav\Common\Flex\Users\UserCollection'
|
||||
index: 'Grav\Common\Flex\Users\UserIndex'
|
||||
storage:
|
||||
class: 'Grav\Common\Flex\Users\Storage\UserFileStorage'
|
||||
options:
|
||||
formatter:
|
||||
class: 'Grav\Framework\File\Formatter\YamlFormatter'
|
||||
folder: 'account://'
|
||||
pattern: '{FOLDER}/{KEY}{EXT}'
|
||||
key: username
|
||||
indexed: true
|
||||
search:
|
||||
options:
|
||||
contains: 1
|
||||
fields:
|
||||
- key
|
||||
- email
|
||||
|
||||
# Regular form definition
|
||||
form:
|
||||
fields:
|
||||
username:
|
||||
flex-disabled@: exists
|
||||
disabled: false
|
||||
flex-readonly@: exists
|
||||
readonly: false
|
||||
validate:
|
||||
required: true
|
||||
type: user-accounts
|
||||
context: blueprints://flex
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
title: Flex Pages
|
||||
title: Pages
|
||||
description: Manage your Grav Pages in Flex.
|
||||
type: flex-objects
|
||||
|
||||
@@ -35,7 +35,7 @@ config:
|
||||
priority: 5
|
||||
|
||||
# Admin template type (folder)
|
||||
template: grav-pages
|
||||
template: pages
|
||||
|
||||
# Allowed admin actions
|
||||
actions:
|
||||
|
||||
128
system/blueprints/flex/user-accounts.yaml
Normal file
128
system/blueprints/flex/user-accounts.yaml
Normal file
@@ -0,0 +1,128 @@
|
||||
title: User Accounts
|
||||
description: Manage your User Accounts in Flex.
|
||||
type: flex-objects
|
||||
|
||||
# Extends user account
|
||||
extends@:
|
||||
type: account
|
||||
context: blueprints://user
|
||||
|
||||
# Flex configuration
|
||||
config:
|
||||
# Administration Configuration (needs Flex Objects plugin)
|
||||
admin:
|
||||
# Admin router
|
||||
router:
|
||||
path: '/accounts/users'
|
||||
actions:
|
||||
configure:
|
||||
path: '/accounts/configure'
|
||||
redirects:
|
||||
'/user': '/accounts/users'
|
||||
'/accounts': '/accounts/users'
|
||||
|
||||
# Permissions
|
||||
permissions:
|
||||
# Primary permissions
|
||||
admin.users:
|
||||
type: crudpl
|
||||
label: User Accounts
|
||||
admin.configuration.users:
|
||||
type: default
|
||||
label: Accounts Configuration
|
||||
|
||||
# Admin menu
|
||||
menu:
|
||||
base:
|
||||
location: '/accounts'
|
||||
route: '/accounts/users'
|
||||
index: 0
|
||||
title: PLUGIN_ADMIN.ACCOUNTS
|
||||
icon: fa-users
|
||||
authorize: ['admin.users.list', 'admin.super']
|
||||
priority: 6
|
||||
|
||||
# Admin template type (folder)
|
||||
template: user-accounts
|
||||
|
||||
# List view
|
||||
list:
|
||||
# Fields shown in the list view
|
||||
fields:
|
||||
username:
|
||||
link: edit
|
||||
search: true
|
||||
email:
|
||||
search: true
|
||||
fullname:
|
||||
search: true
|
||||
# Extra options
|
||||
options:
|
||||
per_page: 20
|
||||
order:
|
||||
by: username
|
||||
dir: asc
|
||||
|
||||
# Edit view
|
||||
edit:
|
||||
title:
|
||||
template: '{{ object.fullname ?? object.username }} <{{ object.email }}>'
|
||||
|
||||
# Configure view
|
||||
configure:
|
||||
hidden: true
|
||||
authorize: 'admin.configuration.users'
|
||||
form: 'accounts'
|
||||
title:
|
||||
template: "{{ 'PLUGIN_ADMIN.ACCOUNTS'|tu }} {{ 'PLUGIN_ADMIN.CONFIGURATION'|tu }}"
|
||||
|
||||
# Site Configuration
|
||||
site:
|
||||
# Hide from flex types
|
||||
hidden: true
|
||||
templates:
|
||||
collection:
|
||||
# Lookup for the template layout files for collections of objects
|
||||
paths:
|
||||
- 'flex/{TYPE}/collection/{LAYOUT}{EXT}'
|
||||
object:
|
||||
# Lookup for the template layout files for objects
|
||||
paths:
|
||||
- 'flex/{TYPE}/object/{LAYOUT}{EXT}'
|
||||
defaults:
|
||||
# Default template {TYPE}; overridden by filename of this blueprint if template folder exists
|
||||
type: user-accounts
|
||||
# Default template {LAYOUT}; can be overridden in render calls (usually Twig in templates)
|
||||
layout: default
|
||||
|
||||
# Data Configuration
|
||||
data:
|
||||
object: 'Grav\Common\Flex\Users\UserObject'
|
||||
collection: 'Grav\Common\Flex\Users\UserCollection'
|
||||
index: 'Grav\Common\Flex\Users\UserIndex'
|
||||
storage:
|
||||
class: 'Grav\Common\Flex\Users\Storage\UserFileStorage'
|
||||
options:
|
||||
formatter:
|
||||
class: 'Grav\Framework\File\Formatter\YamlFormatter'
|
||||
folder: 'account://'
|
||||
pattern: '{FOLDER}/{KEY}{EXT}'
|
||||
key: username
|
||||
indexed: true
|
||||
search:
|
||||
options:
|
||||
contains: 1
|
||||
fields:
|
||||
- key
|
||||
- email
|
||||
|
||||
# Regular form definition
|
||||
form:
|
||||
fields:
|
||||
username:
|
||||
flex-disabled@: exists
|
||||
disabled: false
|
||||
flex-readonly@: exists
|
||||
readonly: false
|
||||
validate:
|
||||
required: true
|
||||
@@ -1,4 +1,4 @@
|
||||
title: Flex User Groups
|
||||
title: User Groups
|
||||
description: Manage your User Groups in Flex.
|
||||
type: flex-objects
|
||||
|
||||
@@ -42,7 +42,7 @@ config:
|
||||
priority: 6
|
||||
|
||||
# Admin template type (folder)
|
||||
template: grav-user-groups
|
||||
template: user-groups
|
||||
|
||||
# List view
|
||||
list:
|
||||
@@ -90,7 +90,7 @@ config:
|
||||
- 'flex/{TYPE}/object/{LAYOUT}{EXT}'
|
||||
defaults:
|
||||
# Default template {TYPE}; overridden by filename of this blueprint if template folder exists
|
||||
type: grav-user-groups
|
||||
type: user-groups
|
||||
# Default template {LAYOUT}; can be overridden in render calls (usually Twig in templates)
|
||||
layout: default
|
||||
|
||||
|
||||
@@ -897,7 +897,7 @@ class UserObject extends FlexObject implements UserInterface, MediaManipulationI
|
||||
$flex = $grav['flex'];
|
||||
|
||||
/** @var UserGroupCollection|null $groups */
|
||||
$groups = $flex->getDirectory('grav-user-groups');
|
||||
$groups = $flex->getDirectory('user-groups');
|
||||
if ($groups) {
|
||||
/** @var UserGroupIndex $index */
|
||||
$index = $groups->getIndex();
|
||||
|
||||
@@ -1291,7 +1291,7 @@ class Pages
|
||||
|
||||
/** @var Flex $flex */
|
||||
$flex = $this->grav['flex'];
|
||||
$directory = $flex->getDirectory('grav-pages');
|
||||
$directory = $flex->getDirectory('pages');
|
||||
|
||||
/** @var EventDispatcher $dispatcher */
|
||||
$dispatcher = $this->grav['events'];
|
||||
|
||||
@@ -57,7 +57,7 @@ class AccountsServiceProvider implements ServiceProviderInterface
|
||||
$container['user_groups'] = static function (Container $container) {
|
||||
/** @var Flex $flex */
|
||||
$flex = $container['flex'];
|
||||
$directory = $flex->getDirectory('grav-user-groups');
|
||||
$directory = $flex->getDirectory('user-groups');
|
||||
|
||||
return $directory ? $directory->getIndex() : null;
|
||||
};
|
||||
@@ -130,7 +130,7 @@ class AccountsServiceProvider implements ServiceProviderInterface
|
||||
{
|
||||
/** @var Flex $flex */
|
||||
$flex = $container['flex'];
|
||||
$directory = $flex->getDirectory('grav-accounts');
|
||||
$directory = $flex->getDirectory('user-accounts');
|
||||
|
||||
return $directory ? $directory->getIndex() : null;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class FlexServiceProvider implements ServiceProviderInterface
|
||||
// Add built-in types from Grav.
|
||||
if ($pagesEnabled) {
|
||||
$flex->addDirectoryType(
|
||||
'grav-pages',
|
||||
'pages',
|
||||
'blueprints://flex/pages.yaml',
|
||||
[
|
||||
'enabled' => $pagesEnabled
|
||||
@@ -44,8 +44,8 @@ class FlexServiceProvider implements ServiceProviderInterface
|
||||
}
|
||||
if ($accountsEnabled) {
|
||||
$flex->addDirectoryType(
|
||||
'grav-accounts',
|
||||
'blueprints://flex/accounts.yaml',
|
||||
'user-accounts',
|
||||
'blueprints://flex/user-accounts.yaml',
|
||||
[
|
||||
'enabled' => $accountsEnabled,
|
||||
'data' => [
|
||||
@@ -54,7 +54,7 @@ class FlexServiceProvider implements ServiceProviderInterface
|
||||
]
|
||||
);
|
||||
$flex->addDirectoryType(
|
||||
'grav-user-groups',
|
||||
'user-groups',
|
||||
'blueprints://flex/user-groups.yaml',
|
||||
[
|
||||
'enabled' => $accountsEnabled
|
||||
|
||||
Reference in New Issue
Block a user