nextcloud/apps/settings/js/vue-settings-users-961f28f8...

2 lines
74 KiB
JavaScript

(window.webpackJsonpSettings=window.webpackJsonpSettings||[]).push([[7],{597:function(t,n,e){"use strict";var s=e(65),i=e.n(s),a=e(66),r=e.n(a)()(i.a);r.push([t.i,".cellText{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.icon-more{background-color:var(--color-main-background);border:0}\n","",{"version":3,"sources":["webpack://./apps/settings/src/components/UserList/UserRowSimple.vue"],"names":[],"mappings":"AA6LC,UACC,eAAgB,CAChB,sBAAuB,CACvB,kBAAmB,CACpB,WAEC,6CAA8C,CAC9C,QAAS","sourcesContent":["\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\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\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t.cellText {\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t\twhite-space: nowrap;\n}\n\t.icon-more {\n\t\tbackground-color: var(--color-main-background);\n\t\tborder: 0;\n\t}\n"],"sourceRoot":""}]),n.a=r},598:function(t,n,e){"use strict";var s=e(65),i=e.n(s),a=e(66),r=e.n(a)()(i.a);r.push([t.i,".row--menu-opened[data-v-172121d3]{z-index:1 !important}.row[data-v-172121d3] .multiselect__single{z-index:auto !important}\n","",{"version":3,"sources":["webpack://./apps/settings/src/components/UserList/UserRow.vue"],"names":[],"mappings":"AA+qBA,mCACC,oBAAqB,CACrB,2CAEA,uBAAwB","sourcesContent":["\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\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\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\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\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\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\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\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// Force menu to be above other rows\n.row--menu-opened {\n\tz-index: 1 !important;\n}\n.row::v-deep .multiselect__single {\n\tz-index: auto !important;\n}\n"],"sourceRoot":""}]),n.a=r},599:function(t,n,e){"use strict";var s=e(65),i=e.n(s),a=e(66),r=e.n(a)()(i.a);r.push([t.i,"\n.row[data-v-c4fdcc08] .multiselect__single {\n\tz-index: auto !important;\n}\n","",{"version":3,"sources":["webpack://./apps/settings/src/components/UserList.vue"],"names":[],"mappings":";AAilBA;CACA,wBAAA;AACA","sourcesContent":['\x3c!--\n - @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>\n -\n - @author John Molakvoæ <skjnldsv@protonmail.com>\n -\n - @license GNU AGPL version 3 or any later version\n -\n - This program is free software: you can redistribute it and/or modify\n - it under the terms of the GNU Affero General Public License as\n - published by the Free Software Foundation, either version 3 of the\n - License, or (at your option) any later version.\n -\n - This program is distributed in the hope that it will be useful,\n - but WITHOUT ANY WARRANTY; without even the implied warranty of\n - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n - GNU Affero General Public License for more details.\n -\n - You should have received a copy of the GNU Affero General Public License\n - along with this program. If not, see <http://www.gnu.org/licenses/>.\n -\n --\x3e\n\n<template>\n\t<div id="app-content" class="user-list-grid" @scroll.passive="onScroll">\n\t\t<form v-show="showConfig.showNewUserForm"\n\t\t\tid="new-user"\n\t\t\t:class="{\'sticky\': scrolled && showConfig.showNewUserForm}"\n\t\t\t:disabled="loading.all"\n\t\t\tclass="row"\n\t\t\t@submit.prevent="createUser">\n\t\t\t<div :class="loading.all?\'icon-loading-small\':\'icon-add\'" />\n\t\t\t<div class="name">\n\t\t\t\t<input id="newusername"\n\t\t\t\t\tref="newusername"\n\t\t\t\t\tv-model="newUser.id"\n\t\t\t\t\t:disabled="settings.newUserGenerateUserID"\n\t\t\t\t\t:placeholder="settings.newUserGenerateUserID\n\t\t\t\t\t\t? t(\'settings\', \'Will be autogenerated\')\n\t\t\t\t\t\t: t(\'settings\', \'Username\')"\n\t\t\t\t\tautocapitalize="none"\n\t\t\t\t\tautocomplete="off"\n\t\t\t\t\tautocorrect="off"\n\t\t\t\t\tname="username"\n\t\t\t\t\tpattern="[a-zA-Z0-9 _\\.@\\-\']+"\n\t\t\t\t\trequired\n\t\t\t\t\ttype="text">\n\t\t\t\t<div class="displayName">\n\t\t\t\t\t<input id="newdisplayname"\n\t\t\t\t\t\tv-model="newUser.displayName"\n\t\t\t\t\t\t:placeholder="t(\'settings\', \'Display name\')"\n\t\t\t\t\t\tautocapitalize="none"\n\t\t\t\t\t\tautocomplete="off"\n\t\t\t\t\t\tautocorrect="off"\n\t\t\t\t\t\tname="displayname"\n\t\t\t\t\t\ttype="text">\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="password">\n\t\t\t\t<input id="newuserpassword"\n\t\t\t\t\tref="newuserpassword"\n\t\t\t\t\tv-model="newUser.password"\n\t\t\t\t\t:minlength="minPasswordLength"\n\t\t\t\t\t:placeholder="t(\'settings\', \'Password\')"\n\t\t\t\t\t:required="newUser.mailAddress===\'\'"\n\t\t\t\t\tautocapitalize="none"\n\t\t\t\t\tautocomplete="new-password"\n\t\t\t\t\tautocorrect="off"\n\t\t\t\t\tname="password"\n\t\t\t\t\ttype="password">\n\t\t\t</div>\n\t\t\t<div class="mailAddress">\n\t\t\t\t<input id="newemail"\n\t\t\t\t\tv-model="newUser.mailAddress"\n\t\t\t\t\t:placeholder="t(\'settings\', \'Email\')"\n\t\t\t\t\t:required="newUser.password===\'\' || settings.newUserRequireEmail"\n\t\t\t\t\tautocapitalize="none"\n\t\t\t\t\tautocomplete="off"\n\t\t\t\t\tautocorrect="off"\n\t\t\t\t\tname="email"\n\t\t\t\t\ttype="email">\n\t\t\t</div>\n\t\t\t<div class="groups">\n\t\t\t\t\x3c!-- hidden input trick for vanilla html5 form validation --\x3e\n\t\t\t\t<input v-if="!settings.isAdmin"\n\t\t\t\t\tid="newgroups"\n\t\t\t\t\t:class="{\'icon-loading-small\': loading.groups}"\n\t\t\t\t\t:required="!settings.isAdmin"\n\t\t\t\t\t:value="newUser.groups"\n\t\t\t\t\ttabindex="-1"\n\t\t\t\t\ttype="text">\n\t\t\t\t<Multiselect v-model="newUser.groups"\n\t\t\t\t\t:close-on-select="false"\n\t\t\t\t\t:disabled="loading.groups||loading.all"\n\t\t\t\t\t:multiple="true"\n\t\t\t\t\t:options="canAddGroups"\n\t\t\t\t\t:placeholder="t(\'settings\', \'Add user in group\')"\n\t\t\t\t\t:tag-width="60"\n\t\t\t\t\t:taggable="true"\n\t\t\t\t\tclass="multiselect-vue"\n\t\t\t\t\tlabel="name"\n\t\t\t\t\ttag-placeholder="create"\n\t\t\t\t\ttrack-by="id"\n\t\t\t\t\t@tag="createGroup">\n\t\t\t\t\t\x3c!-- If user is not admin, he is a subadmin.\n\t\t\t\t\t\tSubadmins can\'t create users outside their groups\n\t\t\t\t\t\tTherefore, empty select is forbidden --\x3e\n\t\t\t\t\t<span slot="noResult">{{ t(\'settings\', \'No results\') }}</span>\n\t\t\t\t</Multiselect>\n\t\t\t</div>\n\t\t\t<div v-if="subAdminsGroups.length>0 && settings.isAdmin"\n\t\t\t\tclass="subadmins">\n\t\t\t\t<Multiselect v-model="newUser.subAdminsGroups"\n\t\t\t\t\t:close-on-select="false"\n\t\t\t\t\t:multiple="true"\n\t\t\t\t\t:options="subAdminsGroups"\n\t\t\t\t\t:placeholder="t(\'settings\', \'Set user as admin for\')"\n\t\t\t\t\t:tag-width="60"\n\t\t\t\t\tclass="multiselect-vue"\n\t\t\t\t\tlabel="name"\n\t\t\t\t\ttrack-by="id">\n\t\t\t\t\t<span slot="noResult">{{ t(\'settings\', \'No results\') }}</span>\n\t\t\t\t</Multiselect>\n\t\t\t</div>\n\t\t\t<div class="quota">\n\t\t\t\t<Multiselect v-model="newUser.quota"\n\t\t\t\t\t:allow-empty="false"\n\t\t\t\t\t:options="quotaOptions"\n\t\t\t\t\t:placeholder="t(\'settings\', \'Select user quota\')"\n\t\t\t\t\t:taggable="true"\n\t\t\t\t\tclass="multiselect-vue"\n\t\t\t\t\tlabel="label"\n\t\t\t\t\ttrack-by="id"\n\t\t\t\t\t@tag="validateQuota" />\n\t\t\t</div>\n\t\t\t<div v-if="showConfig.showLanguages" class="languages">\n\t\t\t\t<Multiselect v-model="newUser.language"\n\t\t\t\t\t:allow-empty="false"\n\t\t\t\t\t:options="languages"\n\t\t\t\t\t:placeholder="t(\'settings\', \'Default language\')"\n\t\t\t\t\tclass="multiselect-vue"\n\t\t\t\t\tgroup-label="label"\n\t\t\t\t\tgroup-values="languages"\n\t\t\t\t\tlabel="name"\n\t\t\t\t\ttrack-by="code" />\n\t\t\t</div>\n\t\t\t<div v-if="showConfig.showStoragePath" class="storageLocation" />\n\t\t\t<div v-if="showConfig.showUserBackend" class="userBackend" />\n\t\t\t<div v-if="showConfig.showLastLogin" class="lastLogin" />\n\t\t\t<div class="userActions">\n\t\t\t\t<input id="newsubmit"\n\t\t\t\t\t:title="t(\'settings\', \'Add a new user\')"\n\t\t\t\t\tclass="button primary icon-checkmark-white has-tooltip"\n\t\t\t\t\ttype="submit"\n\t\t\t\t\tvalue="">\n\t\t\t\t<div class="closeButton">\n\t\t\t\t\t<Actions>\n\t\t\t\t\t\t<ActionButton icon="icon-close" @click="onClose">\n\t\t\t\t\t\t\t{{ t(\'settings\', \'Close\') }}\n\t\t\t\t\t\t</ActionButton>\n\t\t\t\t\t</Actions>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</form>\n\t\t<div id="grid-header"\n\t\t\t:class="{\'sticky\': scrolled && !showConfig.showNewUserForm}"\n\t\t\tclass="row">\n\t\t\t<div id="headerAvatar" class="avatar" />\n\t\t\t<div id="headerName" class="name">\n\t\t\t\t{{ t(\'settings\', \'Username\') }}\n\n\t\t\t\t<div class="subtitle">\n\t\t\t\t\t{{ t(\'settings\', \'Display name\') }}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div id="headerPassword" class="password">\n\t\t\t\t{{ t(\'settings\', \'Password\') }}\n\t\t\t</div>\n\t\t\t<div id="headerAddress" class="mailAddress">\n\t\t\t\t{{ t(\'settings\', \'Email\') }}\n\t\t\t</div>\n\t\t\t<div id="headerGroups" class="groups">\n\t\t\t\t{{ t(\'settings\', \'Groups\') }}\n\t\t\t</div>\n\t\t\t<div v-if="subAdminsGroups.length>0 && settings.isAdmin"\n\t\t\t\tid="headerSubAdmins"\n\t\t\t\tclass="subadmins">\n\t\t\t\t{{ t(\'settings\', \'Group admin for\') }}\n\t\t\t</div>\n\t\t\t<div id="headerQuota" class="quota">\n\t\t\t\t{{ t(\'settings\', \'Quota\') }}\n\t\t\t</div>\n\t\t\t<div v-if="showConfig.showLanguages"\n\t\t\t\tid="headerLanguages"\n\t\t\t\tclass="languages">\n\t\t\t\t{{ t(\'settings\', \'Language\') }}\n\t\t\t</div>\n\n\t\t\t<div v-if="showConfig.showUserBackend || showConfig.showStoragePath"\n\t\t\t\tclass="headerUserBackend userBackend">\n\t\t\t\t<div v-if="showConfig.showUserBackend" class="userBackend">\n\t\t\t\t\t{{ t(\'settings\', \'User backend\') }}\n\t\t\t\t</div>\n\t\t\t\t<div v-if="showConfig.showStoragePath"\n\t\t\t\t\tclass="subtitle storageLocation">\n\t\t\t\t\t{{ t(\'settings\', \'Storage location\') }}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div v-if="showConfig.showLastLogin"\n\t\t\t\tclass="headerLastLogin lastLogin">\n\t\t\t\t{{ t(\'settings\', \'Last login\') }}\n\t\t\t</div>\n\n\t\t\t<div class="userActions" />\n\t\t</div>\n\n\t\t<user-row v-for="user in filteredUsers"\n\t\t\t:key="user.id"\n\t\t\t:external-actions="externalActions"\n\t\t\t:groups="groups"\n\t\t\t:languages="languages"\n\t\t\t:quota-options="quotaOptions"\n\t\t\t:settings="settings"\n\t\t\t:show-config="showConfig"\n\t\t\t:sub-admins-groups="subAdminsGroups"\n\t\t\t:user="user" />\n\t\t<InfiniteLoading ref="infiniteLoading" @infinite="infiniteHandler">\n\t\t\t<div slot="spinner">\n\t\t\t\t<div class="users-icon-loading icon-loading" />\n\t\t\t</div>\n\t\t\t<div slot="no-more">\n\t\t\t\t<div class="users-list-end" />\n\t\t\t</div>\n\t\t\t<div slot="no-results">\n\t\t\t\t<div id="emptycontent">\n\t\t\t\t\t<div class="icon-contacts-dark" />\n\t\t\t\t\t<h2>{{ t(\'settings\', \'No users in here\') }}</h2>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</InfiniteLoading>\n\t</div>\n</template>\n\n<script>\nimport { subscribe, unsubscribe } from \'@nextcloud/event-bus\'\nimport InfiniteLoading from \'vue-infinite-loading\'\nimport Vue from \'vue\'\n\nimport Multiselect from \'@nextcloud/vue/dist/Components/Multiselect\'\nimport Actions from \'@nextcloud/vue/dist/Components/Actions\'\nimport ActionButton from \'@nextcloud/vue/dist/Components/ActionButton\'\n\nimport userRow from \'./UserList/UserRow\'\n\nconst unlimitedQuota = {\n\tid: \'none\',\n\tlabel: t(\'settings\', \'Unlimited\'),\n}\nconst defaultQuota = {\n\tid: \'default\',\n\tlabel: t(\'settings\', \'Default quota\'),\n}\nconst newUser = {\n\tid: \'\',\n\tdisplayName: \'\',\n\tpassword: \'\',\n\tmailAddress: \'\',\n\tgroups: [],\n\tsubAdminsGroups: [],\n\tquota: defaultQuota,\n\tlanguage: {\n\t\tcode: \'en\',\n\t\tname: t(\'settings\', \'Default language\'),\n\t},\n}\n\nexport default {\n\tname: \'UserList\',\n\tcomponents: {\n\t\tuserRow,\n\t\tMultiselect,\n\t\tInfiniteLoading,\n\t\tActions,\n\t\tActionButton,\n\t},\n\tprops: {\n\t\tusers: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\t\tshowConfig: {\n\t\t\ttype: Object,\n\t\t\trequired: true,\n\t\t},\n\t\tselectedGroup: {\n\t\t\ttype: String,\n\t\t\tdefault: null,\n\t\t},\n\t\texternalActions: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\t},\n\tdata() {\n\t\treturn {\n\t\t\tunlimitedQuota,\n\t\t\tdefaultQuota,\n\t\t\tloading: {\n\t\t\t\tall: false,\n\t\t\t\tgroups: false,\n\t\t\t},\n\t\t\tscrolled: false,\n\t\t\tsearchQuery: \'\',\n\t\t\tnewUser: Object.assign({}, newUser),\n\t\t}\n\t},\n\tcomputed: {\n\t\tsettings() {\n\t\t\treturn this.$store.getters.getServerData\n\t\t},\n\t\tselectedGroupDecoded() {\n\t\t\treturn decodeURIComponent(this.selectedGroup)\n\t\t},\n\t\tfilteredUsers() {\n\t\t\tif (this.selectedGroup === \'disabled\') {\n\t\t\t\treturn this.users.filter(user => user.enabled === false)\n\t\t\t}\n\t\t\tif (!this.settings.isAdmin) {\n\t\t\t\t// we don\'t want subadmins to edit themselves\n\t\t\t\treturn this.users.filter(user => user.enabled !== false)\n\t\t\t}\n\t\t\treturn this.users.filter(user => user.enabled !== false)\n\t\t},\n\t\tgroups() {\n\t\t\t// data provided php side + remove the disabled group\n\t\t\treturn this.$store.getters.getGroups\n\t\t\t\t.filter(group => group.id !== \'disabled\')\n\t\t\t\t.sort((a, b) => a.name.localeCompare(b.name))\n\t\t},\n\t\tcanAddGroups() {\n\t\t\t// disabled if no permission to add new users to group\n\t\t\treturn this.groups.map(group => {\n\t\t\t\t// clone object because we don\'t want\n\t\t\t\t// to edit the original groups\n\t\t\t\tgroup = Object.assign({}, group)\n\t\t\t\tgroup.$isDisabled = group.canAdd === false\n\t\t\t\treturn group\n\t\t\t})\n\t\t},\n\t\tsubAdminsGroups() {\n\t\t\t// data provided php side\n\t\t\treturn this.$store.getters.getSubadminGroups\n\t\t},\n\t\tquotaOptions() {\n\t\t\t// convert the preset array into objects\n\t\t\tconst quotaPreset = this.settings.quotaPreset.reduce((acc, cur) => acc.concat({\n\t\t\t\tid: cur,\n\t\t\t\tlabel: cur,\n\t\t\t}), [])\n\t\t\t// add default presets\n\t\t\tquotaPreset.unshift(this.unlimitedQuota)\n\t\t\tquotaPreset.unshift(this.defaultQuota)\n\t\t\treturn quotaPreset\n\t\t},\n\t\tminPasswordLength() {\n\t\t\treturn this.$store.getters.getPasswordPolicyMinLength\n\t\t},\n\t\tusersOffset() {\n\t\t\treturn this.$store.getters.getUsersOffset\n\t\t},\n\t\tusersLimit() {\n\t\t\treturn this.$store.getters.getUsersLimit\n\t\t},\n\t\tusersCount() {\n\t\t\treturn this.users.length\n\t\t},\n\n\t\t/* LANGUAGES */\n\t\tlanguages() {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tlabel: t(\'settings\', \'Common languages\'),\n\t\t\t\t\tlanguages: this.settings.languages.commonlanguages,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: t(\'settings\', \'All languages\'),\n\t\t\t\t\tlanguages: this.settings.languages.languages,\n\t\t\t\t},\n\t\t\t]\n\t\t},\n\t},\n\twatch: {\n\t\t// watch url change and group select\n\t\tselectedGroup(val, old) {\n\t\t\t// if selected is the disabled group but it\'s empty\n\t\t\tthis.redirectIfDisabled()\n\t\t\tthis.$store.commit(\'resetUsers\')\n\t\t\tthis.$refs.infiniteLoading.stateChanger.reset()\n\t\t\tthis.setNewUserDefaultGroup(val)\n\t\t},\n\n\t\t// make sure the infiniteLoading state is changed if we manually\n\t\t// add/remove data from the store\n\t\tusersCount(val, old) {\n\t\t\t// deleting the last user, reset the list\n\t\t\tif (val === 0 && old === 1) {\n\t\t\t\tthis.$refs.infiniteLoading.stateChanger.reset()\n\t\t\t\t// adding the first user, warn the infiniteLoader that\n\t\t\t\t// the list is not empty anymore (we don\'t fetch the newly\n\t\t\t\t// added user as we already have all the info we need)\n\t\t\t} else if (val === 1 && old === 0) {\n\t\t\t\tthis.$refs.infiniteLoading.stateChanger.loaded()\n\t\t\t}\n\t\t},\n\t},\n\n\tmounted() {\n\t\tif (!this.settings.canChangePassword) {\n\t\t\tOC.Notification.showTemporary(t(\'settings\', \'Password change is disabled because the master key is disabled\'))\n\t\t}\n\n\t\t/**\n\t\t * Reset and init new user form\n\t\t */\n\t\tthis.resetForm()\n\n\t\t/**\n\t\t * Register search\n\t\t */\n\t\tsubscribe(\'nextcloud:unified-search.search\', this.search)\n\t\tsubscribe(\'nextcloud:unified-search.reset\', this.resetSearch)\n\n\t\t/**\n\t\t * If disabled group but empty, redirect\n\t\t */\n\t\tthis.redirectIfDisabled()\n\t},\n\tbeforeDestroy() {\n\t\tunsubscribe(\'nextcloud:unified-search.search\', this.search)\n\t\tunsubscribe(\'nextcloud:unified-search.reset\', this.resetSearch)\n\t},\n\n\tmethods: {\n\t\tonScroll(event) {\n\t\t\tthis.scrolled = event.target.scrollTo > 0\n\t\t},\n\n\t\t/**\n\t\t * Validate quota string to make sure it\'s a valid human file size\n\t\t *\n\t\t * @param {string} quota Quota in readable format \'5 GB\'\n\t\t * @returns {Object}\n\t\t */\n\t\tvalidateQuota(quota) {\n\t\t\t// only used for new presets sent through @Tag\n\t\t\tconst validQuota = OC.Util.computerFileSize(quota)\n\t\t\tif (validQuota !== null && validQuota >= 0) {\n\t\t\t\t// unify format output\n\t\t\t\tquota = OC.Util.humanFileSize(OC.Util.computerFileSize(quota))\n\t\t\t\tthis.newUser.quota = { id: quota, label: quota }\n\t\t\t\treturn this.newUser.quota\n\t\t\t}\n\t\t\t// Default is unlimited\n\t\t\tthis.newUser.quota = this.quotaOptions[0]\n\t\t\treturn this.quotaOptions[0]\n\t\t},\n\n\t\tinfiniteHandler($state) {\n\t\t\tthis.$store.dispatch(\'getUsers\', {\n\t\t\t\toffset: this.usersOffset,\n\t\t\t\tlimit: this.usersLimit,\n\t\t\t\tgroup: this.selectedGroup !== \'disabled\' ? this.selectedGroup : \'\',\n\t\t\t\tsearch: this.searchQuery,\n\t\t\t})\n\t\t\t\t.then((response) => {\n\t\t\t\t\tresponse ? $state.loaded() : $state.complete()\n\t\t\t\t})\n\t\t},\n\n\t\t/* SEARCH */\n\t\tsearch({ query }) {\n\t\t\tthis.searchQuery = query\n\t\t\tthis.$store.commit(\'resetUsers\')\n\t\t\tthis.$refs.infiniteLoading.stateChanger.reset()\n\t\t},\n\t\tresetSearch() {\n\t\t\tthis.search({ query: \'\' })\n\t\t},\n\n\t\tresetForm() {\n\t\t\t// revert form to original state\n\t\t\tthis.newUser = Object.assign({}, newUser)\n\n\t\t\t/**\n\t\t\t * Init default language from server data. The use of this.settings\n\t\t\t * requires a computed variable, which break the v-model binding of the form,\n\t\t\t * this is a much easier solution than getter and setter on a computed var\n\t\t\t */\n\t\t\tif (this.settings.defaultLanguage) {\n\t\t\t\tVue.set(this.newUser.language, \'code\', this.settings.defaultLanguage)\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * In case the user directly loaded the user list within a group\n\t\t\t * the watch won\'t be triggered. We need to initialize it.\n\t\t\t */\n\t\t\tthis.setNewUserDefaultGroup(this.selectedGroup)\n\n\t\t\tthis.loading.all = false\n\t\t},\n\t\tcreateUser() {\n\t\t\tthis.loading.all = true\n\t\t\tthis.$store.dispatch(\'addUser\', {\n\t\t\t\tuserid: this.newUser.id,\n\t\t\t\tpassword: this.newUser.password,\n\t\t\t\tdisplayName: this.newUser.displayName,\n\t\t\t\temail: this.newUser.mailAddress,\n\t\t\t\tgroups: this.newUser.groups.map(group => group.id),\n\t\t\t\tsubadmin: this.newUser.subAdminsGroups.map(group => group.id),\n\t\t\t\tquota: this.newUser.quota.id,\n\t\t\t\tlanguage: this.newUser.language.code,\n\t\t\t})\n\t\t\t\t.then(() => {\n\t\t\t\t\tthis.resetForm()\n\t\t\t\t\tthis.$refs.newusername.focus()\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tthis.loading.all = false\n\t\t\t\t\tif (error.response && error.response.data && error.response.data.ocs && error.response.data.ocs.meta) {\n\t\t\t\t\t\tconst statuscode = error.response.data.ocs.meta.statuscode\n\t\t\t\t\t\tif (statuscode === 102) {\n\t\t\t\t\t\t\t// wrong username\n\t\t\t\t\t\t\tthis.$refs.newusername.focus()\n\t\t\t\t\t\t} else if (statuscode === 107) {\n\t\t\t\t\t\t\t// wrong password\n\t\t\t\t\t\t\tthis.$refs.newuserpassword.focus()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t},\n\t\tsetNewUserDefaultGroup(value) {\n\t\t\tif (value && value.length > 0) {\n\t\t\t\t// setting new user default group to the current selected one\n\t\t\t\tconst currentGroup = this.groups.find(group => group.id === value)\n\t\t\t\tif (currentGroup) {\n\t\t\t\t\tthis.newUser.groups = [currentGroup]\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\t// fallback, empty selected group\n\t\t\tthis.newUser.groups = []\n\t\t},\n\n\t\t/**\n\t\t * Create a new group\n\t\t *\n\t\t * @param {string} gid Group id\n\t\t * @returns {Promise}\n\t\t */\n\t\tcreateGroup(gid) {\n\t\t\tthis.loading.groups = true\n\t\t\tthis.$store.dispatch(\'addGroup\', gid)\n\t\t\t\t.then((group) => {\n\t\t\t\t\tthis.newUser.groups.push(this.groups.find(group => group.id === gid))\n\t\t\t\t\tthis.loading.groups = false\n\t\t\t\t})\n\t\t\t\t.catch(() => {\n\t\t\t\t\tthis.loading.groups = false\n\t\t\t\t})\n\t\t\treturn this.$store.getters.getGroups[this.groups.length]\n\t\t},\n\n\t\t/**\n\t\t * If the selected group is the disabled group but the count is 0\n\t\t * redirect to the all users page.\n\t\t * * we only check for 0 because we don\'t have the count on ldap\n\t\t * * and we therefore set the usercount to -1 in this specific case\n\t\t */\n\t\tredirectIfDisabled() {\n\t\t\tconst allGroups = this.$store.getters.getGroups\n\t\t\tif (this.selectedGroup === \'disabled\'\n\t\t\t\t\t\t&& allGroups.findIndex(group => group.id === \'disabled\' && group.usercount === 0) > -1) {\n\t\t\t\t// disabled group is empty, redirection to all users\n\t\t\t\tthis.$router.push({ name: \'users\' })\n\t\t\t\tthis.$refs.infiniteLoading.stateChanger.reset()\n\t\t\t}\n\t\t},\n\t\tonClose() {\n\t\t\tthis.showConfig.showNewUserForm = false\n\t\t},\n\t},\n}\n<\/script>\n<style scoped>\n\t.row::v-deep .multiselect__single {\n\t\tz-index: auto !important;\n\t}\n</style>\n'],"sourceRoot":""}]),n.a=r},600:function(t,n,e){"use strict";var s=e(65),i=e.n(s),a=e(66),r=e.n(a)()(i.a);r.push([t.i,".app-navigation__list #addgroup[data-v-90cdadc6] .app-navigation-entry__utils{display:none}\n","",{"version":3,"sources":["webpack://./apps/settings/src/views/Users.vue"],"names":[],"mappings":"AAsgBA,8EACC,YAAa","sourcesContent":["\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\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\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\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\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\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// force hiding the editing action for the add group entry\n.app-navigation__list #addgroup::v-deep .app-navigation-entry__utils {\n\tdisplay: none;\n}\n"],"sourceRoot":""}]),n.a=r},613:function(n,e,s){"use strict";s.r(e);var i=s(372),a=s.n(i),r=s(585),o=s.n(r),u=s(586),l=s.n(u),d=s(592),c=s.n(d),g=s(587),p=s.n(g),h=s(588),m=s.n(h),f=s(593),v=s.n(f),w=s(594),b=s.n(w),A=s(25),y=s.n(A),C=s(589),U=s.n(C),_=s(11),k=s(369),L=s.n(k),G=s(15),x=s(590),S=s.n(x),q=s(138),N=s(595),O=s.n(N),$=s(373),M=s.n($),P=s(591),D=s.n(P),B=s(131),Q=s(272),R=s(596),j=s.n(R),z=s(132);function F(t){return(F="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}var I={props:{user:{type:Object,required:!0},settings:{type:Object,default:function(){return{}}},groups:{type:Array,default:function(){return[]}},subAdminsGroups:{type:Array,default:function(){return[]}},quotaOptions:{type:Array,default:function(){return[]}},showConfig:{type:Object,default:function(){return{}}},languages:{type:Array,required:!0},externalActions:{type:Array,default:function(){return[]}}},computed:{userGroups:function(){var t=this,n=this.groups.filter((function(n){return t.user.groups.includes(n.id)}));return n},userSubAdminsGroups:function(){var t=this,n=this.subAdminsGroups.filter((function(n){return t.user.subadmin.includes(n.id)}));return n},availableGroups:function(){var t=this;return this.groups.map((function(n){var e=Object.assign({},n);return e.$isDisabled=!1===n.canAdd&&!t.user.groups.includes(n.id)||!1===n.canRemove&&t.user.groups.includes(n.id),e}))},usedSpace:function(){return this.user.quota.used?t("settings","{size} used",{size:OC.Util.humanFileSize(this.user.quota.used)}):t("settings","{size} used",{size:OC.Util.humanFileSize(0)})},usedQuota:function(){var t=this.user.quota.quota;t>0?t=Math.min(100,Math.round(this.user.quota.used/t*100)):t=95*(1-1/(this.user.quota.used/(10*Math.pow(2,30))+1));return isNaN(t)?0:t},userQuota:function(){if(this.user.quota.quota>=0){var t=OC.Util.humanFileSize(this.user.quota.quota),n=this.quotaOptions.find((function(n){return n.id===t}));return n||{id:t,label:t}}return"default"===this.user.quota.quota?this.quotaOptions[0]:this.quotaOptions[1]},minPasswordLength:function(){return this.$store.getters.getPasswordPolicyMinLength},userLanguage:function(){var t=this,n=this.languages[0].languages.concat(this.languages[1].languages).find((function(n){return n.code===t.user.language}));return"object"!==F(n)&&""!==this.user.language?{code:this.user.language,name:this.user.language}:""!==this.user.language&&n},userLastLoginTooltip:function(){return this.user.lastLogin>0?OC.Util.formatDate(this.user.lastLogin):""},userLastLogin:function(){return this.user.lastLogin>0?OC.Util.relativeModifiedDate(this.user.lastLogin):t("settings","Never")}},methods:{generateAvatar:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32;return Object(_.generateUrl)("/avatar/{user}/{size}?v={version}",{user:t,size:n,version:oc_userconfig.avatar.version})}}},E={name:"UserRowSimple",components:{PopoverMenu:j.a,ActionButton:a.a,Actions:M.a},directives:{ClickOutside:D.a},mixins:[I],props:{user:{type:Object,required:!0},loading:{type:Object,required:!0},showConfig:{type:Object,required:!0},userActions:{type:Array,required:!0},openedMenu:{type:Boolean,required:!0},feedbackMessage:{type:String,required:!0},subAdminsGroups:{type:Array,required:!0},settings:{type:Object,required:!0}},computed:{userGroupsLabels:function(){return this.userGroups.map((function(t){return t.name})).join(", ")},userSubAdminsGroupsLabels:function(){return this.userSubAdminsGroups.map((function(t){return t.name})).join(", ")},usedSpace:function(){return this.user.quota.used?t("settings","{size} used",{size:OC.Util.humanFileSize(this.user.quota.used)}):t("settings","{size} used",{size:OC.Util.humanFileSize(0)})},canEdit:function(){return Object(z.getCurrentUser)().uid!==this.user.id||this.settings.isAdmin},userQuota:function(){var n=this.user.quota.quota;return"default"===n&&"none"!==(n=this.settings.defaultQuota)&&(n=OC.Util.computerFileSize(n)),"none"===n||-3===n?t("settings","Unlimited"):n>=0?OC.Util.humanFileSize(n):OC.Util.humanFileSize(0)}},methods:{hideMenu:function(){this.$emit("hideMenu")},toggleEdit:function(){this.$emit("update:editing",!0)}}},T=s(64),W=s.n(T),Y=s(597),H={insert:"head",singleton:!1},J=(W()(Y.a,H),Y.a.locals,s(37)),V=Object(J.a)(E,(function(){var t=this,n=t.$createElement,e=t._self._c||n;return e("div",{staticClass:"row",class:{"disabled":t.loading.delete||t.loading.disable},attrs:{"data-id":t.user.id}},[e("div",{staticClass:"avatar",class:{"icon-loading-small":t.loading.delete||t.loading.disable||t.loading.wipe}},[t.loading.delete||t.loading.disable||t.loading.wipe?t._e():e("img",{attrs:{"alt":"","width":"32","height":"32","src":t.generateAvatar(t.user.id,32),"srcset":t.generateAvatar(t.user.id,64)+" 2x, "+t.generateAvatar(t.user.id,128)+" 4x"}})]),t._v(" "),e("div",{staticClass:"name"},[t._v("\n\t\t"+t._s(t.user.id)+"\n\t\t"),e("div",{staticClass:"displayName subtitle"},[e("div",{directives:[{name:"tooltip",rawName:"v-tooltip",value:t.user.displayname.length>20?t.user.displayname:"",expression:"user.displayname.length > 20 ? user.displayname : ''"}],staticClass:"cellText"},[t._v("\n\t\t\t\t"+t._s(t.user.displayname)+"\n\t\t\t")])])]),t._v(" "),e("div"),t._v(" "),e("div",{staticClass:"mailAddress"},[e("div",{directives:[{name:"tooltip",rawName:"v-tooltip",value:null!==t.user.email&&t.user.email.length>20?t.user.email:"",expression:"user.email !== null && user.email.length > 20 ? user.email : ''"}],staticClass:"cellText"},[t._v("\n\t\t\t"+t._s(t.user.email)+"\n\t\t")])]),t._v(" "),e("div",{staticClass:"groups"},[t._v("\n\t\t"+t._s(t.userGroupsLabels)+"\n\t")]),t._v(" "),t.subAdminsGroups.length>0&&t.settings.isAdmin?e("div",{staticClass:"subAdminsGroups"},[t._v("\n\t\t"+t._s(t.userSubAdminsGroupsLabels)+"\n\t")]):t._e(),t._v(" "),e("div",{staticClass:"userQuota"},[e("div",{staticClass:"quota"},[t._v("\n\t\t\t"+t._s(t.userQuota)+" ("+t._s(t.usedSpace)+")\n\t\t\t"),e("progress",{staticClass:"quota-user-progress",class:{"warn":t.usedQuota>80},attrs:{"max":"100"},domProps:{"value":t.usedQuota}})])]),t._v(" "),t.showConfig.showLanguages?e("div",{staticClass:"languages"},[t._v("\n\t\t"+t._s(t.userLanguage.name)+"\n\t")]):t._e(),t._v(" "),t.showConfig.showUserBackend||t.showConfig.showStoragePath?e("div",{staticClass:"userBackend"},[t.showConfig.showUserBackend?e("div",{staticClass:"userBackend"},[t._v("\n\t\t\t"+t._s(t.user.backend)+"\n\t\t")]):t._e(),t._v(" "),t.showConfig.showStoragePath?e("div",{directives:[{name:"tooltip",rawName:"v-tooltip",value:t.user.storageLocation,expression:"user.storageLocation"}],staticClass:"storageLocation subtitle"},[t._v("\n\t\t\t"+t._s(t.user.storageLocation)+"\n\t\t")]):t._e()]):t._e(),t._v(" "),t.showConfig.showLastLogin?e("div",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:t.userLastLoginTooltip,expression:"userLastLoginTooltip",modifiers:{"auto":!0}}],staticClass:"lastLogin"},[t._v("\n\t\t"+t._s(t.userLastLogin)+"\n\t")]):t._e(),t._v(" "),e("div",{staticClass:"userActions"},[t.canEdit&&!t.loading.all?e("div",{staticClass:"toggleUserActions"},[e("Actions",[e("ActionButton",{attrs:{"icon":"icon-rename"},on:{"click":t.toggleEdit}},[t._v("\n\t\t\t\t\t"+t._s(t.t("settings","Edit User"))+"\n\t\t\t\t")])],1),t._v(" "),e("div",{staticClass:"userPopoverMenuWrapper"},[e("button",{directives:[{name:"click-outside",rawName:"v-click-outside",value:t.hideMenu,expression:"hideMenu"}],staticClass:"icon-more",attrs:{"aria-label":t.t("settings","Toggle user actions menu")},on:{"click":function(n){return n.preventDefault(),t.$emit("toggleMenu")}}}),t._v(" "),e("div",{staticClass:"popovermenu",class:{"open":t.openedMenu},attrs:{"aria-expanded":t.openedMenu}},[e("PopoverMenu",{attrs:{"menu":t.userActions}})],1)])],1):t._e(),t._v(" "),e("div",{staticClass:"feedback",style:{opacity:""!==t.feedbackMessage?1:0}},[e("div",{staticClass:"icon-checkmark"}),t._v("\n\t\t\t"+t._s(t.feedbackMessage)+"\n\t\t")])])])}),[],!1,null,null,null).exports;function Z(t,n,e,s,i,a,r){try{var o=t[a](r),u=o.value}catch(t){return void e(t)}o.done?n(u):Promise.resolve(u).then(s,i)}function K(t){return function(){var n=this,e=arguments;return new Promise((function(s,i){var a=t.apply(n,e);function r(t){Z(a,s,i,r,o,"next",t)}function o(t){Z(a,s,i,r,o,"throw",t)}r(void 0)}))}}G.default.use(B.default);var X={name:"UserRow",components:{UserRowSimple:V,PopoverMenu:Q.PopoverMenu,Actions:Q.Actions,ActionButton:Q.ActionButton,Multiselect:Q.Multiselect},directives:{ClickOutside:D.a},mixins:[I],props:{user:{type:Object,required:!0},settings:{type:Object,default:function(){return{}}},groups:{type:Array,default:function(){return[]}},subAdminsGroups:{type:Array,default:function(){return[]}},quotaOptions:{type:Array,default:function(){return[]}},showConfig:{type:Object,default:function(){return{}}},languages:{type:Array,required:!0},externalActions:{type:Array,default:function(){return[]}}},data:function(){return{rand:parseInt(1e3*Math.random()),openedMenu:!1,feedbackMessage:"",editing:!1,loading:{all:!1,displayName:!1,password:!1,mailAddress:!1,groups:!1,subadmins:!1,quota:!1,delete:!1,disable:!1,languages:!1,wipe:!1}}},computed:{userActions:function(){var n=[{icon:"icon-delete",text:t("settings","Delete user"),action:this.deleteUser},{icon:"icon-delete",text:t("settings","Wipe all devices"),action:this.wipeUserDevices},{icon:this.user.enabled?"icon-close":"icon-add",text:this.user.enabled?t("settings","Disable user"):t("settings","Enable user"),action:this.enableDisableUser}];return null!==this.user.email&&""!==this.user.email&&n.push({icon:"icon-mail",text:t("settings","Resend welcome email"),action:this.sendWelcomeMail}),n.concat(this.externalActions)}},methods:{toggleMenu:function(){this.openedMenu=!this.openedMenu},hideMenu:function(){this.openedMenu=!1},wipeUserDevices:function(){var n=this,e=this.user.id;OC.dialogs.confirmDestructive(t("settings","In case of lost device or exiting the organization, this can remotely wipe the Nextcloud data from all devices associated with {userid}. Only works if the devices are connected to the internet.",{userid:e}),t("settings","Remote wipe of devices"),{type:OC.dialogs.YES_NO_BUTTONS,confirm:t("settings","Wipe {userid}'s devices",{userid:e}),confirmClasses:"error",cancel:t("settings","Cancel")},(function(t){t&&(n.loading.wipe=!0,n.loading.all=!0,n.$store.dispatch("wipeUserDevices",e).then((function(){n.loading.wipe=!1,n.loading.all=!1})))}),!0)},deleteUser:function(){var n=this,e=this.user.id;OC.dialogs.confirmDestructive(t("settings","Fully delete {userid}'s account including all their personal files, app data, etc.",{userid:e}),t("settings","Account deletion"),{type:OC.dialogs.YES_NO_BUTTONS,confirm:t("settings","Delete {userid}'s account",{userid:e}),confirmClasses:"error",cancel:t("settings","Cancel")},(function(t){if(t)return n.loading.delete=!0,n.loading.all=!0,n.$store.dispatch("deleteUser",e).then((function(){n.loading.delete=!1,n.loading.all=!1}))}),!0)},enableDisableUser:function(){var t=this;this.loading.delete=!0,this.loading.all=!0;var n=this.user.id,e=!this.user.enabled;return this.$store.dispatch("enableDisableUser",{userid:n,enabled:e}).then((function(){t.loading.delete=!1,t.loading.all=!1}))},updateDisplayName:function(){var t=this,n=this.$refs.displayName.value;this.loading.displayName=!0,this.$store.dispatch("setUserData",{userid:this.user.id,key:"displayname",value:n}).then((function(){t.loading.displayName=!1,t.$refs.displayName.value=n}))},updatePassword:function(){var t=this,n=this.$refs.password.value;this.loading.password=!0,this.$store.dispatch("setUserData",{userid:this.user.id,key:"password",value:n}).then((function(){t.loading.password=!1,t.$refs.password.value=""}))},updateEmail:function(){var t=this,n=this.$refs.mailAddress.value;this.loading.mailAddress=!0,this.$store.dispatch("setUserData",{userid:this.user.id,key:"email",value:n}).then((function(){t.loading.mailAddress=!1,t.$refs.mailAddress.value=n}))},createGroup:function(t){var n=this;return K(regeneratorRuntime.mark((function e(){var s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.loading={groups:!0,subadmins:!0},e.prev=1,e.next=4,n.$store.dispatch("addGroup",t);case 4:return s=n.user.id,e.next=7,n.$store.dispatch("addUserGroup",{userid:s,gid:t});case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),console.error(e.t0);case 12:return e.prev=12,n.loading={groups:!1,subadmins:!1},e.finish(12);case 15:return e.abrupt("return",n.$store.getters.getGroups[n.groups.length]);case 16:case"end":return e.stop()}}),e,null,[[1,9,12,15]])})))()},addUserGroup:function(t){var n=this;return K(regeneratorRuntime.mark((function e(){var s,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!1!==t.canAdd){e.next=2;break}return e.abrupt("return",!1);case 2:return n.loading.groups=!0,s=n.user.id,i=t.id,e.prev=5,e.next=8,n.$store.dispatch("addUserGroup",{userid:s,gid:i});case 8:e.next=13;break;case 10:e.prev=10,e.t0=e.catch(5),console.error(e.t0);case 13:return e.prev=13,n.loading.groups=!1,e.finish(13);case 16:case"end":return e.stop()}}),e,null,[[5,10,13,16]])})))()},removeUserGroup:function(t){var n=this;return K(regeneratorRuntime.mark((function e(){var s,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!1!==t.canRemove){e.next=2;break}return e.abrupt("return",!1);case 2:return n.loading.groups=!0,s=n.user.id,i=t.id,e.prev=5,e.next=8,n.$store.dispatch("removeUserGroup",{userid:s,gid:i});case 8:n.loading.groups=!1,n.$route.params.selectedGroup===i&&n.$store.commit("deleteUser",s),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(5),n.loading.groups=!1;case 15:case"end":return e.stop()}}),e,null,[[5,12]])})))()},addUserSubAdmin:function(t){var n=this;return K(regeneratorRuntime.mark((function e(){var s,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.loading.subadmins=!0,s=n.user.id,i=t.id,e.prev=3,e.next=6,n.$store.dispatch("addUserSubAdmin",{userid:s,gid:i});case 6:n.loading.subadmins=!1,e.next=12;break;case 9:e.prev=9,e.t0=e.catch(3),console.error(e.t0);case 12:case"end":return e.stop()}}),e,null,[[3,9]])})))()},removeUserSubAdmin:function(t){var n=this;return K(regeneratorRuntime.mark((function e(){var s,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.loading.subadmins=!0,s=n.user.id,i=t.id,e.prev=3,e.next=6,n.$store.dispatch("removeUserSubAdmin",{userid:s,gid:i});case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(3),console.error(e.t0);case 11:return e.prev=11,n.loading.subadmins=!1,e.finish(11);case 14:case"end":return e.stop()}}),e,null,[[3,8,11,14]])})))()},setUserQuota:function(){var t=arguments,n=this;return K(regeneratorRuntime.mark((function e(){var s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=t.length>0&&void 0!==t[0]?t[0]:"none",n.loading.quota=!0,s=s.id?s.id:s,e.prev=3,e.next=6,n.$store.dispatch("setUserData",{userid:n.user.id,key:"quota",value:s});case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(3),console.error(e.t0);case 11:return e.prev=11,n.loading.quota=!1,e.finish(11);case 14:return e.abrupt("return",s);case 15:case"end":return e.stop()}}),e,null,[[3,8,11,14]])})))()},validateQuota:function(t){var n=OC.Util.computerFileSize(t);return null!==n&&n>=0&&this.setUserQuota(OC.Util.humanFileSize(OC.Util.computerFileSize(t)))},setUserLanguage:function(t){var n=this;return K(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n.loading.languages=!0,e.prev=1,e.next=4,n.$store.dispatch("setUserData",{userid:n.user.id,key:"language",value:t.code});case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),console.error(e.t0);case 9:return e.prev=9,n.loading.languages=!1,e.finish(9);case 12:return e.abrupt("return",t);case 13:case"end":return e.stop()}}),e,null,[[1,6,9,12]])})))()},sendWelcomeMail:function(){var n=this;this.loading.all=!0,this.$store.dispatch("sendWelcomeMail",this.user.id).then((function(e){e&&(n.feedbackMessage=t("setting","Welcome mail sent!"),setTimeout((function(){n.feedbackMessage=""}),2e3)),n.loading.all=!1}))}}},tt=s(598),nt={insert:"head",singleton:!1},et=(W()(tt.a,nt),tt.a.locals,Object(J.a)(X,(function(){var t=this,n=t.$createElement,e=t._self._c||n;return 1===Object.keys(t.user).length?e("div",{staticClass:"row",attrs:{"data-id":t.user.id}},[e("div",{staticClass:"avatar",class:{"icon-loading-small":t.loading.delete||t.loading.disable||t.loading.wipe}},[t.loading.delete||t.loading.disable||t.loading.wipe?t._e():e("img",{attrs:{"src":t.generateAvatar(t.user.id,32),"srcset":t.generateAvatar(t.user.id,64)+" 2x, "+t.generateAvatar(t.user.id,128)+" 4x","alt":"","height":"32","width":"32"}})]),t._v(" "),e("div",{staticClass:"name"},[t._v("\n\t\t"+t._s(t.user.id)+"\n\t")]),t._v(" "),e("div",{staticClass:"obfuscated"},[t._v("\n\t\t"+t._s(t.t("settings","You do not have permissions to see the details of this user"))+"\n\t")])]):t.editing?e("div",{staticClass:"row row--editable",class:{"disabled":t.loading.delete||t.loading.disable,"row--menu-opened":t.openedMenu},attrs:{"data-id":t.user.id}},[e("div",{staticClass:"avatar",class:{"icon-loading-small":t.loading.delete||t.loading.disable||t.loading.wipe}},[t.loading.delete||t.loading.disable||t.loading.wipe?t._e():e("img",{attrs:{"src":t.generateAvatar(t.user.id,32),"srcset":t.generateAvatar(t.user.id,64)+" 2x, "+t.generateAvatar(t.user.id,128)+" 4x","alt":"","height":"32","width":"32"}})]),t._v(" "),t.user.backendCapabilities.setDisplayName?e("div",{staticClass:"displayName"},[e("form",{staticClass:"displayName",class:{"icon-loading-small":t.loading.displayName},on:{"submit":function(n){return n.preventDefault(),t.updateDisplayName(n)}}},[e("input",{ref:"displayName",attrs:{"id":"displayName"+t.user.id+t.rand,"disabled":t.loading.displayName||t.loading.all,"autocapitalize":"off","autocomplete":"off","autocorrect":"off","spellcheck":"false","type":"text"},domProps:{"value":t.user.displayname}}),t._v(" "),e("input",{staticClass:"icon-confirm",attrs:{"type":"submit","value":""}})])]):e("div",{staticClass:"name"},[t._v("\n\t\t"+t._s(t.user.id)+"\n\t\t"),e("div",{staticClass:"displayName subtitle"},[e("div",{directives:[{name:"tooltip",rawName:"v-tooltip",value:t.user.displayname.length>20?t.user.displayname:"",expression:"user.displayname.length > 20 ? user.displayname : ''"}],staticClass:"cellText"},[t._v("\n\t\t\t\t"+t._s(t.user.displayname)+"\n\t\t\t")])])]),t._v(" "),t.settings.canChangePassword&&t.user.backendCapabilities.setPassword?e("form",{staticClass:"password",class:{"icon-loading-small":t.loading.password},on:{"submit":function(n){return n.preventDefault(),t.updatePassword(n)}}},[e("input",{ref:"password",attrs:{"id":"password"+t.user.id+t.rand,"disabled":t.loading.password||t.loading.all,"minlength":t.minPasswordLength,"placeholder":t.t("settings","Add new password"),"autocapitalize":"off","autocomplete":"new-password","autocorrect":"off","required":"","spellcheck":"false","type":"password","value":""}}),t._v(" "),e("input",{staticClass:"icon-confirm",attrs:{"type":"submit","value":""}})]):e("div"),t._v(" "),e("form",{staticClass:"mailAddress",class:{"icon-loading-small":t.loading.mailAddress},on:{"submit":function(n){return n.preventDefault(),t.updateEmail(n)}}},[e("input",{ref:"mailAddress",attrs:{"id":"mailAddress"+t.user.id+t.rand,"disabled":t.loading.mailAddress||t.loading.all,"placeholder":t.t("settings","Add new email address"),"autocapitalize":"off","autocomplete":"new-password","autocorrect":"off","spellcheck":"false","type":"email"},domProps:{"value":t.user.email}}),t._v(" "),e("input",{staticClass:"icon-confirm",attrs:{"type":"submit","value":""}})]),t._v(" "),e("div",{staticClass:"groups",class:{"icon-loading-small":t.loading.groups}},[e("Multiselect",{staticClass:"multiselect-vue",attrs:{"close-on-select":!1,"disabled":t.loading.groups||t.loading.all,"limit":2,"multiple":!0,"options":t.availableGroups,"placeholder":t.t("settings","Add user in group"),"tag-width":60,"taggable":t.settings.isAdmin,"value":t.userGroups,"label":"name","tag-placeholder":"create","track-by":"id"},on:{"remove":t.removeUserGroup,"select":t.addUserGroup,"tag":t.createGroup}},[e("span",{attrs:{"slot":"noResult"},slot:"noResult"},[t._v(t._s(t.t("settings","No results")))])])],1),t._v(" "),t.subAdminsGroups.length>0&&t.settings.isAdmin?e("div",{staticClass:"subadmins",class:{"icon-loading-small":t.loading.subadmins}},[e("Multiselect",{staticClass:"multiselect-vue",attrs:{"close-on-select":!1,"disabled":t.loading.subadmins||t.loading.all,"limit":2,"multiple":!0,"options":t.subAdminsGroups,"placeholder":t.t("settings","Set user as admin for"),"tag-width":60,"value":t.userSubAdminsGroups,"label":"name","track-by":"id"},on:{"remove":t.removeUserSubAdmin,"select":t.addUserSubAdmin}},[e("span",{attrs:{"slot":"noResult"},slot:"noResult"},[t._v(t._s(t.t("settings","No results")))])])],1):t._e(),t._v(" "),e("div",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:t.usedSpace,expression:"usedSpace",modifiers:{"auto":!0}}],staticClass:"quota",class:{"icon-loading-small":t.loading.quota}},[e("Multiselect",{staticClass:"multiselect-vue",attrs:{"allow-empty":!1,"disabled":t.loading.quota||t.loading.all,"options":t.quotaOptions,"placeholder":t.t("settings","Select user quota"),"taggable":!0,"value":t.userQuota,"label":"label","tag-placeholder":"create","track-by":"id"},on:{"input":t.setUserQuota,"tag":t.validateQuota}})],1),t._v(" "),t.showConfig.showLanguages?e("div",{staticClass:"languages",class:{"icon-loading-small":t.loading.languages}},[e("Multiselect",{staticClass:"multiselect-vue",attrs:{"allow-empty":!1,"disabled":t.loading.languages||t.loading.all,"options":t.languages,"placeholder":t.t("settings","No language set"),"value":t.userLanguage,"group-label":"label","group-values":"languages","label":"name","track-by":"code"},on:{"input":t.setUserLanguage}})],1):t._e(),t._v(" "),t.showConfig.showStoragePath||t.showConfig.showUserBackend?e("div",{staticClass:"storageLocation"}):t._e(),t._v(" "),t.showConfig.showLastLogin?e("div"):t._e(),t._v(" "),e("div",{staticClass:"userActions"},[t.loading.all?t._e():e("div",{staticClass:"toggleUserActions"},[e("Actions",[e("ActionButton",{attrs:{"icon":"icon-checkmark"},on:{"click":function(n){t.editing=!1}}},[t._v("\n\t\t\t\t\t"+t._s(t.t("settings","Done"))+"\n\t\t\t\t")])],1),t._v(" "),e("div",{directives:[{name:"click-outside",rawName:"v-click-outside",value:t.hideMenu,expression:"hideMenu"}],staticClass:"userPopoverMenuWrapper"},[e("div",{staticClass:"icon-more",on:{"click":t.toggleMenu}}),t._v(" "),e("div",{staticClass:"popovermenu",class:{"open":t.openedMenu}},[e("PopoverMenu",{attrs:{"menu":t.userActions}})],1)])],1),t._v(" "),e("div",{staticClass:"feedback",style:{opacity:""!==t.feedbackMessage?1:0}},[e("div",{staticClass:"icon-checkmark"}),t._v("\n\t\t\t"+t._s(t.feedbackMessage)+"\n\t\t")])])]):e("UserRowSimple",{class:{"row--menu-opened":t.openedMenu},attrs:{"editing":t.editing,"feedback-message":t.feedbackMessage,"groups":t.groups,"languages":t.languages,"loading":t.loading,"opened-menu":t.openedMenu,"settings":t.settings,"show-config":t.showConfig,"sub-admins-groups":t.subAdminsGroups,"user-actions":t.userActions,"user":t.user},on:{"update:editing":function(n){t.editing=n},"hideMenu":t.hideMenu,"toggleMenu":t.toggleMenu}})}),[],!1,null,"172121d3",null).exports),st={id:"none",label:t("settings","Unlimited")},it={id:"default",label:t("settings","Default quota")},at={id:"",displayName:"",password:"",mailAddress:"",groups:[],subAdminsGroups:[],quota:it,language:{code:"en",name:t("settings","Default language")}},rt={name:"UserList",components:{userRow:et,Multiselect:L.a,InfiniteLoading:O.a,Actions:M.a,ActionButton:a.a},props:{users:{type:Array,default:function(){return[]}},showConfig:{type:Object,required:!0},selectedGroup:{type:String,default:null},externalActions:{type:Array,default:function(){return[]}}},data:function(){return{unlimitedQuota:st,defaultQuota:it,loading:{all:!1,groups:!1},scrolled:!1,searchQuery:"",newUser:Object.assign({},at)}},computed:{settings:function(){return this.$store.getters.getServerData},selectedGroupDecoded:function(){return decodeURIComponent(this.selectedGroup)},filteredUsers:function(){return"disabled"===this.selectedGroup?this.users.filter((function(t){return!1===t.enabled})):(this.settings.isAdmin,this.users.filter((function(t){return!1!==t.enabled})))},groups:function(){return this.$store.getters.getGroups.filter((function(t){return"disabled"!==t.id})).sort((function(t,n){return t.name.localeCompare(n.name)}))},canAddGroups:function(){return this.groups.map((function(t){return(t=Object.assign({},t)).$isDisabled=!1===t.canAdd,t}))},subAdminsGroups:function(){return this.$store.getters.getSubadminGroups},quotaOptions:function(){var t=this.settings.quotaPreset.reduce((function(t,n){return t.concat({id:n,label:n})}),[]);return t.unshift(this.unlimitedQuota),t.unshift(this.defaultQuota),t},minPasswordLength:function(){return this.$store.getters.getPasswordPolicyMinLength},usersOffset:function(){return this.$store.getters.getUsersOffset},usersLimit:function(){return this.$store.getters.getUsersLimit},usersCount:function(){return this.users.length},languages:function(){return[{label:t("settings","Common languages"),languages:this.settings.languages.commonlanguages},{label:t("settings","All languages"),languages:this.settings.languages.languages}]}},watch:{selectedGroup:function(t,n){this.redirectIfDisabled(),this.$store.commit("resetUsers"),this.$refs.infiniteLoading.stateChanger.reset(),this.setNewUserDefaultGroup(t)},usersCount:function(t,n){0===t&&1===n?this.$refs.infiniteLoading.stateChanger.reset():1===t&&0===n&&this.$refs.infiniteLoading.stateChanger.loaded()}},mounted:function(){this.settings.canChangePassword||OC.Notification.showTemporary(t("settings","Password change is disabled because the master key is disabled")),this.resetForm(),Object(q.subscribe)("nextcloud:unified-search.search",this.search),Object(q.subscribe)("nextcloud:unified-search.reset",this.resetSearch),this.redirectIfDisabled()},beforeDestroy:function(){Object(q.unsubscribe)("nextcloud:unified-search.search",this.search),Object(q.unsubscribe)("nextcloud:unified-search.reset",this.resetSearch)},methods:{onScroll:function(t){this.scrolled=t.target.scrollTo>0},validateQuota:function(t){var n=OC.Util.computerFileSize(t);return null!==n&&n>=0?(t=OC.Util.humanFileSize(OC.Util.computerFileSize(t)),this.newUser.quota={id:t,label:t},this.newUser.quota):(this.newUser.quota=this.quotaOptions[0],this.quotaOptions[0])},infiniteHandler:function(t){this.$store.dispatch("getUsers",{offset:this.usersOffset,limit:this.usersLimit,group:"disabled"!==this.selectedGroup?this.selectedGroup:"",search:this.searchQuery}).then((function(n){n?t.loaded():t.complete()}))},search:function(t){var n=t.query;this.searchQuery=n,this.$store.commit("resetUsers"),this.$refs.infiniteLoading.stateChanger.reset()},resetSearch:function(){this.search({query:""})},resetForm:function(){this.newUser=Object.assign({},at),this.settings.defaultLanguage&&G.default.set(this.newUser.language,"code",this.settings.defaultLanguage),this.setNewUserDefaultGroup(this.selectedGroup),this.loading.all=!1},createUser:function(){var t=this;this.loading.all=!0,this.$store.dispatch("addUser",{userid:this.newUser.id,password:this.newUser.password,displayName:this.newUser.displayName,email:this.newUser.mailAddress,groups:this.newUser.groups.map((function(t){return t.id})),subadmin:this.newUser.subAdminsGroups.map((function(t){return t.id})),quota:this.newUser.quota.id,language:this.newUser.language.code}).then((function(){t.resetForm(),t.$refs.newusername.focus()})).catch((function(n){if(t.loading.all=!1,n.response&&n.response.data&&n.response.data.ocs&&n.response.data.ocs.meta){var e=n.response.data.ocs.meta.statuscode;102===e?t.$refs.newusername.focus():107===e&&t.$refs.newuserpassword.focus()}}))},setNewUserDefaultGroup:function(t){if(t&&t.length>0){var n=this.groups.find((function(n){return n.id===t}));if(n)return void(this.newUser.groups=[n])}this.newUser.groups=[]},createGroup:function(t){var n=this;return this.loading.groups=!0,this.$store.dispatch("addGroup",t).then((function(e){n.newUser.groups.push(n.groups.find((function(n){return n.id===t}))),n.loading.groups=!1})).catch((function(){n.loading.groups=!1})),this.$store.getters.getGroups[this.groups.length]},redirectIfDisabled:function(){var t=this.$store.getters.getGroups;"disabled"===this.selectedGroup&&t.findIndex((function(t){return"disabled"===t.id&&0===t.usercount}))>-1&&(this.$router.push({name:"users"}),this.$refs.infiniteLoading.stateChanger.reset())},onClose:function(){this.showConfig.showNewUserForm=!1}}},ot=s(599),ut={insert:"head",singleton:!1},lt=(W()(ot.a,ut),ot.a.locals,Object(J.a)(rt,(function(){var t=this,n=t.$createElement,e=t._self._c||n;return e("div",{staticClass:"user-list-grid",attrs:{"id":"app-content"},on:{"&scroll":function(n){return t.onScroll(n)}}},[e("form",{directives:[{name:"show",rawName:"v-show",value:t.showConfig.showNewUserForm,expression:"showConfig.showNewUserForm"}],staticClass:"row",class:{"sticky":t.scrolled&&t.showConfig.showNewUserForm},attrs:{"id":"new-user","disabled":t.loading.all},on:{"submit":function(n){return n.preventDefault(),t.createUser(n)}}},[e("div",{class:t.loading.all?"icon-loading-small":"icon-add"}),t._v(" "),e("div",{staticClass:"name"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.newUser.id,expression:"newUser.id"}],ref:"newusername",attrs:{"id":"newusername","disabled":t.settings.newUserGenerateUserID,"placeholder":t.settings.newUserGenerateUserID?t.t("settings","Will be autogenerated"):t.t("settings","Username"),"autocapitalize":"none","autocomplete":"off","autocorrect":"off","name":"username","pattern":"[a-zA-Z0-9 _\\.@\\-']+","required":"","type":"text"},domProps:{"value":t.newUser.id},on:{"input":function(n){n.target.composing||t.$set(t.newUser,"id",n.target.value)}}}),t._v(" "),e("div",{staticClass:"displayName"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.newUser.displayName,expression:"newUser.displayName"}],attrs:{"id":"newdisplayname","placeholder":t.t("settings","Display name"),"autocapitalize":"none","autocomplete":"off","autocorrect":"off","name":"displayname","type":"text"},domProps:{"value":t.newUser.displayName},on:{"input":function(n){n.target.composing||t.$set(t.newUser,"displayName",n.target.value)}}})])]),t._v(" "),e("div",{staticClass:"password"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.newUser.password,expression:"newUser.password"}],ref:"newuserpassword",attrs:{"id":"newuserpassword","minlength":t.minPasswordLength,"placeholder":t.t("settings","Password"),"required":""===t.newUser.mailAddress,"autocapitalize":"none","autocomplete":"new-password","autocorrect":"off","name":"password","type":"password"},domProps:{"value":t.newUser.password},on:{"input":function(n){n.target.composing||t.$set(t.newUser,"password",n.target.value)}}})]),t._v(" "),e("div",{staticClass:"mailAddress"},[e("input",{directives:[{name:"model",rawName:"v-model",value:t.newUser.mailAddress,expression:"newUser.mailAddress"}],attrs:{"id":"newemail","placeholder":t.t("settings","Email"),"required":""===t.newUser.password||t.settings.newUserRequireEmail,"autocapitalize":"none","autocomplete":"off","autocorrect":"off","name":"email","type":"email"},domProps:{"value":t.newUser.mailAddress},on:{"input":function(n){n.target.composing||t.$set(t.newUser,"mailAddress",n.target.value)}}})]),t._v(" "),e("div",{staticClass:"groups"},[t.settings.isAdmin?t._e():e("input",{class:{"icon-loading-small":t.loading.groups},attrs:{"id":"newgroups","required":!t.settings.isAdmin,"tabindex":"-1","type":"text"},domProps:{"value":t.newUser.groups}}),t._v(" "),e("Multiselect",{staticClass:"multiselect-vue",attrs:{"close-on-select":!1,"disabled":t.loading.groups||t.loading.all,"multiple":!0,"options":t.canAddGroups,"placeholder":t.t("settings","Add user in group"),"tag-width":60,"taggable":!0,"label":"name","tag-placeholder":"create","track-by":"id"},on:{"tag":t.createGroup},model:{value:t.newUser.groups,callback:function(n){t.$set(t.newUser,"groups",n)},expression:"newUser.groups"}},[e("span",{attrs:{"slot":"noResult"},slot:"noResult"},[t._v(t._s(t.t("settings","No results")))])])],1),t._v(" "),t.subAdminsGroups.length>0&&t.settings.isAdmin?e("div",{staticClass:"subadmins"},[e("Multiselect",{staticClass:"multiselect-vue",attrs:{"close-on-select":!1,"multiple":!0,"options":t.subAdminsGroups,"placeholder":t.t("settings","Set user as admin for"),"tag-width":60,"label":"name","track-by":"id"},model:{value:t.newUser.subAdminsGroups,callback:function(n){t.$set(t.newUser,"subAdminsGroups",n)},expression:"newUser.subAdminsGroups"}},[e("span",{attrs:{"slot":"noResult"},slot:"noResult"},[t._v(t._s(t.t("settings","No results")))])])],1):t._e(),t._v(" "),e("div",{staticClass:"quota"},[e("Multiselect",{staticClass:"multiselect-vue",attrs:{"allow-empty":!1,"options":t.quotaOptions,"placeholder":t.t("settings","Select user quota"),"taggable":!0,"label":"label","track-by":"id"},on:{"tag":t.validateQuota},model:{value:t.newUser.quota,callback:function(n){t.$set(t.newUser,"quota",n)},expression:"newUser.quota"}})],1),t._v(" "),t.showConfig.showLanguages?e("div",{staticClass:"languages"},[e("Multiselect",{staticClass:"multiselect-vue",attrs:{"allow-empty":!1,"options":t.languages,"placeholder":t.t("settings","Default language"),"group-label":"label","group-values":"languages","label":"name","track-by":"code"},model:{value:t.newUser.language,callback:function(n){t.$set(t.newUser,"language",n)},expression:"newUser.language"}})],1):t._e(),t._v(" "),t.showConfig.showStoragePath?e("div",{staticClass:"storageLocation"}):t._e(),t._v(" "),t.showConfig.showUserBackend?e("div",{staticClass:"userBackend"}):t._e(),t._v(" "),t.showConfig.showLastLogin?e("div",{staticClass:"lastLogin"}):t._e(),t._v(" "),e("div",{staticClass:"userActions"},[e("input",{staticClass:"button primary icon-checkmark-white has-tooltip",attrs:{"id":"newsubmit","title":t.t("settings","Add a new user"),"type":"submit","value":""}}),t._v(" "),e("div",{staticClass:"closeButton"},[e("Actions",[e("ActionButton",{attrs:{"icon":"icon-close"},on:{"click":t.onClose}},[t._v("\n\t\t\t\t\t\t"+t._s(t.t("settings","Close"))+"\n\t\t\t\t\t")])],1)],1)])]),t._v(" "),e("div",{staticClass:"row",class:{"sticky":t.scrolled&&!t.showConfig.showNewUserForm},attrs:{"id":"grid-header"}},[e("div",{staticClass:"avatar",attrs:{"id":"headerAvatar"}}),t._v(" "),e("div",{staticClass:"name",attrs:{"id":"headerName"}},[t._v("\n\t\t\t"+t._s(t.t("settings","Username"))+"\n\n\t\t\t"),e("div",{staticClass:"subtitle"},[t._v("\n\t\t\t\t"+t._s(t.t("settings","Display name"))+"\n\t\t\t")])]),t._v(" "),e("div",{staticClass:"password",attrs:{"id":"headerPassword"}},[t._v("\n\t\t\t"+t._s(t.t("settings","Password"))+"\n\t\t")]),t._v(" "),e("div",{staticClass:"mailAddress",attrs:{"id":"headerAddress"}},[t._v("\n\t\t\t"+t._s(t.t("settings","Email"))+"\n\t\t")]),t._v(" "),e("div",{staticClass:"groups",attrs:{"id":"headerGroups"}},[t._v("\n\t\t\t"+t._s(t.t("settings","Groups"))+"\n\t\t")]),t._v(" "),t.subAdminsGroups.length>0&&t.settings.isAdmin?e("div",{staticClass:"subadmins",attrs:{"id":"headerSubAdmins"}},[t._v("\n\t\t\t"+t._s(t.t("settings","Group admin for"))+"\n\t\t")]):t._e(),t._v(" "),e("div",{staticClass:"quota",attrs:{"id":"headerQuota"}},[t._v("\n\t\t\t"+t._s(t.t("settings","Quota"))+"\n\t\t")]),t._v(" "),t.showConfig.showLanguages?e("div",{staticClass:"languages",attrs:{"id":"headerLanguages"}},[t._v("\n\t\t\t"+t._s(t.t("settings","Language"))+"\n\t\t")]):t._e(),t._v(" "),t.showConfig.showUserBackend||t.showConfig.showStoragePath?e("div",{staticClass:"headerUserBackend userBackend"},[t.showConfig.showUserBackend?e("div",{staticClass:"userBackend"},[t._v("\n\t\t\t\t"+t._s(t.t("settings","User backend"))+"\n\t\t\t")]):t._e(),t._v(" "),t.showConfig.showStoragePath?e("div",{staticClass:"subtitle storageLocation"},[t._v("\n\t\t\t\t"+t._s(t.t("settings","Storage location"))+"\n\t\t\t")]):t._e()]):t._e(),t._v(" "),t.showConfig.showLastLogin?e("div",{staticClass:"headerLastLogin lastLogin"},[t._v("\n\t\t\t"+t._s(t.t("settings","Last login"))+"\n\t\t")]):t._e(),t._v(" "),e("div",{staticClass:"userActions"})]),t._v(" "),t._l(t.filteredUsers,(function(n){return e("user-row",{key:n.id,attrs:{"external-actions":t.externalActions,"groups":t.groups,"languages":t.languages,"quota-options":t.quotaOptions,"settings":t.settings,"show-config":t.showConfig,"sub-admins-groups":t.subAdminsGroups,"user":n}})})),t._v(" "),e("InfiniteLoading",{ref:"infiniteLoading",on:{"infinite":t.infiniteHandler}},[e("div",{attrs:{"slot":"spinner"},slot:"spinner"},[e("div",{staticClass:"users-icon-loading icon-loading"})]),t._v(" "),e("div",{attrs:{"slot":"no-more"},slot:"no-more"},[e("div",{staticClass:"users-list-end"})]),t._v(" "),e("div",{attrs:{"slot":"no-results"},slot:"no-results"},[e("div",{attrs:{"id":"emptycontent"}},[e("div",{staticClass:"icon-contacts-dark"}),t._v(" "),e("h2",[t._v(t._s(t.t("settings","No users in here")))])])])])],2)}),[],!1,null,"c4fdcc08",null).exports);function dt(t){return(dt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function ct(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);n&&(s=s.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,s)}return e}function gt(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?ct(Object(e),!0).forEach((function(n){pt(t,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ct(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))}return t}function pt(t,n,e){return n in t?Object.defineProperty(t,n,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[n]=e,t}function ht(t,n,e,s,i,a,r){try{var o=t[a](r),u=o.value}catch(t){return void e(t)}o.done?n(u):Promise.resolve(u).then(s,i)}function mt(t){return function(){var n=this,e=arguments;return new Promise((function(s,i){var a=t.apply(n,e);function r(t){ht(a,s,i,r,o,"next",t)}function o(t){ht(a,s,i,r,o,"throw",t)}r(void 0)}))}}G.default.use(S.a);var ft={name:"Users",components:{ActionButton:a.a,AppContent:o.a,AppNavigation:l.a,AppNavigationCaption:c.a,AppNavigationCounter:p.a,AppNavigationItem:m.a,AppNavigationNew:v.a,AppNavigationSettings:b.a,Content:U.a,Multiselect:L.a,UserList:lt},props:{selectedGroup:{type:String,default:null}},data:function(){return{unlimitedQuota:{id:"none",label:t("settings","Unlimited")},selectedQuota:!1,externalActions:[],loadingAddGroup:!1,loadingSendMail:!1,showConfig:{showStoragePath:!1,showUserBackend:!1,showLastLogin:!1,showNewUserForm:!1,showLanguages:!1}}},computed:{selectedGroupDecoded:function(){return this.selectedGroup?decodeURIComponent(this.selectedGroup):null},users:function(){return this.$store.getters.getUsers},groups:function(){return this.$store.getters.getGroups},usersOffset:function(){return this.$store.getters.getUsersOffset},usersLimit:function(){return this.$store.getters.getUsersLimit},showLanguages:{get:function(){return this.getLocalstorage("showLanguages")},set:function(t){this.setLocalStorage("showLanguages",t)}},showLastLogin:{get:function(){return this.getLocalstorage("showLastLogin")},set:function(t){this.setLocalStorage("showLastLogin",t)}},showUserBackend:{get:function(){return this.getLocalstorage("showUserBackend")},set:function(t){this.setLocalStorage("showUserBackend",t)}},showStoragePath:{get:function(){return this.getLocalstorage("showStoragePath")},set:function(t){this.setLocalStorage("showStoragePath",t)}},userCount:function(){return this.$store.getters.getUserCount},settings:function(){return this.$store.getters.getServerData},quotaOptions:function(){var t=this.settings.quotaPreset.reduce((function(t,n){return t.concat({id:n,label:n})}),[]);return t.unshift(this.unlimitedQuota),t},defaultQuota:{get:function(){return!1!==this.selectedQuota?this.selectedQuota:this.settings.defaultQuota!==this.unlimitedQuota.id&&OC.Util.computerFileSize(this.settings.defaultQuota)>=0?{id:this.settings.defaultQuota,label:this.settings.defaultQuota}:this.unlimitedQuota},set:function(t){this.selectedQuota=t}},sendWelcomeMail:{get:function(){return this.settings.newUserSendEmail},set:function(t){var n=this;return mt(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,n.loadingSendMail=!0,n.$store.commit("setServerData",gt(gt({},n.settings),{},{newUserSendEmail:t})),e.next=5,y.a.post(Object(_.generateUrl)("/settings/users/preferences/newUser.sendEmail"),{value:t?"yes":"no"});case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.error("could not update newUser.sendEmail preference: "+e.t0.message,e.t0);case 10:return e.prev=10,n.loadingSendMail=!1,e.finish(10);case 13:case"end":return e.stop()}}),e,null,[[0,7,10,13]])})))()}},groupList:function(){var t=this;return(Array.isArray(this.groups)?this.groups:[]).filter((function(t){return"disabled"!==t.id&&"admin"!==t.id})).map((function(n){return t.formatGroupMenu(n)}))},adminGroupMenu:function(){return this.formatGroupMenu(this.groups.find((function(t){return"admin"===t.id})))},disabledGroupMenu:function(){return this.formatGroupMenu(this.groups.find((function(t){return"disabled"===t.id})))}},beforeMount:function(){this.$store.commit("initGroups",{groups:this.$store.getters.getServerData.groups,orderBy:this.$store.getters.getServerData.sortGroups,userCount:this.$store.getters.getServerData.userCount}),this.$store.dispatch("getPasswordPolicyMinLength")},created:function(){Object.assign(OCA,{Settings:{UserList:{registerAction:this.registerAction}}})},methods:{toggleNewUserMenu:function(){this.showConfig.showNewUserForm=!this.showConfig.showNewUserForm,this.showConfig.showNewUserForm&&G.default.nextTick((function(){window.newusername.focus()}))},getLocalstorage:function(t){var n=this.$localStorage.get(t);return this.showConfig[t]=null!==n?"true"===n:this.showConfig[t],this.showConfig[t]},setLocalStorage:function(t,n){return this.showConfig[t]=n,this.$localStorage.set(t,n),n},removeGroup:function(n){var e=this;OC.dialogs.confirm(t("settings","You are about to remove the group {group}. The users will NOT be deleted.",{group:n}),t("settings","Please confirm the group removal "),(function(t){t&&e.$store.dispatch("removeGroup",n)}))},setDefaultQuota:function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"none";this.$store.dispatch("setAppConfig",{app:"files",key:"default_quota",value:n.id?n.id:n}).then((function(){"object"!==dt(n)&&(n={id:n,label:n}),t.defaultQuota=n}))},validateQuota:function(t){return null===OC.Util.computerFileSize(t)?this.setDefaultQuota("none"):this.setDefaultQuota(OC.Util.humanFileSize(OC.Util.computerFileSize(t)))},registerAction:function(t,n,e){return this.externalActions.push({icon:t,text:n,action:e}),this.externalActions},createGroup:function(t){var n=this;return mt(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(""!==t.trim()){e.next=3;break}return G.default.nextTick((function(){n.toggleAddGroupEntry(!0)})),e.abrupt("return");case 3:return e.prev=3,n.loadingAddGroup=!0,e.next=7,n.$store.dispatch("addGroup",t.trim());case 7:n.toggleAddGroupEntry(!1),n.$router.push({name:"group",params:{selectedGroup:encodeURIComponent(t.trim())}}),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(3),n.toggleAddGroupEntry(!0);case 14:return e.prev=14,n.loadingAddGroup=!1,e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[3,11,14,17]])})))()},toggleAddGroupEntry:function(t){var n=this;void 0===t&&(t=!this.$refs.addGroup.editing),this.$refs.addGroup.editing=t,G.default.nextTick((function(){if(n.$refs.addGroup.$el){var t=n.$refs.addGroup.$el.querySelector('form > input[type="text"]');t&&t.focus()}}))},formatGroupMenu:function(t){var n={};return void 0===t?{}:(n.id=t.id,n.title=t.name,n.usercount=t.usercount,t.usercount-t.disabled>0&&(n.count=t.usercount-t.disabled),n)}}},vt=s(600),wt={insert:"head",singleton:!1},bt=(W()(vt.a,wt),vt.a.locals,Object(J.a)(ft,(function(){var t=this,n=t.$createElement,e=t._self._c||n;return e("Content",{attrs:{"app-name":"settings","navigation-class":{"icon-loading":t.loadingAddGroup}}},[e("AppNavigation",{scopedSlots:t._u([{key:"list",fn:function(){return[e("AppNavigationItem",{ref:"addGroup",attrs:{"id":"addgroup","edit-placeholder":t.t("settings","Enter group name"),"editable":!0,"loading":t.loadingAddGroup,"title":t.t("settings","Add group"),"icon":"icon-add"},on:{"click":function(n){return t.toggleAddGroupEntry(!0)},"update:title":t.createGroup}}),t._v(" "),e("AppNavigationItem",{attrs:{"id":"everyone","exact":!0,"title":t.t("settings","Everyone"),"to":{name:"users"},"icon":"icon-contacts-dark"}},[t.userCount>0?e("AppNavigationCounter",{attrs:{"slot":"counter"},slot:"counter"},[t._v("\n\t\t\t\t\t"+t._s(t.userCount)+"\n\t\t\t\t")]):t._e()],1),t._v(" "),t.settings.isAdmin?e("AppNavigationItem",{attrs:{"id":"admin","exact":!0,"title":t.t("settings","Admins"),"to":{name:"group",params:{selectedGroup:"admin"}},"icon":"icon-user-admin"}},[t.adminGroupMenu.count?e("AppNavigationCounter",{attrs:{"slot":"counter"},slot:"counter"},[t._v("\n\t\t\t\t\t"+t._s(t.adminGroupMenu.count)+"\n\t\t\t\t")]):t._e()],1):t._e(),t._v(" "),t.disabledGroupMenu.usercount>0||-1===t.disabledGroupMenu.usercount?e("AppNavigationItem",{attrs:{"id":"disabled","exact":!0,"title":t.t("settings","Disabled users"),"to":{name:"group",params:{selectedGroup:"disabled"}},"icon":"icon-disabled-users"}},[t.disabledGroupMenu.usercount>0?e("AppNavigationCounter",{attrs:{"slot":"counter"},slot:"counter"},[t._v("\n\t\t\t\t\t"+t._s(t.disabledGroupMenu.usercount)+"\n\t\t\t\t")]):t._e()],1):t._e(),t._v(" "),t.groupList.length>0?e("AppNavigationCaption",{attrs:{"title":t.t("settings","Groups")}}):t._e(),t._v(" "),t._l(t.groupList,(function(n){return e("AppNavigationItem",{key:n.id,attrs:{"exact":!0,"title":n.title,"to":{name:"group",params:{selectedGroup:encodeURIComponent(n.id)}}}},[n.count?e("AppNavigationCounter",{attrs:{"slot":"counter"},slot:"counter"},[t._v("\n\t\t\t\t\t"+t._s(n.count)+"\n\t\t\t\t")]):t._e(),t._v(" "),e("template",{slot:"actions"},["admin"!==n.id&&"disabled"!==n.id&&t.settings.isAdmin?e("ActionButton",{attrs:{"icon":"icon-delete"},on:{"click":function(e){return t.removeGroup(n.id)}}},[t._v("\n\t\t\t\t\t\t"+t._s(t.t("settings","Remove group"))+"\n\t\t\t\t\t")]):t._e()],1)],2)}))]},proxy:!0},{key:"footer",fn:function(){return[e("AppNavigationSettings",[e("div",[e("p",[t._v(t._s(t.t("settings","Default quota:")))]),t._v(" "),e("Multiselect",{attrs:{"value":t.defaultQuota,"options":t.quotaOptions,"tag-placeholder":"create","placeholder":t.t("settings","Select default quota"),"label":"label","track-by":"id","allow-empty":!1,"taggable":!0},on:{"tag":t.validateQuota,"input":t.setDefaultQuota}})],1),t._v(" "),e("div",[e("input",{directives:[{name:"model",rawName:"v-model",value:t.showLanguages,expression:"showLanguages"}],staticClass:"checkbox",attrs:{"id":"showLanguages","type":"checkbox"},domProps:{"checked":Array.isArray(t.showLanguages)?t._i(t.showLanguages,null)>-1:t.showLanguages},on:{"change":function(n){var e=t.showLanguages,s=n.target,i=!!s.checked;if(Array.isArray(e)){var a=t._i(e,null);s.checked?a<0&&(t.showLanguages=e.concat([null])):a>-1&&(t.showLanguages=e.slice(0,a).concat(e.slice(a+1)))}else t.showLanguages=i}}}),t._v(" "),e("label",{attrs:{"for":"showLanguages"}},[t._v(t._s(t.t("settings","Show Languages")))])]),t._v(" "),e("div",[e("input",{directives:[{name:"model",rawName:"v-model",value:t.showLastLogin,expression:"showLastLogin"}],staticClass:"checkbox",attrs:{"id":"showLastLogin","type":"checkbox"},domProps:{"checked":Array.isArray(t.showLastLogin)?t._i(t.showLastLogin,null)>-1:t.showLastLogin},on:{"change":function(n){var e=t.showLastLogin,s=n.target,i=!!s.checked;if(Array.isArray(e)){var a=t._i(e,null);s.checked?a<0&&(t.showLastLogin=e.concat([null])):a>-1&&(t.showLastLogin=e.slice(0,a).concat(e.slice(a+1)))}else t.showLastLogin=i}}}),t._v(" "),e("label",{attrs:{"for":"showLastLogin"}},[t._v(t._s(t.t("settings","Show last login")))])]),t._v(" "),e("div",[e("input",{directives:[{name:"model",rawName:"v-model",value:t.showUserBackend,expression:"showUserBackend"}],staticClass:"checkbox",attrs:{"id":"showUserBackend","type":"checkbox"},domProps:{"checked":Array.isArray(t.showUserBackend)?t._i(t.showUserBackend,null)>-1:t.showUserBackend},on:{"change":function(n){var e=t.showUserBackend,s=n.target,i=!!s.checked;if(Array.isArray(e)){var a=t._i(e,null);s.checked?a<0&&(t.showUserBackend=e.concat([null])):a>-1&&(t.showUserBackend=e.slice(0,a).concat(e.slice(a+1)))}else t.showUserBackend=i}}}),t._v(" "),e("label",{attrs:{"for":"showUserBackend"}},[t._v(t._s(t.t("settings","Show user backend")))])]),t._v(" "),e("div",[e("input",{directives:[{name:"model",rawName:"v-model",value:t.showStoragePath,expression:"showStoragePath"}],staticClass:"checkbox",attrs:{"id":"showStoragePath","type":"checkbox"},domProps:{"checked":Array.isArray(t.showStoragePath)?t._i(t.showStoragePath,null)>-1:t.showStoragePath},on:{"change":function(n){var e=t.showStoragePath,s=n.target,i=!!s.checked;if(Array.isArray(e)){var a=t._i(e,null);s.checked?a<0&&(t.showStoragePath=e.concat([null])):a>-1&&(t.showStoragePath=e.slice(0,a).concat(e.slice(a+1)))}else t.showStoragePath=i}}}),t._v(" "),e("label",{attrs:{"for":"showStoragePath"}},[t._v(t._s(t.t("settings","Show storage path")))])]),t._v(" "),e("div",[e("input",{directives:[{name:"model",rawName:"v-model",value:t.sendWelcomeMail,expression:"sendWelcomeMail"}],staticClass:"checkbox",attrs:{"id":"sendWelcomeMail","disabled":t.loadingSendMail,"type":"checkbox"},domProps:{"checked":Array.isArray(t.sendWelcomeMail)?t._i(t.sendWelcomeMail,null)>-1:t.sendWelcomeMail},on:{"change":function(n){var e=t.sendWelcomeMail,s=n.target,i=!!s.checked;if(Array.isArray(e)){var a=t._i(e,null);s.checked?a<0&&(t.sendWelcomeMail=e.concat([null])):a>-1&&(t.sendWelcomeMail=e.slice(0,a).concat(e.slice(a+1)))}else t.sendWelcomeMail=i}}}),t._v(" "),e("label",{attrs:{"for":"sendWelcomeMail"}},[t._v(t._s(t.t("settings","Send email to new user")))])])])]},proxy:!0}])},[e("AppNavigationNew",{attrs:{"button-id":"new-user-button","text":t.t("settings","New user"),"button-class":"icon-add"},on:{"click":t.toggleNewUserMenu}})],1),t._v(" "),e("AppContent",[e("UserList",{attrs:{"users":t.users,"show-config":t.showConfig,"selected-group":t.selectedGroupDecoded,"external-actions":t.externalActions},scopedSlots:t._u([{key:"content",fn:function(){},proxy:!0}])})],1)],1)}),[],!1,null,"90cdadc6",null));e.default=bt.exports}}]);
//# sourceMappingURL=vue-settings-users-961f28f8e8f7699aa569.js.map?v=f70b928ff76a08ffc3bd