(window["webpackJsonp"] = window["webpackJsonp"] || []).push([[103],{

/***/ "./node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/main/settings/Roles.vue?vue&type=script&lang=js&":
/*!****************************************************************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/main/settings/Roles.vue?vue&type=script&lang=js& ***!
  \****************************************************************************************************************************************************************************************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _utils_http__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @/utils/http */ \"./src/utils/http.js\");\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n  components: {\n    Title: () => __webpack_require__.e(/*! import() */ 4).then(__webpack_require__.bind(null, /*! @/components/singles/Title.vue */ \"./src/components/singles/Title.vue\")),\n    Plus: () => __webpack_require__.e(/*! import() */ 14).then(__webpack_require__.bind(null, /*! @/components/main/Plus.vue */ \"./src/components/main/Plus.vue\")),\n    AddUser: () => __webpack_require__.e(/*! import() */ 102).then(__webpack_require__.bind(null, /*! @/components/main/settings/AddUser.vue */ \"./src/components/main/settings/AddUser.vue\")),\n    Confirm: () => __webpack_require__.e(/*! import() */ 10).then(__webpack_require__.bind(null, /*! @/components/main/Confirm.vue */ \"./src/components/main/Confirm.vue\"))\n  },\n  data() {\n    return {\n      items: [],\n      selected: null,\n      showDelete: false,\n      firstLoadDone: false,\n      showAdd: false,\n      count: null\n    };\n  },\n  async created() {\n    await this.get();\n    await this.getCount();\n    this.firstLoadDone = true;\n  },\n  methods: {\n    async remove(item) {\n      const index = this.items.findIndex(x => x.user.uid === item.user.uid);\n      await Object(_utils_http__WEBPACK_IMPORTED_MODULE_0__[\"postApi\"])(\"delete/userRole\", {\n        userUID2: item.user.uid,\n        level: item.role.level\n      });\n      this.$delete(this.items, index);\n      await this.getCount();\n      this.showDelete = false;\n      this.selected = null;\n    },\n    async get() {\n      const res = await Object(_utils_http__WEBPACK_IMPORTED_MODULE_0__[\"postApi\"])(\"get/userRoles\");\n      this.items = res.filter(x => x.user);\n    },\n    async getCount() {\n      const res = await Object(_utils_http__WEBPACK_IMPORTED_MODULE_0__[\"postApi\"])(\"get/userRolesCount\");\n      this.count = res[0];\n    },\n    async add(item) {\n      const index = this.items.findIndex(x => x.user.uid === item.user.uid);\n      if (!this.items[index]) this.items.push(item);\n      await this.getCount();\n    },\n    async set(mail) {\n      const res = await Object(_utils_http__WEBPACK_IMPORTED_MODULE_0__[\"postApi\"])(\"set/userRole\", {\n        mail: mail,\n        level: 0\n      });\n      if (res.length !== 0) {\n        this.$helpers.notify(\"Success\", \"You have to sign out and sign in again for the role to take effect.\", \"success\", -1);\n        this.add(res[0]);\n      } else {\n        this.$helpers.notify(\"\", \"The role could not be added.\", \"warning\", -1);\n      }\n    }\n  }\n});\n\n//# sourceURL=webpack:///./src/components/main/settings/Roles.vue?./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options");

/***/ }),

