nextcloud/apps/settings/js/vue-settings-users-45d5c11f...

2 lines
69 KiB
JavaScript

(window.webpackJsonpSettings=window.webpackJsonpSettings||[]).push([[7],{595:function(t,e,n){"use strict";var s=n(72),a=n.n(s),i=n(73),o=n.n(i)()(a.a);o.push([t.i,".cellText{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.icon-more{background-color:var(--color-main-background);border:0}","",{version:3,sources:["webpack://./apps/settings/src/components/UserList/UserRowSimple.vue"],names:[],mappings:"AA6LC,UACC,eAAA,CACA,sBAAA,CACA,kBAAA,CAED,WACC,6CAAA,CACA,QAAA",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:""}]),e.a=o},596:function(t,e,n){"use strict";var s=n(72),a=n.n(s),i=n(73),o=n.n(i)()(a.a);o.push([t.i,".row--menu-opened[data-v-88389386]{z-index:1 !important}.row[data-v-88389386] .multiselect__single{z-index:auto !important}","",{version:3,sources:["webpack://./apps/settings/src/components/UserList/UserRow.vue"],names:[],mappings:"AA+qBA,mCACC,oBAAA,CAED,2CACC,uBAAA",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:""}]),e.a=o},597:function(t,e,n){"use strict";var s=n(72),a=n.n(s),i=n(73),o=n.n(i)()(a.a);o.push([t.i,"\n.modal-wrapper[data-v-c66d1d3c] {\n\tmargin: 2vh 0;\n\talign-items: flex-start;\n}\n.modal__content[data-v-c66d1d3c] {\n\tdisplay: flex;\n\tpadding: 20px;\n\tflex-direction: column;\n\talign-items: center;\n\ttext-align: center;\n\toverflow: auto;\n}\n.modal__item[data-v-c66d1d3c] {\n\tmargin-bottom: 16px;\n\twidth: 100%;\n}\n.modal__item[data-v-c66d1d3c]:not(:focus):not(:active) {\n\tborder-color: var(--color-border-dark);\n}\n.modal__item[data-v-c66d1d3c] .multiselect {\n\twidth: 100%;\n}\n.user-actions[data-v-c66d1d3c] {\n\tmargin-top: 20px;\n}\n.modal__content[data-v-c66d1d3c] .multiselect__single {\n\ttext-align: left;\n\tbox-sizing: border-box;\n}\n.modal__content[data-v-c66d1d3c] .multiselect__content-wrapper {\n\tbox-sizing: border-box;\n}\n.row[data-v-c66d1d3c] .multiselect__single {\n\tz-index: auto !important;\n}\n","",{version:3,sources:["webpack://./apps/settings/src/components/UserList.vue"],names:[],mappings:";AAskBA;CACA,aAAA;CACA,uBAAA;AACA;AACA;CACA,aAAA;CACA,aAAA;CACA,sBAAA;CACA,mBAAA;CACA,kBAAA;CACA,cAAA;AACA;AACA;CACA,mBAAA;CACA,WAAA;AACA;AACA;CACA,sCAAA;AACA;AACA;CACA,WAAA;AACA;AACA;CACA,gBAAA;AACA;AACA;CACA,gBAAA;CACA,sBAAA;AACA;AACA;CACA,sBAAA;AACA;AACA;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<Modal v-if="showConfig.showNewUserForm" @close="closeModal">\n\t\t\t<form id="new-user"\n\t\t\t\t:disabled="loading.all"\n\t\t\t\tclass="modal__content"\n\t\t\t\t@submit.prevent="createUser">\n\t\t\t\t<h2>{{ t(\'settings\',\'New user\') }}</h2>\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\tclass="modal__item"\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<input id="newdisplayname"\n\t\t\t\t\tv-model="newUser.displayName"\n\t\t\t\t\t:placeholder="t(\'settings\', \'Display name\')"\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\tclass="modal__item"\n\t\t\t\t\tname="displayname"\n\t\t\t\t\ttype="text">\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\tclass="modal__item"\n\t\t\t\t\tname="password"\n\t\t\t\t\ttype="password">\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\tclass="modal__item"\n\t\t\t\t\tname="email"\n\t\t\t\t\ttype="email">\n\t\t\t\t<div class="groups modal__item">\n\t\t\t\t\t\x3c!-- hidden input trick for vanilla html5 form validation --\x3e\n\t\t\t\t\t<input v-if="!settings.isAdmin"\n\t\t\t\t\t\tid="newgroups"\n\t\t\t\t\t\t:class="{\'icon-loading-small\': loading.groups}"\n\t\t\t\t\t\t:required="!settings.isAdmin"\n\t\t\t\t\t\t:value="newUser.groups"\n\t\t\t\t\t\ttabindex="-1"\n\t\t\t\t\t\ttype="text">\n\t\t\t\t\t<Multiselect v-model="newUser.groups"\n\t\t\t\t\t\t:close-on-select="false"\n\t\t\t\t\t\t:disabled="loading.groups||loading.all"\n\t\t\t\t\t\t:multiple="true"\n\t\t\t\t\t\t:options="canAddGroups"\n\t\t\t\t\t\t:placeholder="t(\'settings\', \'Add user to group\')"\n\t\t\t\t\t\t:tag-width="60"\n\t\t\t\t\t\t:taggable="true"\n\t\t\t\t\t\tclass="multiselect-vue"\n\t\t\t\t\t\tlabel="name"\n\t\t\t\t\t\ttag-placeholder="create"\n\t\t\t\t\t\ttrack-by="id"\n\t\t\t\t\t\t@tag="createGroup">\n\t\t\t\t\t\t\x3c!-- If user is not admin, he is a subadmin.\n\t\t\t\t\t\t\tSubadmins can\'t create users outside their groups\n\t\t\t\t\t\t\tTherefore, empty select is forbidden --\x3e\n\t\t\t\t\t\t<span slot="noResult">{{ t(\'settings\', \'No results\') }}</span>\n\t\t\t\t\t</Multiselect>\n\t\t\t\t</div>\n\t\t\t\t<div v-if="subAdminsGroups.length>0 && settings.isAdmin"\n\t\t\t\t\tclass="subadmins modal__item">\n\t\t\t\t\t<Multiselect v-model="newUser.subAdminsGroups"\n\t\t\t\t\t\t:close-on-select="false"\n\t\t\t\t\t\t:multiple="true"\n\t\t\t\t\t\t:options="subAdminsGroups"\n\t\t\t\t\t\t:placeholder="t(\'settings\', \'Set user as admin for\')"\n\t\t\t\t\t\t:tag-width="60"\n\t\t\t\t\t\tclass="multiselect-vue"\n\t\t\t\t\t\tlabel="name"\n\t\t\t\t\t\ttrack-by="id">\n\t\t\t\t\t\t<span slot="noResult">{{ t(\'settings\', \'No results\') }}</span>\n\t\t\t\t\t</Multiselect>\n\t\t\t\t</div>\n\t\t\t\t<div class="quota modal__item">\n\t\t\t\t\t<Multiselect v-model="newUser.quota"\n\t\t\t\t\t\t:allow-empty="false"\n\t\t\t\t\t\t:options="quotaOptions"\n\t\t\t\t\t\t:placeholder="t(\'settings\', \'Select user quota\')"\n\t\t\t\t\t\t:taggable="true"\n\t\t\t\t\t\tclass="multiselect-vue"\n\t\t\t\t\t\tlabel="label"\n\t\t\t\t\t\ttrack-by="id"\n\t\t\t\t\t\t@tag="validateQuota" />\n\t\t\t\t</div>\n\t\t\t\t<div v-if="showConfig.showLanguages" class="languages modal__item">\n\t\t\t\t\t<Multiselect v-model="newUser.language"\n\t\t\t\t\t\t:allow-empty="false"\n\t\t\t\t\t\t:options="languages"\n\t\t\t\t\t\t:placeholder="t(\'settings\', \'Default language\')"\n\t\t\t\t\t\tclass="multiselect-vue"\n\t\t\t\t\t\tgroup-label="label"\n\t\t\t\t\t\tgroup-values="languages"\n\t\t\t\t\t\tlabel="name"\n\t\t\t\t\t\ttrack-by="code" />\n\t\t\t\t</div>\n\t\t\t\t<div v-if="showConfig.showStoragePath" class="storageLocation" />\n\t\t\t\t<div v-if="showConfig.showUserBackend" class="userBackend" />\n\t\t\t\t<div v-if="showConfig.showLastLogin" class="lastLogin" />\n\t\t\t\t<div class="user-actions">\n\t\t\t\t\t<button id="newsubmit"\n\t\t\t\t\t\tclass="button primary"\n\t\t\t\t\t\ttype="submit"\n\t\t\t\t\t\tvalue="">\n\t\t\t\t\t\t{{ t(\'settings\', \'Add a new user\') }}\n\t\t\t\t\t</button>\n\t\t\t\t</div>\n\t\t\t</form>\n\t\t</Modal>\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\'\nimport { Modal } from \'@nextcloud/vue\'\n\nimport Multiselect from \'@nextcloud/vue/dist/Components/Multiselect\'\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\tModal,\n\t\tuserRow,\n\t\tMultiselect,\n\t\tInfiniteLoading,\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\tthis.closeModal()\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\tcloseModal() {\n\t\t\tthis.showConfig.showNewUserForm = false\n\t\t},\n\t},\n}\n<\/script>\n<style scoped>\n\t.modal-wrapper {\n\t\tmargin: 2vh 0;\n\t\talign-items: flex-start;\n\t}\n\t.modal__content {\n\t\tdisplay: flex;\n\t\tpadding: 20px;\n\t\tflex-direction: column;\n\t\talign-items: center;\n\t\ttext-align: center;\n\t\toverflow: auto;\n\t}\n\t.modal__item {\n\t\tmargin-bottom: 16px;\n\t\twidth: 100%;\n\t}\n\t.modal__item:not(:focus):not(:active) {\n\t\tborder-color: var(--color-border-dark);\n\t}\n\t.modal__item::v-deep .multiselect {\n\t\twidth: 100%;\n\t}\n\t.user-actions {\n\t\tmargin-top: 20px;\n\t}\n\t.modal__content::v-deep .multiselect__single {\n\t\ttext-align: left;\n\t\tbox-sizing: border-box;\n\t}\n\t.modal__content::v-deep .multiselect__content-wrapper {\n\t\tbox-sizing: border-box;\n\t}\n\t.row::v-deep .multiselect__single {\n\t\tz-index: auto !important;\n\t}\n</style>\n'],sourceRoot:""}]),e.a=o},598:function(t,e,n){"use strict";var s=n(72),a=n.n(s),i=n(73),o=n.n(i)()(a.a);o.push([t.i,".app-navigation__list #addgroup[data-v-3efdbfb3] .app-navigation-entry__utils{display:none}","",{version:3,sources:["webpack://./apps/settings/src/views/Users.vue"],names:[],mappings:"AAwgBA,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\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:""}]),e.a=o},611:function(e,n,s){"use strict";s.r(n);var a=s(454),i=s.n(a),o=s(583),r=s.n(o),l=s(584),d=s.n(l),u=s(590),c=s.n(u),g=s(585),p=s.n(g),h=s(586),m=s.n(h),v=s(591),f=s.n(v),w=s(592),A=s.n(w),b=s(30),_=s.n(b),C=s(587),y=s.n(C),U=s(10),L=s(453),k=s.n(L),G=s(18),x=s(588),S=s.n(x),M=s(160),q=s(593),N=s.n(q),$=s(368),O=s(589),P=s.n(O),D=s(152),Q=s(594),B=s.n(Q),z=s(455),R=s.n(z),F=s(153),I={props:{user:{type:Object,required:!0},settings:{type:Object,default:()=>({})},groups:{type:Array,default:()=>[]},subAdminsGroups:{type:Array,default:()=>[]},quotaOptions:{type:Array,default:()=>[]},showConfig:{type:Object,default:()=>({})},languages:{type:Array,required:!0},externalActions:{type:Array,default:()=>[]}},computed:{userGroups(){return this.groups.filter(t=>this.user.groups.includes(t.id))},userSubAdminsGroups(){return this.subAdminsGroups.filter(t=>this.user.subadmin.includes(t.id))},availableGroups(){return this.groups.map(t=>{const e=Object.assign({},t);return e.$isDisabled=!1===t.canAdd&&!this.user.groups.includes(t.id)||!1===t.canRemove&&this.user.groups.includes(t.id),e})},usedSpace(){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(){let t=this.user.quota.quota;if(t>0)t=Math.min(100,Math.round(this.user.quota.used/t*100));else{t=95*(1-1/(this.user.quota.used/(10*Math.pow(2,30))+1))}return isNaN(t)?0:t},userQuota(){if(this.user.quota.quota>=0){const t=OC.Util.humanFileSize(this.user.quota.quota);return this.quotaOptions.find(e=>e.id===t)||{id:t,label:t}}return"default"===this.user.quota.quota?this.quotaOptions[0]:this.quotaOptions[1]},minPasswordLength(){return this.$store.getters.getPasswordPolicyMinLength},userLanguage(){const t=this.languages[0].languages.concat(this.languages[1].languages).find(t=>t.code===this.user.language);return"object"!=typeof t&&""!==this.user.language?{code:this.user.language,name:this.user.language}:""!==this.user.language&&t},userLastLoginTooltip(){return this.user.lastLogin>0?OC.Util.formatDate(this.user.lastLogin):""},userLastLogin(){return this.user.lastLogin>0?OC.Util.relativeModifiedDate(this.user.lastLogin):t("settings","Never")}},methods:{generateAvatar:(t,e=32)=>Object(U.generateUrl)("/avatar/{user}/{size}?v={version}",{user:t,size:e,version:oc_userconfig.avatar.version})}},j={name:"UserRowSimple",components:{PopoverMenu:B.a,ActionButton:i.a,Actions:R.a},directives:{ClickOutside:P.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(){return this.userGroups.map(t=>t.name).join(", ")},userSubAdminsGroupsLabels(){return this.userSubAdminsGroups.map(t=>t.name).join(", ")},usedSpace(){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(){return Object(F.getCurrentUser)().uid!==this.user.id||this.settings.isAdmin},userQuota(){let e=this.user.quota.quota;return"default"===e&&(e=this.settings.defaultQuota,"none"!==e&&(e=OC.Util.computerFileSize(e))),"none"===e||-3===e?t("settings","Unlimited"):e>=0?OC.Util.humanFileSize(e):OC.Util.humanFileSize(0)}},methods:{hideMenu(){this.$emit("hideMenu")},toggleEdit(){this.$emit("update:editing",!0)}}},E=s(71),T=s.n(E),W=s(595),Y={insert:"head",singleton:!1},H=(T()(W.a,Y),W.a.locals,s(41)),J=Object(H.a)(j,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"row",class:{disabled:t.loading.delete||t.loading.disable},attrs:{"data-id":t.user.id}},[n("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():n("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(" "),n("div",{staticClass:"name"},[t._v("\n\t\t"+t._s(t.user.id)+"\n\t\t"),n("div",{staticClass:"displayName subtitle"},[n("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(" "),n("div"),t._v(" "),n("div",{staticClass:"mailAddress"},[n("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(" "),n("div",{staticClass:"groups"},[t._v("\n\t\t"+t._s(t.userGroupsLabels)+"\n\t")]),t._v(" "),t.subAdminsGroups.length>0&&t.settings.isAdmin?n("div",{staticClass:"subAdminsGroups"},[t._v("\n\t\t"+t._s(t.userSubAdminsGroupsLabels)+"\n\t")]):t._e(),t._v(" "),n("div",{staticClass:"userQuota"},[n("div",{staticClass:"quota"},[t._v("\n\t\t\t"+t._s(t.userQuota)+" ("+t._s(t.usedSpace)+")\n\t\t\t"),n("progress",{staticClass:"quota-user-progress",class:{warn:t.usedQuota>80},attrs:{max:"100"},domProps:{value:t.usedQuota}})])]),t._v(" "),t.showConfig.showLanguages?n("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?n("div",{staticClass:"userBackend"},[t.showConfig.showUserBackend?n("div",{staticClass:"userBackend"},[t._v("\n\t\t\t"+t._s(t.user.backend)+"\n\t\t")]):t._e(),t._v(" "),t.showConfig.showStoragePath?n("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?n("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(" "),n("div",{staticClass:"userActions"},[t.canEdit&&!t.loading.all?n("div",{staticClass:"toggleUserActions"},[n("Actions",[n("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(" "),n("div",{staticClass:"userPopoverMenuWrapper"},[n("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(e){return e.preventDefault(),t.$emit("toggleMenu")}}}),t._v(" "),n("div",{staticClass:"popovermenu",class:{open:t.openedMenu},attrs:{"aria-expanded":t.openedMenu}},[n("PopoverMenu",{attrs:{menu:t.userActions}})],1)])],1):t._e(),t._v(" "),n("div",{staticClass:"feedback",style:{opacity:""!==t.feedbackMessage?1:0}},[n("div",{staticClass:"icon-checkmark"}),t._v("\n\t\t\t"+t._s(t.feedbackMessage)+"\n\t\t")])])])}),[],!1,null,null,null).exports;G.default.use(D.default);var V={name:"UserRow",components:{UserRowSimple:J,PopoverMenu:$.PopoverMenu,Actions:$.Actions,ActionButton:$.ActionButton,Multiselect:$.Multiselect},directives:{ClickOutside:P.a},mixins:[I],props:{user:{type:Object,required:!0},settings:{type:Object,default:()=>({})},groups:{type:Array,default:()=>[]},subAdminsGroups:{type:Array,default:()=>[]},quotaOptions:{type:Array,default:()=>[]},showConfig:{type:Object,default:()=>({})},languages:{type:Array,required:!0},externalActions:{type:Array,default:()=>[]}},data:()=>({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(){const e=[{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&&e.push({icon:"icon-mail",text:t("settings","Resend welcome email"),action:this.sendWelcomeMail}),e.concat(this.externalActions)}},methods:{toggleMenu(){this.openedMenu=!this.openedMenu},hideMenu(){this.openedMenu=!1},wipeUserDevices(){const 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")},t=>{t&&(this.loading.wipe=!0,this.loading.all=!0,this.$store.dispatch("wipeUserDevices",e).then(()=>{this.loading.wipe=!1,this.loading.all=!1}))},!0)},deleteUser(){const 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")},t=>{if(t)return this.loading.delete=!0,this.loading.all=!0,this.$store.dispatch("deleteUser",e).then(()=>{this.loading.delete=!1,this.loading.all=!1})},!0)},enableDisableUser(){this.loading.delete=!0,this.loading.all=!0;const t=this.user.id,e=!this.user.enabled;return this.$store.dispatch("enableDisableUser",{userid:t,enabled:e}).then(()=>{this.loading.delete=!1,this.loading.all=!1})},updateDisplayName(){const t=this.$refs.displayName.value;this.loading.displayName=!0,this.$store.dispatch("setUserData",{userid:this.user.id,key:"displayname",value:t}).then(()=>{this.loading.displayName=!1,this.$refs.displayName.value=t})},updatePassword(){const t=this.$refs.password.value;this.loading.password=!0,this.$store.dispatch("setUserData",{userid:this.user.id,key:"password",value:t}).then(()=>{this.loading.password=!1,this.$refs.password.value=""})},updateEmail(){const t=this.$refs.mailAddress.value;this.loading.mailAddress=!0,this.$store.dispatch("setUserData",{userid:this.user.id,key:"email",value:t}).then(()=>{this.loading.mailAddress=!1,this.$refs.mailAddress.value=t})},async createGroup(t){this.loading={groups:!0,subadmins:!0};try{await this.$store.dispatch("addGroup",t);const e=this.user.id;await this.$store.dispatch("addUserGroup",{userid:e,gid:t})}catch(t){console.error(t)}finally{this.loading={groups:!1,subadmins:!1}}return this.$store.getters.getGroups[this.groups.length]},async addUserGroup(t){if(!1===t.canAdd)return!1;this.loading.groups=!0;const e=this.user.id,n=t.id;try{await this.$store.dispatch("addUserGroup",{userid:e,gid:n})}catch(t){console.error(t)}finally{this.loading.groups=!1}},async removeUserGroup(t){if(!1===t.canRemove)return!1;this.loading.groups=!0;const e=this.user.id,n=t.id;try{await this.$store.dispatch("removeUserGroup",{userid:e,gid:n}),this.loading.groups=!1,this.$route.params.selectedGroup===n&&this.$store.commit("deleteUser",e)}catch{this.loading.groups=!1}},async addUserSubAdmin(t){this.loading.subadmins=!0;const e=this.user.id,n=t.id;try{await this.$store.dispatch("addUserSubAdmin",{userid:e,gid:n}),this.loading.subadmins=!1}catch(t){console.error(t)}},async removeUserSubAdmin(t){this.loading.subadmins=!0;const e=this.user.id,n=t.id;try{await this.$store.dispatch("removeUserSubAdmin",{userid:e,gid:n})}catch(t){console.error(t)}finally{this.loading.subadmins=!1}},async setUserQuota(t="none"){this.loading.quota=!0,t=t.id?t.id:t;try{await this.$store.dispatch("setUserData",{userid:this.user.id,key:"quota",value:t})}catch(t){console.error(t)}finally{this.loading.quota=!1}return t},validateQuota(t){const e=OC.Util.computerFileSize(t);return null!==e&&e>=0&&this.setUserQuota(OC.Util.humanFileSize(OC.Util.computerFileSize(t)))},async setUserLanguage(t){this.loading.languages=!0;try{await this.$store.dispatch("setUserData",{userid:this.user.id,key:"language",value:t.code})}catch(t){console.error(t)}finally{this.loading.languages=!1}return t},sendWelcomeMail(){this.loading.all=!0,this.$store.dispatch("sendWelcomeMail",this.user.id).then(e=>{e&&(this.feedbackMessage=t("setting","Welcome mail sent!"),setTimeout(()=>{this.feedbackMessage=""},2e3)),this.loading.all=!1})}}},Z=s(596),K={insert:"head",singleton:!1},X=(T()(Z.a,K),Z.a.locals,Object(H.a)(V,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return 1===Object.keys(t.user).length?n("div",{staticClass:"row",attrs:{"data-id":t.user.id}},[n("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():n("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(" "),n("div",{staticClass:"name"},[t._v("\n\t\t"+t._s(t.user.id)+"\n\t")]),t._v(" "),n("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?n("div",{staticClass:"row row--editable",class:{disabled:t.loading.delete||t.loading.disable,"row--menu-opened":t.openedMenu},attrs:{"data-id":t.user.id}},[n("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():n("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?n("div",{staticClass:"displayName"},[n("form",{staticClass:"displayName",class:{"icon-loading-small":t.loading.displayName},on:{submit:function(e){return e.preventDefault(),t.updateDisplayName(e)}}},[n("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(" "),n("input",{staticClass:"icon-confirm",attrs:{type:"submit",value:""}})])]):n("div",{staticClass:"name"},[t._v("\n\t\t"+t._s(t.user.id)+"\n\t\t"),n("div",{staticClass:"displayName subtitle"},[n("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?n("form",{staticClass:"password",class:{"icon-loading-small":t.loading.password},on:{submit:function(e){return e.preventDefault(),t.updatePassword(e)}}},[n("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(" "),n("input",{staticClass:"icon-confirm",attrs:{type:"submit",value:""}})]):n("div"),t._v(" "),n("form",{staticClass:"mailAddress",class:{"icon-loading-small":t.loading.mailAddress},on:{submit:function(e){return e.preventDefault(),t.updateEmail(e)}}},[n("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(" "),n("input",{staticClass:"icon-confirm",attrs:{type:"submit",value:""}})]),t._v(" "),n("div",{staticClass:"groups",class:{"icon-loading-small":t.loading.groups}},[n("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 to 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}},[n("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?n("div",{staticClass:"subadmins",class:{"icon-loading-small":t.loading.subadmins}},[n("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}},[n("span",{attrs:{slot:"noResult"},slot:"noResult"},[t._v(t._s(t.t("settings","No results")))])])],1):t._e(),t._v(" "),n("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}},[n("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?n("div",{staticClass:"languages",class:{"icon-loading-small":t.loading.languages}},[n("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?n("div",{staticClass:"storageLocation"}):t._e(),t._v(" "),t.showConfig.showLastLogin?n("div"):t._e(),t._v(" "),n("div",{staticClass:"userActions"},[t.loading.all?t._e():n("div",{staticClass:"toggleUserActions"},[n("Actions",[n("ActionButton",{attrs:{icon:"icon-checkmark"},on:{click:function(e){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(" "),n("div",{directives:[{name:"click-outside",rawName:"v-click-outside",value:t.hideMenu,expression:"hideMenu"}],staticClass:"userPopoverMenuWrapper"},[n("div",{staticClass:"icon-more",on:{click:t.toggleMenu}}),t._v(" "),n("div",{staticClass:"popovermenu",class:{open:t.openedMenu}},[n("PopoverMenu",{attrs:{menu:t.userActions}})],1)])],1),t._v(" "),n("div",{staticClass:"feedback",style:{opacity:""!==t.feedbackMessage?1:0}},[n("div",{staticClass:"icon-checkmark"}),t._v("\n\t\t\t"+t._s(t.feedbackMessage)+"\n\t\t")])])]):n("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(e){t.editing=e},hideMenu:t.hideMenu,toggleMenu:t.toggleMenu}})}),[],!1,null,"88389386",null).exports);const tt={id:"none",label:t("settings","Unlimited")},et={id:"default",label:t("settings","Default quota")},nt={id:"",displayName:"",password:"",mailAddress:"",groups:[],subAdminsGroups:[],quota:et,language:{code:"en",name:t("settings","Default language")}};var st={name:"UserList",components:{Modal:$.Modal,userRow:X,Multiselect:k.a,InfiniteLoading:N.a},props:{users:{type:Array,default:()=>[]},showConfig:{type:Object,required:!0},selectedGroup:{type:String,default:null},externalActions:{type:Array,default:()=>[]}},data:()=>({unlimitedQuota:tt,defaultQuota:et,loading:{all:!1,groups:!1},scrolled:!1,searchQuery:"",newUser:Object.assign({},nt)}),computed:{settings(){return this.$store.getters.getServerData},selectedGroupDecoded(){return decodeURIComponent(this.selectedGroup)},filteredUsers(){return"disabled"===this.selectedGroup?this.users.filter(t=>!1===t.enabled):(this.settings.isAdmin,this.users.filter(t=>!1!==t.enabled))},groups(){return this.$store.getters.getGroups.filter(t=>"disabled"!==t.id).sort((t,e)=>t.name.localeCompare(e.name))},canAddGroups(){return this.groups.map(t=>((t=Object.assign({},t)).$isDisabled=!1===t.canAdd,t))},subAdminsGroups(){return this.$store.getters.getSubadminGroups},quotaOptions(){const t=this.settings.quotaPreset.reduce((t,e)=>t.concat({id:e,label:e}),[]);return t.unshift(this.unlimitedQuota),t.unshift(this.defaultQuota),t},minPasswordLength(){return this.$store.getters.getPasswordPolicyMinLength},usersOffset(){return this.$store.getters.getUsersOffset},usersLimit(){return this.$store.getters.getUsersLimit},usersCount(){return this.users.length},languages(){return[{label:t("settings","Common languages"),languages:this.settings.languages.commonlanguages},{label:t("settings","All languages"),languages:this.settings.languages.languages}]}},watch:{selectedGroup(t,e){this.redirectIfDisabled(),this.$store.commit("resetUsers"),this.$refs.infiniteLoading.stateChanger.reset(),this.setNewUserDefaultGroup(t)},usersCount(t,e){0===t&&1===e?this.$refs.infiniteLoading.stateChanger.reset():1===t&&0===e&&this.$refs.infiniteLoading.stateChanger.loaded()}},mounted(){this.settings.canChangePassword||OC.Notification.showTemporary(t("settings","Password change is disabled because the master key is disabled")),this.resetForm(),Object(M.subscribe)("nextcloud:unified-search.search",this.search),Object(M.subscribe)("nextcloud:unified-search.reset",this.resetSearch),this.redirectIfDisabled()},beforeDestroy(){Object(M.unsubscribe)("nextcloud:unified-search.search",this.search),Object(M.unsubscribe)("nextcloud:unified-search.reset",this.resetSearch)},methods:{onScroll(t){this.scrolled=t.target.scrollTo>0},validateQuota(t){const e=OC.Util.computerFileSize(t);return null!==e&&e>=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(t){this.$store.dispatch("getUsers",{offset:this.usersOffset,limit:this.usersLimit,group:"disabled"!==this.selectedGroup?this.selectedGroup:"",search:this.searchQuery}).then(e=>{e?t.loaded():t.complete()})},search({query:t}){this.searchQuery=t,this.$store.commit("resetUsers"),this.$refs.infiniteLoading.stateChanger.reset()},resetSearch(){this.search({query:""})},resetForm(){this.newUser=Object.assign({},nt),this.settings.defaultLanguage&&G.default.set(this.newUser.language,"code",this.settings.defaultLanguage),this.setNewUserDefaultGroup(this.selectedGroup),this.loading.all=!1},createUser(){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(t=>t.id),subadmin:this.newUser.subAdminsGroups.map(t=>t.id),quota:this.newUser.quota.id,language:this.newUser.language.code}).then(()=>{this.resetForm(),this.$refs.newusername.focus(),this.closeModal()}).catch(t=>{if(this.loading.all=!1,t.response&&t.response.data&&t.response.data.ocs&&t.response.data.ocs.meta){const e=t.response.data.ocs.meta.statuscode;102===e?this.$refs.newusername.focus():107===e&&this.$refs.newuserpassword.focus()}})},setNewUserDefaultGroup(t){if(t&&t.length>0){const e=this.groups.find(e=>e.id===t);if(e)return void(this.newUser.groups=[e])}this.newUser.groups=[]},createGroup(t){return this.loading.groups=!0,this.$store.dispatch("addGroup",t).then(e=>{this.newUser.groups.push(this.groups.find(e=>e.id===t)),this.loading.groups=!1}).catch(()=>{this.loading.groups=!1}),this.$store.getters.getGroups[this.groups.length]},redirectIfDisabled(){const t=this.$store.getters.getGroups;"disabled"===this.selectedGroup&&t.findIndex(t=>"disabled"===t.id&&0===t.usercount)>-1&&(this.$router.push({name:"users"}),this.$refs.infiniteLoading.stateChanger.reset())},closeModal(){this.showConfig.showNewUserForm=!1}}},at=s(597),it={insert:"head",singleton:!1},ot=(T()(at.a,it),at.a.locals,Object(H.a)(st,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"user-list-grid",attrs:{id:"app-content"},on:{"&scroll":function(e){return t.onScroll(e)}}},[t.showConfig.showNewUserForm?n("Modal",{on:{close:t.closeModal}},[n("form",{staticClass:"modal__content",attrs:{id:"new-user",disabled:t.loading.all},on:{submit:function(e){return e.preventDefault(),t.createUser(e)}}},[n("h2",[t._v(t._s(t.t("settings","New user")))]),t._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:t.newUser.id,expression:"newUser.id"}],ref:"newusername",staticClass:"modal__item",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(e){e.target.composing||t.$set(t.newUser,"id",e.target.value)}}}),t._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:t.newUser.displayName,expression:"newUser.displayName"}],staticClass:"modal__item",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(e){e.target.composing||t.$set(t.newUser,"displayName",e.target.value)}}}),t._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:t.newUser.password,expression:"newUser.password"}],ref:"newuserpassword",staticClass:"modal__item",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(e){e.target.composing||t.$set(t.newUser,"password",e.target.value)}}}),t._v(" "),n("input",{directives:[{name:"model",rawName:"v-model",value:t.newUser.mailAddress,expression:"newUser.mailAddress"}],staticClass:"modal__item",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(e){e.target.composing||t.$set(t.newUser,"mailAddress",e.target.value)}}}),t._v(" "),n("div",{staticClass:"groups modal__item"},[t.settings.isAdmin?t._e():n("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(" "),n("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 to 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(e){t.$set(t.newUser,"groups",e)},expression:"newUser.groups"}},[n("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?n("div",{staticClass:"subadmins modal__item"},[n("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(e){t.$set(t.newUser,"subAdminsGroups",e)},expression:"newUser.subAdminsGroups"}},[n("span",{attrs:{slot:"noResult"},slot:"noResult"},[t._v(t._s(t.t("settings","No results")))])])],1):t._e(),t._v(" "),n("div",{staticClass:"quota modal__item"},[n("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(e){t.$set(t.newUser,"quota",e)},expression:"newUser.quota"}})],1),t._v(" "),t.showConfig.showLanguages?n("div",{staticClass:"languages modal__item"},[n("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(e){t.$set(t.newUser,"language",e)},expression:"newUser.language"}})],1):t._e(),t._v(" "),t.showConfig.showStoragePath?n("div",{staticClass:"storageLocation"}):t._e(),t._v(" "),t.showConfig.showUserBackend?n("div",{staticClass:"userBackend"}):t._e(),t._v(" "),t.showConfig.showLastLogin?n("div",{staticClass:"lastLogin"}):t._e(),t._v(" "),n("div",{staticClass:"user-actions"},[n("button",{staticClass:"button primary",attrs:{id:"newsubmit",type:"submit",value:""}},[t._v("\n\t\t\t\t\t"+t._s(t.t("settings","Add a new user"))+"\n\t\t\t\t")])])])]):t._e(),t._v(" "),n("div",{staticClass:"row",class:{sticky:t.scrolled&&!t.showConfig.showNewUserForm},attrs:{id:"grid-header"}},[n("div",{staticClass:"avatar",attrs:{id:"headerAvatar"}}),t._v(" "),n("div",{staticClass:"name",attrs:{id:"headerName"}},[t._v("\n\t\t\t"+t._s(t.t("settings","Username"))+"\n\n\t\t\t"),n("div",{staticClass:"subtitle"},[t._v("\n\t\t\t\t"+t._s(t.t("settings","Display name"))+"\n\t\t\t")])]),t._v(" "),n("div",{staticClass:"password",attrs:{id:"headerPassword"}},[t._v("\n\t\t\t"+t._s(t.t("settings","Password"))+"\n\t\t")]),t._v(" "),n("div",{staticClass:"mailAddress",attrs:{id:"headerAddress"}},[t._v("\n\t\t\t"+t._s(t.t("settings","Email"))+"\n\t\t")]),t._v(" "),n("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?n("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(" "),n("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?n("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?n("div",{staticClass:"headerUserBackend userBackend"},[t.showConfig.showUserBackend?n("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?n("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?n("div",{staticClass:"headerLastLogin lastLogin"},[t._v("\n\t\t\t"+t._s(t.t("settings","Last login"))+"\n\t\t")]):t._e(),t._v(" "),n("div",{staticClass:"userActions"})]),t._v(" "),t._l(t.filteredUsers,(function(e){return n("user-row",{key:e.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:e}})})),t._v(" "),n("InfiniteLoading",{ref:"infiniteLoading",on:{infinite:t.infiniteHandler}},[n("div",{attrs:{slot:"spinner"},slot:"spinner"},[n("div",{staticClass:"users-icon-loading icon-loading"})]),t._v(" "),n("div",{attrs:{slot:"no-more"},slot:"no-more"},[n("div",{staticClass:"users-list-end"})]),t._v(" "),n("div",{attrs:{slot:"no-results"},slot:"no-results"},[n("div",{attrs:{id:"emptycontent"}},[n("div",{staticClass:"icon-contacts-dark"}),t._v(" "),n("h2",[t._v(t._s(t.t("settings","No users in here")))])])])])],2)}),[],!1,null,"c66d1d3c",null).exports);G.default.use(S.a);var rt={name:"Users",components:{ActionButton:i.a,AppContent:r.a,AppNavigation:d.a,AppNavigationCaption:c.a,AppNavigationCounter:p.a,AppNavigationItem:m.a,AppNavigationNew:f.a,AppNavigationSettings:A.a,Content:y.a,Multiselect:k.a,UserList:ot},props:{selectedGroup:{type:String,default:null}},data:()=>({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(){return this.selectedGroup?decodeURIComponent(this.selectedGroup):null},users(){return this.$store.getters.getUsers},groups(){return this.$store.getters.getGroups},usersOffset(){return this.$store.getters.getUsersOffset},usersLimit(){return this.$store.getters.getUsersLimit},showLanguages:{get(){return this.getLocalstorage("showLanguages")},set(t){this.setLocalStorage("showLanguages",t)}},showLastLogin:{get(){return this.getLocalstorage("showLastLogin")},set(t){this.setLocalStorage("showLastLogin",t)}},showUserBackend:{get(){return this.getLocalstorage("showUserBackend")},set(t){this.setLocalStorage("showUserBackend",t)}},showStoragePath:{get(){return this.getLocalstorage("showStoragePath")},set(t){this.setLocalStorage("showStoragePath",t)}},userCount(){return this.$store.getters.getUserCount},settings(){return this.$store.getters.getServerData},quotaOptions(){const t=this.settings.quotaPreset.reduce((t,e)=>t.concat({id:e,label:e}),[]);return t.unshift(this.unlimitedQuota),t},defaultQuota:{get(){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(t){this.selectedQuota=t}},sendWelcomeMail:{get(){return this.settings.newUserSendEmail},async set(t){try{this.loadingSendMail=!0,this.$store.commit("setServerData",{...this.settings,newUserSendEmail:t}),await _.a.post(Object(U.generateUrl)("/settings/users/preferences/newUser.sendEmail"),{value:t?"yes":"no"})}catch(t){console.error("could not update newUser.sendEmail preference: "+t.message,t)}finally{this.loadingSendMail=!1}}},groupList(){return(Array.isArray(this.groups)?this.groups:[]).filter(t=>"disabled"!==t.id&&"admin"!==t.id).map(t=>this.formatGroupMenu(t))},adminGroupMenu(){return this.formatGroupMenu(this.groups.find(t=>"admin"===t.id))},disabledGroupMenu(){return this.formatGroupMenu(this.groups.find(t=>"disabled"===t.id))}},beforeMount(){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(){Object.assign(OCA,{Settings:{UserList:{registerAction:this.registerAction}}})},methods:{showNewUserMenu(){this.showConfig.showNewUserForm=!0,this.showConfig.showNewUserForm&&G.default.nextTick(()=>{window.newusername.focus()})},getLocalstorage(t){const e=this.$localStorage.get(t);return this.showConfig[t]=null!==e?"true"===e:this.showConfig[t],this.showConfig[t]},setLocalStorage(t,e){return this.showConfig[t]=e,this.$localStorage.set(t,e),e},removeGroup(e){const n=this;OC.dialogs.confirm(t("settings","You are about to remove the group {group}. The users will NOT be deleted.",{group:e}),t("settings","Please confirm the group removal "),(function(t){t&&n.$store.dispatch("removeGroup",e)}))},setDefaultQuota(t="none"){this.$store.dispatch("setAppConfig",{app:"files",key:"default_quota",value:t.id?t.id:t}).then(()=>{"object"!=typeof t&&(t={id:t,label:t}),this.defaultQuota=t})},validateQuota(t){return null===OC.Util.computerFileSize(t)?this.setDefaultQuota("none"):this.setDefaultQuota(OC.Util.humanFileSize(OC.Util.computerFileSize(t)))},registerAction(t,e,n){return this.externalActions.push({icon:t,text:e,action:n}),this.externalActions},async createGroup(t){if(""!==t.trim())try{this.loadingAddGroup=!0,await this.$store.dispatch("addGroup",t.trim()),this.toggleAddGroupEntry(!1),this.$router.push({name:"group",params:{selectedGroup:encodeURIComponent(t.trim())}})}catch{this.toggleAddGroupEntry(!0)}finally{this.loadingAddGroup=!1}else G.default.nextTick(()=>{this.toggleAddGroupEntry(!0)})},toggleAddGroupEntry(t){void 0===t&&(t=!this.$refs.addGroup.editing),this.$refs.addGroup.editing=t,G.default.nextTick(()=>{if(this.$refs.addGroup.$el){const t=this.$refs.addGroup.$el.querySelector('form > input[type="text"]');t&&t.focus()}})},formatGroupMenu(t){const e={};return void 0===t?{}:(e.id=t.id,e.title=t.name,e.usercount=t.usercount,t.usercount-t.disabled>0&&(e.count=t.usercount-t.disabled),e)}}},lt=s(598),dt={insert:"head",singleton:!1},ut=(T()(lt.a,dt),lt.a.locals,Object(H.a)(rt,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("Content",{attrs:{"app-name":"settings","navigation-class":{"icon-loading":t.loadingAddGroup}}},[n("AppNavigation",{scopedSlots:t._u([{key:"list",fn:function(){return[n("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(e){return t.toggleAddGroupEntry(!0)},"update:title":t.createGroup}}),t._v(" "),n("AppNavigationItem",{attrs:{id:"everyone",exact:!0,title:t.t("settings","Everyone"),to:{name:"users"},icon:"icon-contacts-dark"}},[t.userCount>0?n("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?n("AppNavigationItem",{attrs:{id:"admin",exact:!0,title:t.t("settings","Admins"),to:{name:"group",params:{selectedGroup:"admin"}},icon:"icon-user-admin"}},[t.adminGroupMenu.count?n("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?n("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?n("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?n("AppNavigationCaption",{attrs:{title:t.t("settings","Groups")}}):t._e(),t._v(" "),t._l(t.groupList,(function(e){return n("AppNavigationItem",{key:e.id,attrs:{exact:!0,title:e.title,to:{name:"group",params:{selectedGroup:encodeURIComponent(e.id)}}}},[e.count?n("AppNavigationCounter",{attrs:{slot:"counter"},slot:"counter"},[t._v("\n\t\t\t\t\t"+t._s(e.count)+"\n\t\t\t\t")]):t._e(),t._v(" "),n("template",{slot:"actions"},["admin"!==e.id&&"disabled"!==e.id&&t.settings.isAdmin?n("ActionButton",{attrs:{icon:"icon-delete"},on:{click:function(n){return t.removeGroup(e.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[n("AppNavigationSettings",[n("div",[n("p",[t._v(t._s(t.t("settings","Default quota:")))]),t._v(" "),n("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(" "),n("div",[n("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(e){var n=t.showLanguages,s=e.target,a=!!s.checked;if(Array.isArray(n)){var i=t._i(n,null);s.checked?i<0&&(t.showLanguages=n.concat([null])):i>-1&&(t.showLanguages=n.slice(0,i).concat(n.slice(i+1)))}else t.showLanguages=a}}}),t._v(" "),n("label",{attrs:{for:"showLanguages"}},[t._v(t._s(t.t("settings","Show Languages")))])]),t._v(" "),n("div",[n("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(e){var n=t.showLastLogin,s=e.target,a=!!s.checked;if(Array.isArray(n)){var i=t._i(n,null);s.checked?i<0&&(t.showLastLogin=n.concat([null])):i>-1&&(t.showLastLogin=n.slice(0,i).concat(n.slice(i+1)))}else t.showLastLogin=a}}}),t._v(" "),n("label",{attrs:{for:"showLastLogin"}},[t._v(t._s(t.t("settings","Show last login")))])]),t._v(" "),n("div",[n("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(e){var n=t.showUserBackend,s=e.target,a=!!s.checked;if(Array.isArray(n)){var i=t._i(n,null);s.checked?i<0&&(t.showUserBackend=n.concat([null])):i>-1&&(t.showUserBackend=n.slice(0,i).concat(n.slice(i+1)))}else t.showUserBackend=a}}}),t._v(" "),n("label",{attrs:{for:"showUserBackend"}},[t._v(t._s(t.t("settings","Show user backend")))])]),t._v(" "),n("div",[n("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(e){var n=t.showStoragePath,s=e.target,a=!!s.checked;if(Array.isArray(n)){var i=t._i(n,null);s.checked?i<0&&(t.showStoragePath=n.concat([null])):i>-1&&(t.showStoragePath=n.slice(0,i).concat(n.slice(i+1)))}else t.showStoragePath=a}}}),t._v(" "),n("label",{attrs:{for:"showStoragePath"}},[t._v(t._s(t.t("settings","Show storage path")))])]),t._v(" "),n("div",[n("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(e){var n=t.sendWelcomeMail,s=e.target,a=!!s.checked;if(Array.isArray(n)){var i=t._i(n,null);s.checked?i<0&&(t.sendWelcomeMail=n.concat([null])):i>-1&&(t.sendWelcomeMail=n.slice(0,i).concat(n.slice(i+1)))}else t.sendWelcomeMail=a}}}),t._v(" "),n("label",{attrs:{for:"sendWelcomeMail"}},[t._v(t._s(t.t("settings","Send email to new user")))])])])]},proxy:!0}])},[n("AppNavigationNew",{attrs:{"button-id":"new-user-button",text:t.t("settings","New user"),"button-class":"icon-add"},on:{click:t.showNewUserMenu,keyup:[function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.showNewUserMenu(e)},function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"space",32,e.key,[" ","Spacebar"])?null:t.showNewUserMenu(e)}]}})],1),t._v(" "),n("AppContent",[n("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,"3efdbfb3",null));n.default=ut.exports}}]);
//# sourceMappingURL=vue-settings-users-45d5c11f3582984952c5.js.map?v=7bcd48b5806aa860eb33