You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

218 lines
7.1 KiB

5 years ago
5 years ago
5 years ago
  1. <template lang="pug">
  2. v-card(flat)
  3. v-card-text
  4. v-text-field(
  5. outlined
  6. v-model='group.name'
  7. label='Group Name'
  8. counter='255'
  9. prepend-icon='mdi-account-group'
  10. )
  11. v-alert.radius-7(
  12. v-if='group.isSystem'
  13. color='orange darken-2'
  14. :class='$vuetify.theme.dark ? "grey darken-4" : "orange lighten-5"'
  15. outlined
  16. :value='true'
  17. icon='mdi-lock-outline'
  18. ) This is a system group. Some permissions cannot be modified.
  19. v-container.px-3.pb-3.pt-0(fluid, grid-list-md)
  20. v-layout(row, wrap)
  21. v-flex(xs12, md6, lg4, v-for='pmGroup in permissions', :key='pmGroup.category')
  22. v-card.md2(flat, :class='$vuetify.theme.dark ? "grey darken-3-d5" : "grey lighten-5"')
  23. .overline.px-5.pt-5.pb-3.grey--text.text--darken-2 {{pmGroup.category}}
  24. v-card-text.pt-0
  25. template(v-for='(pm, idx) in pmGroup.items')
  26. v-checkbox.pt-0(
  27. style='justify-content: space-between;'
  28. :key='pm.permission'
  29. :label='pm.permission'
  30. :hint='pm.hint'
  31. persistent-hint
  32. color='primary'
  33. v-model='group.permissions'
  34. :value='pm.permission'
  35. :append-icon='pm.warning ? "mdi-alert" : null',
  36. :disabled='(group.isSystem && pm.restrictedForSystem) || group.id === 1 || pm.disabled'
  37. )
  38. v-divider.mt-3(v-if='idx < pmGroup.items.length - 1')
  39. </template>
  40. <script>
  41. export default {
  42. props: {
  43. value: {
  44. type: Object,
  45. default: () => ({})
  46. }
  47. },
  48. data() {
  49. return {
  50. permissions: [
  51. {
  52. category: 'Content',
  53. items: [
  54. {
  55. permission: 'read:pages',
  56. hint: 'Can view pages, as specified in the Page Rules',
  57. warning: false,
  58. restrictedForSystem: false,
  59. disabled: false
  60. },
  61. {
  62. permission: 'write:pages',
  63. hint: 'Can create / edit pages, as specified in the Page Rules',
  64. warning: false,
  65. restrictedForSystem: true,
  66. disabled: false
  67. },
  68. {
  69. permission: 'manage:pages',
  70. hint: 'Can move existing pages as specified in the Page Rules',
  71. warning: false,
  72. restrictedForSystem: true,
  73. disabled: false
  74. },
  75. {
  76. permission: 'delete:pages',
  77. hint: 'Can delete existing pages, as specified in the Page Rules',
  78. warning: false,
  79. restrictedForSystem: true,
  80. disabled: false
  81. },
  82. {
  83. permission: 'read:source',
  84. hint: 'Can view pages source, as specified in the Page Rules',
  85. warning: false,
  86. restrictedForSystem: false,
  87. disabled: false
  88. },
  89. {
  90. permission: 'read:history',
  91. hint: 'Can view pages history, as specified in the Page Rules',
  92. warning: false,
  93. restrictedForSystem: false,
  94. disabled: false
  95. },
  96. {
  97. permission: 'read:assets',
  98. hint: 'Can view / use assets (such as images and files), as specified in the Page Rules',
  99. warning: false,
  100. restrictedForSystem: false,
  101. disabled: false
  102. },
  103. {
  104. permission: 'write:assets',
  105. hint: 'Can upload new assets (such as images and files), as specified in the Page Rules',
  106. warning: false,
  107. restrictedForSystem: true,
  108. disabled: false
  109. },
  110. {
  111. permission: 'manage:assets',
  112. hint: 'Can edit and delete existing assets (such as images and files), as specified in the Page Rules',
  113. warning: false,
  114. restrictedForSystem: true,
  115. disabled: false
  116. },
  117. {
  118. permission: 'read:comments',
  119. hint: 'Can view comments, as specified in the Page Rules',
  120. warning: false,
  121. restrictedForSystem: false,
  122. disabled: false
  123. },
  124. {
  125. permission: 'write:comments',
  126. hint: 'Can post new comments, as specified in the Page Rules',
  127. warning: false,
  128. restrictedForSystem: false,
  129. disabled: false
  130. },
  131. {
  132. permission: 'manage:comments',
  133. hint: 'Can edit and delete existing comments, as specified in the Page Rules',
  134. warning: false,
  135. restrictedForSystem: true,
  136. disabled: false
  137. }
  138. ]
  139. },
  140. {
  141. category: 'Users',
  142. items: [
  143. {
  144. permission: 'write:users',
  145. hint: 'Can create or authorize new users, but not modify existing ones',
  146. warning: false,
  147. restrictedForSystem: true,
  148. disabled: false
  149. },
  150. {
  151. permission: 'manage:users',
  152. hint: 'Can manage all users (but not users with administrative permissions)',
  153. warning: false,
  154. restrictedForSystem: true,
  155. disabled: false
  156. },
  157. {
  158. permission: 'write:groups',
  159. hint: 'Can manage groups and assign CONTENT permissions / page rules',
  160. warning: false,
  161. restrictedForSystem: true,
  162. disabled: false
  163. },
  164. {
  165. permission: 'manage:groups',
  166. hint: 'Can manage groups and assign ANY permissions (but not manage:system) / page rules',
  167. warning: true,
  168. restrictedForSystem: true,
  169. disabled: false
  170. }
  171. ]
  172. },
  173. {
  174. category: 'Administration',
  175. items: [
  176. {
  177. permission: 'manage:navigation',
  178. hint: 'Can manage the site navigation',
  179. warning: false,
  180. restrictedForSystem: true,
  181. disabled: false
  182. },
  183. {
  184. permission: 'manage:theme',
  185. hint: 'Can manage and modify themes',
  186. warning: false,
  187. restrictedForSystem: true,
  188. disabled: false
  189. },
  190. {
  191. permission: 'manage:api',
  192. hint: 'Can generate and revoke API keys',
  193. warning: true,
  194. restrictedForSystem: true,
  195. disabled: false
  196. },
  197. {
  198. permission: 'manage:system',
  199. hint: 'Can manage and access everything. Root administrator.',
  200. warning: true,
  201. restrictedForSystem: true,
  202. disabled: true
  203. }
  204. ]
  205. }
  206. ]
  207. }
  208. },
  209. computed: {
  210. group: {
  211. get() { return this.value },
  212. set(val) { this.$set('input', val) }
  213. }
  214. }
  215. }
  216. </script>