admin-groups-edit-permissions.vue 7.43 KB
Newer Older
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 6 7 8 9 10 11 12
        v-flex(xs12, v-if='group.isSystem')
          v-alert.radius-7.mb-0(
            color='orange darken-2'
            :class='$vuetify.theme.dark ? "grey darken-4" : "orange lighten-5"'
            outlined
            :value='true'
            icon='mdi-lock-outline'
            ) 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 15
          v-card.md2(flat, :class='$vuetify.theme.dark ? "grey darken-3-d5" : "grey lighten-5"')
            .overline.px-5.pt-5.pb-3.grey--text.text--darken-2 {{pmGroup.category}}
16 17 18
            v-card-text.pt-0
              template(v-for='(pm, idx) in pmGroup.items')
                v-checkbox.pt-0(
NGPixel's avatar
NGPixel committed
19
                  style='justify-content: space-between;'
20 21 22 23 24 25 26
                  :key='pm.permission'
                  :label='pm.permission'
                  :hint='pm.hint'
                  persistent-hint
                  color='primary'
                  v-model='group.permissions'
                  :value='pm.permission'
27
                  :append-icon='pm.warning ? "mdi-alert" : null',
28 29 30 31 32 33 34 35 36
                  :disabled='(group.isSystem && pm.restrictedForSystem) || group.id === 1 || pm.disabled'
                )
                v-divider.mt-3(v-if='idx < pmGroup.items.length - 1')
</template>

<script>
export default {
  props: {
    value: {
37 38
      type: Object,
      default: () => ({})
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
    }
  },
  data() {
    return {
      permissions: [
        {
          category: 'Content',
          items: [
            {
              permission: 'read:pages',
              hint: 'Can view pages, as specified in the Page Rules',
              warning: false,
              restrictedForSystem: false,
              disabled: false
            },
            {
              permission: 'write:pages',
NGPixel's avatar
NGPixel committed
56
              hint: 'Can create / edit pages, as specified in the Page Rules',
57
              warning: false,
58
              restrictedForSystem: true,
59 60 61 62
              disabled: false
            },
            {
              permission: 'manage:pages',
NGPixel's avatar
NGPixel committed
63
              hint: 'Can move existing pages as specified in the Page Rules',
64
              warning: false,
65
              restrictedForSystem: true,
66 67 68 69 70 71
              disabled: false
            },
            {
              permission: 'delete:pages',
              hint: 'Can delete existing pages, as specified in the Page Rules',
              warning: false,
72
              restrictedForSystem: true,
73 74
              disabled: false
            },
75 76 77 78 79 80 81 82 83 84 85 86 87 88
            {
              permission: 'write:styles',
              hint: 'Can insert CSS styles in pages, as specified in the Page Rules',
              warning: false,
              restrictedForSystem: true,
              disabled: false
            },
            {
              permission: 'write:scripts',
              hint: 'Can insert JavaScript in pages, as specified in the Page Rules',
              warning: false,
              restrictedForSystem: true,
              disabled: false
            },
Nicolas Giard's avatar
Nicolas Giard committed
89 90 91 92 93 94 95 96 97 98 99 100 101 102
            {
              permission: 'read:source',
              hint: 'Can view pages source, as specified in the Page Rules',
              warning: false,
              restrictedForSystem: false,
              disabled: false
            },
            {
              permission: 'read:history',
              hint: 'Can view pages history, as specified in the Page Rules',
              warning: false,
              restrictedForSystem: false,
              disabled: false
            },
103 104 105 106 107 108 109 110 111 112 113
            {
              permission: 'read:assets',
              hint: 'Can view / use assets (such as images and files), as specified in the Page Rules',
              warning: false,
              restrictedForSystem: false,
              disabled: false
            },
            {
              permission: 'write:assets',
              hint: 'Can upload new assets (such as images and files), as specified in the Page Rules',
              warning: false,
114
              restrictedForSystem: true,
115 116 117 118
              disabled: false
            },
            {
              permission: 'manage:assets',
119
              hint: 'Can edit and delete existing assets (such as images and files), as specified in the Page Rules',
120
              warning: false,
121
              restrictedForSystem: true,
122 123 124 125 126 127 128 129 130 131 132 133 134
              disabled: false
            },
            {
              permission: 'read:comments',
              hint: 'Can view comments, as specified in the Page Rules',
              warning: false,
              restrictedForSystem: false,
              disabled: false
            },
            {
              permission: 'write:comments',
              hint: 'Can post new comments, as specified in the Page Rules',
              warning: false,
135
              restrictedForSystem: false,
136 137 138 139
              disabled: false
            },
            {
              permission: 'manage:comments',
140
              hint: 'Can edit and delete existing comments, as specified in the Page Rules',
141
              warning: false,
142
              restrictedForSystem: true,
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
              disabled: false
            }
          ]
        },
        {
          category: 'Users',
          items: [
            {
              permission: 'write:users',
              hint: 'Can create or authorize new users, but not modify existing ones',
              warning: false,
              restrictedForSystem: true,
              disabled: false
            },
            {
              permission: 'manage:users',
              hint: 'Can manage all users (but not users with administrative permissions)',
              warning: false,
              restrictedForSystem: true,
              disabled: false
            },
            {
              permission: 'write:groups',
              hint: 'Can manage groups and assign CONTENT permissions / page rules',
              warning: false,
              restrictedForSystem: true,
              disabled: false
            },
            {
              permission: 'manage:groups',
              hint: 'Can manage groups and assign ANY permissions (but not manage:system) / page rules',
              warning: true,
              restrictedForSystem: true,
              disabled: false
            }
          ]
        },
        {
          category: 'Administration',
          items: [
            {
              permission: 'manage:navigation',
              hint: 'Can manage the site navigation',
              warning: false,
              restrictedForSystem: true,
              disabled: false
            },
            {
              permission: 'manage:theme',
              hint: 'Can manage and modify themes',
              warning: false,
              restrictedForSystem: true,
              disabled: false
            },
            {
              permission: 'manage:api',
              hint: 'Can generate and revoke API keys',
              warning: true,
              restrictedForSystem: true,
              disabled: false
            },
            {
              permission: 'manage:system',
              hint: 'Can manage and access everything. Root administrator.',
              warning: true,
              restrictedForSystem: true,
              disabled: true

            }
          ]
        }
      ]
    }
  },
  computed: {
    group: {
      get() { return this.value },
      set(val) { this.$set('input', val) }
    }
  }
}
</script>