user-accounts.yaml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. title: User Accounts
  2. description: Manage your User Accounts in Flex.
  3. type: flex-objects
  4. # Extends user account
  5. extends@:
  6. type: account
  7. context: blueprints://user
  8. #
  9. # HIGHLY SPECIALIZED FLEX TYPE, AVOID USING USER ACCOUNTS AS BASE FOR YOUR OWN TYPE.
  10. #
  11. # Flex configuration
  12. config:
  13. # Administration Configuration (needs Flex Objects plugin)
  14. admin:
  15. # Admin router
  16. router:
  17. path: '/accounts/users'
  18. actions:
  19. configure:
  20. path: '/accounts/configure'
  21. redirects:
  22. '/user': '/accounts/users'
  23. '/accounts': '/accounts/users'
  24. # Permissions
  25. permissions:
  26. # Primary permissions
  27. admin.users:
  28. type: crudl
  29. label: User Accounts
  30. admin.configuration.users:
  31. type: default
  32. label: Accounts Configuration
  33. # Admin menu
  34. menu:
  35. base:
  36. location: '/accounts'
  37. route: '/accounts/users'
  38. index: 0
  39. title: PLUGIN_ADMIN.ACCOUNTS
  40. icon: fa-users
  41. authorize: ['admin.users.list', 'admin.super']
  42. priority: 6
  43. # Admin template type (folder)
  44. template: user-accounts
  45. # List view
  46. list:
  47. # Fields shown in the list view
  48. fields:
  49. username:
  50. link: edit
  51. search: true
  52. field:
  53. label: PLUGIN_ADMIN.USERNAME
  54. email:
  55. search: true
  56. fullname:
  57. search: true
  58. # Extra options
  59. options:
  60. per_page: 20
  61. order:
  62. by: username
  63. dir: asc
  64. # Edit view
  65. edit:
  66. title:
  67. template: "{{ form.value('fullname') ?? form.value('username') }} <{{ form.value('email') }}>"
  68. # Configure view
  69. configure:
  70. hidden: true
  71. authorize: 'admin.configuration.users'
  72. form: 'accounts'
  73. title:
  74. template: "{{ 'PLUGIN_ADMIN.ACCOUNTS'|tu }} {{ 'PLUGIN_ADMIN.CONFIGURATION'|tu }}"
  75. # Site Configuration
  76. site:
  77. # Hide from flex types
  78. hidden: true
  79. templates:
  80. collection:
  81. # Lookup for the template layout files for collections of objects
  82. paths:
  83. - 'flex/{TYPE}/collection/{LAYOUT}{EXT}'
  84. object:
  85. # Lookup for the template layout files for objects
  86. paths:
  87. - 'flex/{TYPE}/object/{LAYOUT}{EXT}'
  88. defaults:
  89. # Default template {TYPE}; overridden by filename of this blueprint if template folder exists
  90. type: user-accounts
  91. # Default template {LAYOUT}; can be overridden in render calls (usually Twig in templates)
  92. layout: default
  93. # Data Configuration
  94. data:
  95. object: 'Grav\Common\Flex\Types\Users\UserObject'
  96. collection: 'Grav\Common\Flex\Types\Users\UserCollection'
  97. index: 'Grav\Common\Flex\Types\Users\UserIndex'
  98. storage:
  99. class: 'Grav\Common\Flex\Types\Users\Storage\UserFileStorage'
  100. options:
  101. formatter:
  102. class: 'Grav\Framework\File\Formatter\YamlFormatter'
  103. folder: 'account://'
  104. pattern: '{FOLDER}/{KEY}{EXT}'
  105. indexed: true
  106. key: username
  107. case_sensitive: false
  108. search:
  109. options:
  110. contains: 1
  111. fields:
  112. - key
  113. - email
  114. - username
  115. - fullname
  116. relationships:
  117. media:
  118. type: media
  119. cardinality: to-many
  120. avatar:
  121. type: media
  122. cardinality: to-one
  123. # roles:
  124. # type: user-groups
  125. # cardinality: to-many
  126. blueprints:
  127. configure:
  128. fields:
  129. import@:
  130. type: configure/compat
  131. context: blueprints://flex
  132. # Regular form definition
  133. form:
  134. fields:
  135. username:
  136. flex-disabled@: exists
  137. disabled: false
  138. flex-readonly@: exists
  139. readonly: false
  140. validate:
  141. required: true