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.

224 lines
7.4 KiB

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