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.

203 lines
6.4 KiB

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