/***/ "./node_modules/cache-loader/dist/cjs.js?{\"cacheDirectory\":\"node_modules/.cache/vue-loader\",\"cacheIdentifier\":\"7d40fa80-vue-loader-template\"}!./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/main/settings/Roles.vue?vue&type=template&id=3f2ba132&":
/*!************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
  !*** ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"7d40fa80-vue-loader-template"}!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/main/settings/Roles.vue?vue&type=template&id=3f2ba132& ***!
  \************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"render\", function() { return render; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"staticRenderFns\", function() { return staticRenderFns; });\nvar render = function() {\n  var _vm = this\n  var _h = _vm.$createElement\n  var _c = _vm._self._c || _h\n  return _c(\n    \"div\",\n    [\n      _c(\n        \"Title\",\n        [\n          _vm._v(\"Users and roles \"),\n          _vm.firstLoadDone && _vm.items.length !== 0 && _vm.count !== 0\n            ? _c(\"Plus\", {\n                on: {\n                  click: function($event) {\n                    _vm.showAdd = true\n                  }\n                }\n              })\n            : _vm._e()\n        ],\n        1\n      ),\n      _vm.firstLoadDone && _vm.items.length === 0 && _vm.count === 0\n        ? _c(\"div\", { staticClass: \"notification\" }, [\n            _c(\"p\", [_vm._v(\"There are no global admins yet.\")]),\n            _c(\n              \"button\",\n              {\n                staticClass: \"button is-primary\",\n                on: {\n                  click: function($event) {\n                    return _vm.set(_vm.$store.state.auth.user.mail)\n                  }\n                }\n              },\n              [_vm._v(\" Make me global admin \")]\n            )\n          ])\n        : _vm._e(),\n      _vm.firstLoadDone && _vm.items.length === 0 && _vm.count !== 0\n        ? _c(\"p\", [_c(\"i\", [_vm._v(\"You don't have access to this page.\")])])\n        : _vm._e(),\n      _c(\n        \"div\",\n        {\n          directives: [\n            {\n              name: \"show\",\n              rawName: \"v-show\",\n              value: _vm.firstLoadDone && _vm.items.length != 0,\n              expression: \"firstLoadDone && items.length != 0\"\n            }\n          ]\n        },\n        [\n          _c(\"div\", { staticClass: \"is-unselectable\" }, [\n            _c(\"table\", { staticClass: \"table\" }, [\n              _vm._m(0),\n              _c(\n                \"tbody\",\n                [\n                  _vm._l(_vm.items, function(item) {\n                    return _vm._l(item.roles, function(role) {\n                      return _c(\"tr\", { key: item.user.uid + role.level }, [\n                        _c(\"td\", [_vm._v(\" \" + _vm._s(item.user.mail) + \" \")]),\n                        _c(\"td\", [_vm._v(\" \" + _vm._s(role.name) + \" \")]),\n                        _c(\"td\", [\n                          _c(\n                            \"button\",\n                            {\n                              staticClass: \"button is-small smaller is-danger\",\n                              on: {\n                                click: function($event) {\n                                  _vm.selected = { user: item.user, role: role }\n                                  _vm.showDelete = true\n                                }\n                              }\n                            },\n                            [_vm._v(\" Revoke role \")]\n                          )\n                        ])\n                      ])\n                    })\n                  })\n                ],\n                2\n              )\n            ])\n          ])\n        ]\n      ),\n      _vm.showAdd\n        ? _c(\"AddUser\", {\n            on: {\n              change: function($event) {\n                return _vm.add($event)\n              }\n            },\n            model: {\n              value: _vm.showAdd,\n              callback: function($$v) {\n                _vm.showAdd = $$v\n              },\n              expression: \"showAdd\"\n            }\n          })\n        : _vm._e(),\n      _vm.selected && _vm.showDelete\n        ? _c(\n            \"Confirm\",\n            {\n              on: {\n                hide: function($event) {\n                  _vm.selected = null\n                },\n                confirmed: function($event) {\n                  return _vm.remove(_vm.selected)\n                }\n              },\n              model: {\n                value: _vm.showDelete,\n                callback: function($$v) {\n                  _vm.showDelete = $$v\n                },\n                expression: \"showDelete\"\n              }\n            },\n            [\n              _vm._v(\n                \" You are about to remove the global admin role from the user \" +\n                  _vm._s(_vm.selected.user.mail) +\n                  \". \"\n              )\n            ]\n          )\n        : _vm._e()\n    ],\n    1\n  )\n}\nvar staticRenderFns = [\n  function() {\n    var _vm = this\n    var _h = _vm.$createElement\n    var _c = _vm._self._c || _h\n    return _c(\"thead\", [\n      _c(\"tr\", [\n        _c(\"th\", [_vm._v(\" User \")]),\n        _c(\"th\", [_vm._v(\" Role \")]),\n        _c(\"th\", [_vm._v(\" Action \")])\n      ])\n    ])\n  }\n]\nrender._withStripped = true\n\n\n\n//# sourceURL=webpack:///./src/components/main/settings/Roles.vue?./node_modules/cache-loader/dist/cjs.js?%7B%22cacheDirectory%22:%22node_modules/.cache/vue-loader%22,%22cacheIdentifier%22:%227d40fa80-vue-loader-template%22%7D!./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options");

/***/ }),

