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.

232 lines
7.6 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: 'write:styles',
  84. hint: 'Can insert CSS styles in pages, as specified in the Page Rules',
  85. warning: false,
  86. restrictedForSystem: true,
  87. disabled: false
  88. },
  89. {
  90. permission: 'write:scripts',
  91. hint: 'Can insert JavaScript in pages, as specified in the Page Rules',
  92. warning: false,
  93. restrictedForSystem: true,
  94. disabled: false
  95. },
  96. {
  97. permission: 'read:source',
  98. hint: 'Can view pages source, as specified in the Page Rules',
  99. warning: false,
  100. restrictedForSystem: false,
  101. disabled: false
  102. },
  103. {
  104. permission: 'read:history',
  105. hint: 'Can view pages history, as specified in the Page Rules',
  106. warning: false,
  107. restrictedForSystem: false,
  108. disabled: false
  109. },
  110. {
  111. permission: 'read:assets',
  112. hint: 'Can view / use assets (such as images and files), as specified in the Page Rules',
  113. warning: false,
  114. restrictedForSystem: false,
  115. disabled: false
  116. },
  117. {
  118. permission: 'write:assets',
  119. hint: 'Can upload new assets (such as images and files), as specified in the Page Rules',
  120. warning: false,
  121. restrictedForSystem: true,
  122. disabled: false
  123. },
  124. {
  125. permission: 'manage:assets',
  126. hint: 'Can edit and delete existing assets (such as images and files), as specified in the Page Rules',
  127. warning: false,
  128. restrictedForSystem: true,
  129. disabled: false
  130. },
  131. {
  132. permission: 'read:comments',
  133. hint: 'Can view comments, as specified in the Page Rules',
  134. warning: false,
  135. restrictedForSystem: false,
  136. disabled: false
  137. },
  138. {
  139. permission: 'write:comments',
  140. hint: 'Can post new comments, as specified in the Page Rules',
  141. warning: false,
  142. restrictedForSystem: false,
  143. disabled: false
  144. },
  145. {
  146. permission: 'manage:comments',
  147. hint: 'Can edit and delete existing comments, as specified in the Page Rules',
  148. warning: false,
  149. restrictedForSystem: true,
  150. disabled: false
  151. }
  152. ]
  153. },
  154. {
  155. category: 'Users',
  156. items: [
  157. {
  158. permission: 'write:users',
  159. hint: 'Can create or authorize new users, but not modify existing ones',
  160. warning: false,
  161. restrictedForSystem: true,
  162. disabled: false
  163. },
  164. {
  165. permission: 'manage:users',
  166. hint: 'Can manage all users (but not users with administrative permissions)',
  167. warning: false,
  168. restrictedForSystem: true,
  169. disabled: false
  170. },
  171. {
  172. permission: 'write:groups',
  173. hint: 'Can manage groups and assign CONTENT permissions / page rules',
  174. warning: false,
  175. restrictedForSystem: true,
  176. disabled: false
  177. },
  178. {
  179. permission: 'manage:groups',
  180. hint: 'Can manage groups and assign ANY permissions (but not manage:system) / page rules',
  181. warning: true,
  182. restrictedForSystem: true,
  183. disabled: false
  184. }
  185. ]
  186. },
  187. {
  188. category: 'Administration',
  189. items: [
  190. {
  191. permission: 'manage:navigation',
  192. hint: 'Can manage the site navigation',
  193. warning: false,
  194. restrictedForSystem: true,
  195. disabled: false
  196. },
  197. {
  198. permission: 'manage:theme',
  199. hint: 'Can manage and modify themes',
  200. warning: false,
  201. restrictedForSystem: true,
  202. disabled: false
  203. },
  204. {
  205. permission: 'manage:api',
  206. hint: 'Can generate and revoke API keys',
  207. warning: true,
  208. restrictedForSystem: true,
  209. disabled: false
  210. },
  211. {
  212. permission: 'manage:system',
  213. hint: 'Can manage and access everything. Root administrator.',
  214. warning: true,
  215. restrictedForSystem: true,
  216. disabled: true
  217. }
  218. ]
  219. }
  220. ]
  221. }
  222. },
  223. computed: {
  224. group: {
  225. get() { return this.value },
  226. set(val) { this.$set('input', val) }
  227. }
  228. }
  229. }
  230. </script>