You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nextcloud/dist/settings-users-8351.js

3 lines
70 KiB
JavaScript

/*! For license information please see settings-users-8351.js.LICENSE.txt */
"use strict";(self.webpackChunknextcloud=self.webpackChunknextcloud||[]).push([[8351],{81996:(t,e,s)=>{s.d(e,{Z:()=>r});var n=s(87537),i=s.n(n),a=s(23645),o=s.n(a)()(i());o.push([t.id,".row--menu-opened[data-v-7f74bef3]{z-index:1 !important}.row[data-v-7f74bef3] .multiselect__single{z-index:auto !important}","",{version:3,sources:["webpack://./apps/settings/src/components/UserList/UserRow.vue"],names:[],mappings:"AAEA,mCACC,oBAAA,CAED,2CACC,uBAAA",sourcesContent:["\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:""}]);const r=o},13935:(t,e,s)=>{s.d(e,{Z:()=>r});var n=s(87537),i=s.n(n),a=s(23645),o=s.n(a)()(i());o.push([t.id,".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:"AACC,UACC,eAAA,CACA,sBAAA,CACA,kBAAA,CAED,WACC,6CAAA,CACA,QAAA",sourcesContent:["\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:""}]);const r=o},40551:(t,e,s)=>{s.d(e,{Z:()=>r});var n=s(87537),i=s.n(n),a=s(23645),o=s.n(a)()(i());o.push([t.id,".app-navigation__list #addgroup[data-v-76897a76] .app-navigation-entry__utils{display:none}","",{version:3,sources:["webpack://./apps/settings/src/views/Users.vue"],names:[],mappings:"AAEA,8EACC,YAAA",sourcesContent:["\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:""}]);const r=o},48646:(t,e,s)=>{s.d(e,{Z:()=>r});var n=s(87537),i=s.n(n),a=s(23645),o=s.n(a)()(i());o.push([t.id,'\n.modal-wrapper[data-v-f686373c] {\n\tmargin: 2vh 0;\n\talign-items: flex-start;\n}\n.modal__content[data-v-f686373c] {\n\tdisplay: flex;\n\tpadding: 20px;\n\tflex-direction: column;\n\talign-items: center;\n\ttext-align: center;\n}\n.modal__item[data-v-f686373c] {\n\tmargin-bottom: 16px;\n\twidth: 100%;\n}\n.modal__item[data-v-f686373c]:not(:focus):not(:active) {\n\tborder-color: var(--color-border-dark);\n}\n.modal__item[data-v-f686373c] .multiselect {\n\twidth: 100%;\n}\n.user-actions[data-v-f686373c] {\n\tmargin-top: 20px;\n}\n.modal__content[data-v-f686373c] .multiselect__single {\n\ttext-align: left;\n\tbox-sizing: border-box;\n}\n.modal__content[data-v-f686373c] .multiselect__content-wrapper {\n\tbox-sizing: border-box;\n}\n.row[data-v-f686373c] .multiselect__single {\n\tz-index: auto !important;\n}\n\n/* fake input for groups validation */\ninput#newgroups[data-v-f686373c] {\n\tposition: absolute;\n\topacity: 0;\n\t/* The "hidden" input is behind the Multiselect, so in general it does\n\t * not receives clicks. However, with Firefox, after the validation\n\t * fails, it will receive the first click done on it, so its width needs\n\t * to be set to 0 to prevent that ("pointer-events: none" does not\n\t * prevent it). */\n\twidth: 0;\n}\n',"",{version:3,sources:["webpack://./apps/settings/src/components/UserList.vue"],names:[],mappings:";AAsoBA;CACA,aAAA;CACA,uBAAA;AACA;AACA;CACA,aAAA;CACA,aAAA;CACA,sBAAA;CACA,mBAAA;CACA,kBAAA;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;;AAEA,qCAAA;AACA;CACA,kBAAA;CACA,UAAA;CACA;;;;kBAIA;CACA,QAAA;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<NcModal v-if="showConfig.showNewUserForm" size="small" @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:maxlength="469"\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<NcMultiselect 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</NcMultiselect>\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<NcMultiselect 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</NcMultiselect>\n\t\t\t\t</div>\n\t\t\t\t<div class="quota modal__item">\n\t\t\t\t\t<NcMultiselect 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<NcMultiselect 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<NcButton id="newsubmit"\n\t\t\t\t\t\ttype="primary"\n\t\t\t\t\t\tnative-type="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</NcButton>\n\t\t\t\t</div>\n\t\t\t</form>\n\t\t</NcModal>\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<div class="subtitle">\n\t\t\t\t\t<strong>\n\t\t\t\t\t\t{{ t(\'settings\', \'Display name\') }}\n\t\t\t\t\t</strong>\n\t\t\t\t</div>\n\t\t\t\t{{ t(\'settings\', \'Username\') }}\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\t:is-dark-theme="isDarkTheme" />\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 NcModal from \'@nextcloud/vue/dist/Components/NcModal.js\'\nimport NcButton from \'@nextcloud/vue/dist/Components/NcButton.js\'\nimport NcMultiselect from \'@nextcloud/vue/dist/Components/NcMultiselect.js\'\n\nimport userRow from \'./UserList/UserRow.vue\'\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\tNcModal,\n\t\tuserRow,\n\t\tNcMultiselect,\n\t\tInfiniteLoading,\n\t\tNcButton,\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\tif (this.settings.allowUnlimitedQuota) {\n\t\t\t\tquotaPreset.unshift(this.unlimitedQuota)\n\t\t\t}\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\', \'Other languages\'),\n\t\t\t\t\tlanguages: this.settings.languages.otherLanguages,\n\t\t\t\t},\n\t\t\t]\n\t\t},\n\t\tisDarkTheme() {\n\t\t\treturn window.getComputedStyle(this.$el)\n\t\t\t\t.getPropertyValue(\'--background-invert-if-dark\') === \'invert(100%)\'\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 * @return {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((usersCount) => {\n\t\t\t\t\tif (usersCount > 0) {\n\t\t\t\t\t\t$state.loaded()\n\t\t\t\t\t}\n\t\t\t\t\tif (usersCount < this.usersLimit) {\n\t\t\t\t\t\t$state.complete()\n\t\t\t\t\t}\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 * @return {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\t// eslint-disable-next-line vue/no-mutating-props\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}\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\n\t/* fake input for groups validation */\n\tinput#newgroups {\n\t\tposition: absolute;\n\t\topacity: 0;\n\t\t/* The "hidden" input is behind the Multiselect, so in general it does\n\t\t * not receives clicks. However, with Firefox, after the validation\n\t\t * fails, it will receive the first click done on it, so its width needs\n\t\t * to be set to 0 to prevent that ("pointer-events: none" does not\n\t\t * prevent it). */\n\t\twidth: 0;\n\t}\n</style>\n'],sourceRoot:""}]);const r=o},4734:(e,s,n)=>{n.r(s),n.d(s,{default:()=>St});var i=n(69680),a=n.n(i),o=n(55209),r=n.n(o),l=n(88696),u=n.n(l),d=n(53110),c=n.n(d),g=n(14032),p=n.n(g),h=n(73190),m=n.n(h),v=n(93041),f=n.n(v),w=n(4820),A=n(27472),b=n.n(A),C=n(79753),_=n(98266),y=n.n(_),U=n(20144),k=n(87369),N=n.n(k),L=n(79570),G=n.n(L),x=n(45400),S=n.n(x),M=n(97039),q=n.n(M);const $={name:"GroupListItem",components:{NcActionInput:G(),NcActionButton:S(),NcCounterBubble:q(),NcAppNavigationItem:p()},props:{id:{type:String,required:!0},title:{type:String,required:!0},count:{type:Number,required:!1}},data:()=>({loadingRenameGroup:!1,openGroupMenu:!1}),computed:{settings(){return this.$store.getters.getServerData}},methods:{handleGroupMenuOpen(){this.openGroupMenu=!0},async renameGroup(t){if(""===t.trim())return;const e=this.$refs.displayNameInput.$el.querySelector('input[type="text"]').value;if(""!==e.trim())try{this.openGroupMenu=!1,this.loadingRenameGroup=!0,await this.$store.dispatch("renameGroup",{groupid:t.trim(),displayName:e.trim()}),this.loadingRenameGroup=!1}catch{this.openGroupMenu=!0,this.loadingRenameGroup=!1}},removeGroup(e){const s=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&&s.$store.dispatch("removeGroup",e)}))}}};var O=n(51900);const P=(0,O.Z)($,(function(){var t=this,e=t._self._c;return e("NcAppNavigationItem",{key:t.id,attrs:{exact:!0,title:t.title,to:{name:"group",params:{selectedGroup:encodeURIComponent(t.id)}},icon:"icon-group",loading:t.loadingRenameGroup,"menu-open":t.openGroupMenu},on:{"update:menuOpen":t.handleGroupMenuOpen},scopedSlots:t._u([{key:"counter",fn:function(){return[t.count?e("NcCounterBubble",[t._v("\n\t\t\t"+t._s(t.count)+"\n\t\t")]):t._e()]},proxy:!0},{key:"actions",fn:function(){return["admin"!==t.id&&"disabled"!==t.id&&t.settings.isAdmin?e("NcActionInput",{ref:"displayNameInput",attrs:{icon:"icon-edit",type:"text",value:t.title},on:{submit:function(e){return t.renameGroup(t.id)}}},[t._v("\n\t\t\t"+t._s(t.t("settings","Rename group"))+"\n\t\t")]):t._e(),t._v(" "),"admin"!==t.id&&"disabled"!==t.id&&t.settings.isAdmin?e("NcActionButton",{attrs:{icon:"icon-delete"},on:{click:function(e){return t.removeGroup(t.id)}}},[t._v("\n\t\t\t"+t._s(t.t("settings","Remove group"))+"\n\t\t")]):t._e()]},proxy:!0}])})}),[],!1,null,null,null).exports;var D=n(78595),B=n(30306),Q=n.n(B),z=n(70110),I=n.n(z),T=n(10861),R=n.n(T),F=n(2649),E=n.n(F),j=n(15961),W=n(32996),Z=n.n(W),H=n(12945),Y=n.n(H),V=n(45994);const J={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;return t=t>0?Math.min(100,Math.round(this.user.quota.used/t*100)):95*(1-1/(this.user.quota.used/(10*Math.pow(2,30))+1)),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)=>e?(0,C.generateUrl)("/avatar/{user}/64/dark?v={version}",{user:t,version:oc_userconfig.avatar.version}):(0,C.generateUrl)("/avatar/{user}/64?v={version}",{user:t,version:oc_userconfig.avatar.version})}},K={name:"UserRowSimple",components:{NcPopoverMenu:Z(),NcActionButton:S(),NcActions:Y()},directives:{ClickOutside:E()},mixins:[J],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},isDarkTheme:{type:Boolean,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(0,V.ts)().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:{toggleMenu(){this.$emit("update:openedMenu",!this.openedMenu)},hideMenu(){this.$emit("update:openedMenu",!1)},toggleEdit(){this.$emit("update:editing",!0)}}};var X=n(93379),tt=n.n(X),et=n(7795),st=n.n(et),nt=n(90569),it=n.n(nt),at=n(3565),ot=n.n(at),rt=n(19216),lt=n.n(rt),ut=n(44589),dt=n.n(ut),ct=n(13935),gt={};gt.styleTagTransform=dt(),gt.setAttributes=ot(),gt.insert=it().bind(null,"head"),gt.domAPI=st(),gt.insertStyleElement=lt(),tt()(ct.Z,gt),ct.Z&&ct.Z.locals&&ct.Z.locals;const pt=(0,O.Z)(K,(function(){var t=this,e=t._self._c;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,t.isDarkTheme)}})]),t._v(" "),e("div",{staticClass:"name"},[e("div",{staticClass:"displayName subtitle"},[e("div",{staticClass:"cellText",attrs:{title:t.user.displayname.length>20?t.user.displayname:""}},[e("strong",[t._v("\n\t\t\t\t\t"+t._s(t.user.displayname)+"\n\t\t\t\t")])])]),t._v("\n\t\t"+t._s(t.user.id)+"\n\t")]),t._v(" "),e("div"),t._v(" "),e("div",{staticClass:"mailAddress"},[e("div",{staticClass:"cellText",attrs:{title:null!==t.user.email&&t.user.email.length>20?t.user.email:""}},[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",{staticClass:"storageLocation subtitle",attrs:{title:t.user.storageLocation}},[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",{staticClass:"lastLogin",attrs:{title:t.userLastLoginTooltip}},[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("NcActions",[e("NcActionButton",{attrs:{icon:"icon-rename",title:t.t("settings","Edit User"),"aria-label":t.t("settings","Edit User")},on:{click:t.toggleEdit}})],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(e){return e.preventDefault(),t.toggleMenu.apply(null,arguments)}}}),t._v(" "),e("div",{staticClass:"popovermenu",class:{open:t.openedMenu},attrs:{"aria-expanded":t.openedMenu}},[e("NcPopoverMenu",{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;var ht=n(25108);const mt={name:"UserRow",components:{UserRowSimple:pt,NcPopoverMenu:j.Rs,NcActions:j.O3,NcActionButton:j.Js,NcMultiselect:j.Z2},directives:{ClickOutside:E()},mixins:[J],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:()=>[]},isDarkTheme:{type:Boolean,required:!0}},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){ht.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,s=t.id;try{await this.$store.dispatch("addUserGroup",{userid:e,gid:s})}catch(t){ht.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,s=t.id;try{await this.$store.dispatch("removeUserGroup",{userid:e,gid:s}),this.loading.groups=!1,this.$route.params.selectedGroup===s&&this.$store.commit("deleteUser",e)}catch{this.loading.groups=!1}},async addUserSubAdmin(t){this.loading.subadmins=!0;const e=this.user.id,s=t.id;try{await this.$store.dispatch("addUserSubAdmin",{userid:e,gid:s}),this.loading.subadmins=!1}catch(t){ht.error(t)}},async removeUserSubAdmin(t){this.loading.subadmins=!0;const e=this.user.id,s=t.id;try{await this.$store.dispatch("removeUserSubAdmin",{userid:e,gid:s})}catch(t){ht.error(t)}finally{this.loading.subadmins=!1}},async setUserQuota(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"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){ht.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){ht.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}))}}};var vt=n(81996),ft={};ft.styleTagTransform=dt(),ft.setAttributes=ot(),ft.insert=it().bind(null,"head"),ft.domAPI=st(),ft.insertStyleElement=lt(),tt()(vt.Z,ft),vt.Z&&vt.Z.locals&&vt.Z.locals;const wt=(0,O.Z)(mt,(function(){var t=this,e=t._self._c;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,t.isDarkTheme),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,t.isDarkTheme),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(e){return e.preventDefault(),t.updateDisplayName.apply(null,arguments)}}},[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",{staticClass:"cellText",attrs:{title:t.user.displayname.length>20?t.user.displayname:""}},[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(e){return e.preventDefault(),t.updatePassword.apply(null,arguments)}}},[e("input",{ref:"password",attrs:{id:"password"+t.user.id+t.rand,disabled:t.loading.password||t.loading.all,minlength:t.minPasswordLength,maxlength:"469",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(e){return e.preventDefault(),t.updateEmail.apply(null,arguments)}}},[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("NcMultiselect",{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}},[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("NcMultiselect",{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",{staticClass:"quota",class:{"icon-loading-small":t.loading.quota},attrs:{title:t.usedSpace}},[e("NcMultiselect",{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("NcMultiselect",{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("NcActions",[e("NcActionButton",{attrs:{icon:"icon-checkmark",title:t.t("settings","Done"),"aria-label":t.t("settings","Done")},on:{click:function(e){t.editing=!1}}})],1),t._v(" "),e("div",{directives:[{name:"click-outside",rawName:"v-click-outside",value:t.hideMenu,expression:"hideMenu"}],staticClass:"userPopoverMenuWrapper"},[e("button",{staticClass:"icon-more",on:{click:function(e){return e.preventDefault(),t.toggleMenu.apply(null,arguments)}}}),t._v(" "),e("div",{staticClass:"popovermenu",class:{open:t.openedMenu}},[e("NcPopoverMenu",{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,"is-dark-theme":t.isDarkTheme},on:{"update:editing":function(e){t.editing=e},"update:openedMenu":function(e){t.openedMenu=e},"update:opened-menu":function(e){t.openedMenu=e}}})}),[],!1,null,"7f74bef3",null).exports,At={id:"none",label:t("settings","Unlimited")},bt={id:"default",label:t("settings","Default quota")},Ct={id:"",displayName:"",password:"",mailAddress:"",groups:[],subAdminsGroups:[],quota:bt,language:{code:"en",name:t("settings","Default language")}},_t={name:"UserList",components:{NcModal:I(),userRow:wt,NcMultiselect:y(),InfiniteLoading:Q(),NcButton:R()},props:{users:{type:Array,default:()=>[]},showConfig:{type:Object,required:!0},selectedGroup:{type:String,default:null},externalActions:{type:Array,default:()=>[]}},data:()=>({unlimitedQuota:At,defaultQuota:bt,loading:{all:!1,groups:!1},scrolled:!1,searchQuery:"",newUser:Object.assign({},Ct)}),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 this.settings.allowUnlimitedQuota&&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","Other languages"),languages:this.settings.languages.otherLanguages}]},isDarkTheme(){return"invert(100%)"===window.getComputedStyle(this.$el).getPropertyValue("--background-invert-if-dark")}},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(),(0,D.Ld)("nextcloud:unified-search.search",this.search),(0,D.Ld)("nextcloud:unified-search.reset",this.resetSearch),this.redirectIfDisabled()},beforeDestroy(){(0,D.r1)("nextcloud:unified-search.search",this.search),(0,D.r1)("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>0&&t.loaded(),e<this.usersLimit&&t.complete()}))},search(t){let{query:e}=t;this.searchQuery=e,this.$store.commit("resetUsers"),this.$refs.infiniteLoading.stateChanger.reset()},resetSearch(){this.search({query:""})},resetForm(){this.newUser=Object.assign({},Ct),this.settings.defaultLanguage&&U.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}}};var yt=n(48646),Ut={};Ut.styleTagTransform=dt(),Ut.setAttributes=ot(),Ut.insert=it().bind(null,"head"),Ut.domAPI=st(),Ut.insertStyleElement=lt(),tt()(yt.Z,Ut),yt.Z&&yt.Z.locals&&yt.Z.locals;const kt=(0,O.Z)(_t,(function(){var t=this,e=t._self._c;return e("div",{staticClass:"user-list-grid",attrs:{id:"app-content"},on:{"&scroll":function(e){return t.onScroll.apply(null,arguments)}}},[t.showConfig.showNewUserForm?e("NcModal",{attrs:{size:"small"},on:{close:t.closeModal}},[e("form",{staticClass:"modal__content",attrs:{id:"new-user",disabled:t.loading.all},on:{submit:function(e){return e.preventDefault(),t.createUser.apply(null,arguments)}}},[e("h2",[t._v(t._s(t.t("settings","New user")))]),t._v(" "),e("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(" "),e("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(" "),e("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,maxlength:469,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(" "),e("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(" "),e("div",{staticClass:"groups modal__item"},[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("NcMultiselect",{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"}},[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 modal__item"},[e("NcMultiselect",{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"}},[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 modal__item"},[e("NcMultiselect",{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?e("div",{staticClass:"languages modal__item"},[e("NcMultiselect",{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?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:"user-actions"},[e("NcButton",{attrs:{id:"newsubmit",type:"primary","native-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")])],1)])]):t._e(),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"}},[e("div",{staticClass:"subtitle"},[e("strong",[t._v("\n\t\t\t\t\t"+t._s(t.t("settings","Display name"))+"\n\t\t\t\t")])]),t._v("\n\t\t\t"+t._s(t.t("settings","Username"))+"\n\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(s){return e("user-row",{key:s.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:s,"is-dark-theme":t.isDarkTheme}})})),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,"f686373c",null).exports;var Nt=n(25108);U.default.use(N());const Lt={name:"Users",components:{NcAppContent:a(),NcAppNavigation:r(),NcAppNavigationCaption:u(),NcAppNavigationCounter:c(),NcAppNavigationItem:p(),NcAppNavigationNew:m(),NcAppNavigationSettings:f(),NcContent:b(),GroupListItem:P,NcMultiselect:y(),UserList:kt},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 this.settings.allowUnlimitedQuota&&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 w.default.post((0,C.generateUrl)("/settings/users/preferences/newUser.sendEmail"),{value:t?"yes":"no"})}catch(t){Nt.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&&U.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},setDefaultQuota(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"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,s){return this.externalActions.push({icon:t,text:e,action:s}),this.externalActions},async createGroup(t){if(""!==t.trim())try{this.loadingAddGroup=!0,await this.$store.dispatch("addGroup",t.trim()),this.hideAddGroupForm(),await this.$router.push({name:"group",params:{selectedGroup:encodeURIComponent(t.trim())}})}catch{this.showAddGroupForm()}finally{this.loadingAddGroup=!1}},showAddGroupForm(){this.$refs.addGroup.editingActive=!0,this.$refs.addGroup.onMenuToggle(!1),this.$nextTick((()=>{this.$refs.addGroup.$refs.editingInput.focusInput()}))},hideAddGroupForm(){this.$refs.addGroup.editingActive=!1,this.$refs.addGroup.editingValue=""},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)}}};var Gt=n(40551),xt={};xt.styleTagTransform=dt(),xt.setAttributes=ot(),xt.insert=it().bind(null,"head"),xt.domAPI=st(),xt.insertStyleElement=lt(),tt()(Gt.Z,xt),Gt.Z&&Gt.Z.locals&&Gt.Z.locals;const St=(0,O.Z)(Lt,(function(){var t=this,e=t._self._c;return e("NcContent",{attrs:{"app-name":"settings","navigation-class":{"icon-loading":t.loadingAddGroup}}},[e("NcAppNavigation",{scopedSlots:t._u([{key:"list",fn:function(){return[e("NcAppNavigationItem",{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:t.showAddGroupForm,"update:title":t.createGroup}}),t._v(" "),e("NcAppNavigationItem",{attrs:{id:"everyone",exact:!0,title:t.t("settings","Active users"),to:{name:"users"},icon:"icon-contacts-dark"}},[t.userCount>0?e("NcAppNavigationCounter",{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("NcAppNavigationItem",{attrs:{id:"admin",exact:!0,title:t.t("settings","Admins"),to:{name:"group",params:{selectedGroup:"admin"}},icon:"icon-user-admin"}},[t.adminGroupMenu.count?e("NcAppNavigationCounter",{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("NcAppNavigationItem",{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("NcAppNavigationCounter",{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("NcAppNavigationCaption",{attrs:{title:t.t("settings","Groups")}}):t._e(),t._v(" "),t._l(t.groupList,(function(t){return e("GroupListItem",{key:t.id,attrs:{id:t.id,title:t.title,count:t.count}})}))]},proxy:!0},{key:"footer",fn:function(){return[e("NcAppNavigationSettings",[e("div",[e("p",[t._v(t._s(t.t("settings","Default quota:")))]),t._v(" "),e("NcMultiselect",{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(e){var s=t.showLanguages,n=e.target,i=!!n.checked;if(Array.isArray(s)){var a=t._i(s,null);n.checked?a<0&&(t.showLanguages=s.concat([null])):a>-1&&(t.showLanguages=s.slice(0,a).concat(s.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(e){var s=t.showLastLogin,n=e.target,i=!!n.checked;if(Array.isArray(s)){var a=t._i(s,null);n.checked?a<0&&(t.showLastLogin=s.concat([null])):a>-1&&(t.showLastLogin=s.slice(0,a).concat(s.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(e){var s=t.showUserBackend,n=e.target,i=!!n.checked;if(Array.isArray(s)){var a=t._i(s,null);n.checked?a<0&&(t.showUserBackend=s.concat([null])):a>-1&&(t.showUserBackend=s.slice(0,a).concat(s.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(e){var s=t.showStoragePath,n=e.target,i=!!n.checked;if(Array.isArray(s)){var a=t._i(s,null);n.checked?a<0&&(t.showStoragePath=s.concat([null])):a>-1&&(t.showStoragePath=s.slice(0,a).concat(s.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(e){var s=t.sendWelcomeMail,n=e.target,i=!!n.checked;if(Array.isArray(s)){var a=t._i(s,null);n.checked?a<0&&(t.sendWelcomeMail=s.concat([null])):a>-1&&(t.sendWelcomeMail=s.slice(0,a).concat(s.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("NcAppNavigationNew",{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.apply(null,arguments)},function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"space",32,e.key,[" ","Spacebar"])?null:t.showNewUserMenu.apply(null,arguments)}]}})],1),t._v(" "),e("NcAppContent",[e("UserList",{attrs:{users:t.users,"show-config":t.showConfig,"selected-group":t.selectedGroupDecoded,"external-actions":t.externalActions}})],1)],1)}),[],!1,null,"76897a76",null).exports}}]);
//# sourceMappingURL=settings-users-8351.js.map?v=e0183ad061f4e6ac717e