/***/ "./src/components/main/settings/Roles.vue":
/*!************************************************!*\
  !*** ./src/components/main/settings/Roles.vue ***!
  \************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _Roles_vue_vue_type_template_id_3f2ba132___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Roles.vue?vue&type=template&id=3f2ba132& */ \"./src/components/main/settings/Roles.vue?vue&type=template&id=3f2ba132&\");\n/* harmony import */ var _Roles_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Roles.vue?vue&type=script&lang=js& */ \"./src/components/main/settings/Roles.vue?vue&type=script&lang=js&\");\n/* empty/unused harmony star reexport *//* harmony import */ var _node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js */ \"./node_modules/vue-loader/lib/runtime/componentNormalizer.js\");\n\n\n\n\n\n/* normalize component */\n\nvar component = Object(_node_modules_vue_loader_lib_runtime_componentNormalizer_js__WEBPACK_IMPORTED_MODULE_2__[\"default\"])(\n  _Roles_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_1__[\"default\"],\n  _Roles_vue_vue_type_template_id_3f2ba132___WEBPACK_IMPORTED_MODULE_0__[\"render\"],\n  _Roles_vue_vue_type_template_id_3f2ba132___WEBPACK_IMPORTED_MODULE_0__[\"staticRenderFns\"],\n  false,\n  null,\n  null,\n  null\n  \n)\n\n/* hot reload */\nif (false) { var api; }\ncomponent.options.__file = \"src/components/main/settings/Roles.vue\"\n/* harmony default export */ __webpack_exports__[\"default\"] = (component.exports);\n\n//# sourceURL=webpack:///./src/components/main/settings/Roles.vue?");

/***/ }),

/***/ "./src/components/main/settings/Roles.vue?vue&type=script&lang=js&":
/*!*************************************************************************!*\
  !*** ./src/components/main/settings/Roles.vue?vue&type=script&lang=js& ***!
  \*************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_cache_loader_dist_cjs_js_ref_12_0_node_modules_babel_loader_lib_index_js_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Roles_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../../node_modules/babel-loader/lib!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader/lib??vue-loader-options!./Roles.vue?vue&type=script&lang=js& */ \"./node_modules/cache-loader/dist/cjs.js?!./node_modules/babel-loader/lib/index.js!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/main/settings/Roles.vue?vue&type=script&lang=js&\");\n/* empty/unused harmony star reexport */ /* harmony default export */ __webpack_exports__[\"default\"] = (_node_modules_cache_loader_dist_cjs_js_ref_12_0_node_modules_babel_loader_lib_index_js_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Roles_vue_vue_type_script_lang_js___WEBPACK_IMPORTED_MODULE_0__[\"default\"]); \n\n//# sourceURL=webpack:///./src/components/main/settings/Roles.vue?");

/***/ }),

/***/ "./src/components/main/settings/Roles.vue?vue&type=template&id=3f2ba132&":
/*!*******************************************************************************!*\
  !*** ./src/components/main/settings/Roles.vue?vue&type=template&id=3f2ba132& ***!
  \*******************************************************************************/
/*! exports provided: render, staticRenderFns */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _node_modules_cache_loader_dist_cjs_js_cacheDirectory_node_modules_cache_vue_loader_cacheIdentifier_7d40fa80_vue_loader_template_node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Roles_vue_vue_type_template_id_3f2ba132___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! -!../../../../node_modules/cache-loader/dist/cjs.js?{\"cacheDirectory\":\"node_modules/.cache/vue-loader\",\"cacheIdentifier\":\"7d40fa80-vue-loader-template\"}!../../../../node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader/lib??vue-loader-options!./Roles.vue?vue&type=template&id=3f2ba132& */ \"./node_modules/cache-loader/dist/cjs.js?{\\\"cacheDirectory\\\":\\\"node_modules/.cache/vue-loader\\\",\\\"cacheIdentifier\\\":\\\"7d40fa80-vue-loader-template\\\"}!./node_modules/vue-loader/lib/loaders/templateLoader.js?!./node_modules/cache-loader/dist/cjs.js?!./node_modules/vue-loader/lib/index.js?!./src/components/main/settings/Roles.vue?vue&type=template&id=3f2ba132&\");\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"render\", function() { return _node_modules_cache_loader_dist_cjs_js_cacheDirectory_node_modules_cache_vue_loader_cacheIdentifier_7d40fa80_vue_loader_template_node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Roles_vue_vue_type_template_id_3f2ba132___WEBPACK_IMPORTED_MODULE_0__[\"render\"]; });\n\n/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, \"staticRenderFns\", function() { return _node_modules_cache_loader_dist_cjs_js_cacheDirectory_node_modules_cache_vue_loader_cacheIdentifier_7d40fa80_vue_loader_template_node_modules_vue_loader_lib_loaders_templateLoader_js_vue_loader_options_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_Roles_vue_vue_type_template_id_3f2ba132___WEBPACK_IMPORTED_MODULE_0__[\"staticRenderFns\"]; });\n\n\n\n//# sourceURL=webpack:///./src/components/main/settings/Roles.vue?");

/***/ })

}]);