settings-users-8351.js 54 KB

123
  1. /*! For license information please see settings-users-8351.js.LICENSE.txt */
  2. "use strict";(self.webpackChunknextcloud=self.webpackChunknextcloud||[]).push([[8351],{21849:(e,t,s)=>{s.d(t,{Z:()=>o});var a=s(87537),i=s.n(a),n=s(23645),r=s.n(n)()(i());r.push([e.id,".modal-wrapper[data-v-228801f0]{margin:2vh 0;align-items:flex-start}.modal__content[data-v-228801f0]{display:flex;padding:20px;flex-direction:column;align-items:center;text-align:center}.modal__item[data-v-228801f0]{margin-bottom:16px;width:100%}.modal__item[data-v-228801f0]:not(:focus):not(:active){border-color:var(--color-border-dark)}.modal__item[data-v-228801f0] .multiselect{width:100%}.user-actions[data-v-228801f0]{margin-top:20px}.modal__content[data-v-228801f0] .multiselect__single{text-align:left;box-sizing:border-box}.modal__content[data-v-228801f0] .multiselect__content-wrapper{box-sizing:border-box}.row[data-v-228801f0] .multiselect__single{z-index:auto !important}input#newgroups[data-v-228801f0]{position:absolute;opacity:0;width:0}","",{version:3,sources:["webpack://./apps/settings/src/components/UserList.vue"],names:[],mappings:"AACA,gCACC,YAAA,CACA,sBAAA,CAED,iCACC,YAAA,CACA,YAAA,CACA,qBAAA,CACA,kBAAA,CACA,iBAAA,CAED,8BACC,kBAAA,CACA,UAAA,CAED,uDACC,qCAAA,CAED,2CACC,UAAA,CAED,+BACC,eAAA,CAED,sDACC,eAAA,CACA,qBAAA,CAED,+DACC,qBAAA,CAED,2CACC,uBAAA,CAID,iCACC,iBAAA,CACA,SAAA,CAMA,OAAA",sourcesContent:['\n.modal-wrapper {\n\tmargin: 2vh 0;\n\talign-items: flex-start;\n}\n.modal__content {\n\tdisplay: flex;\n\tpadding: 20px;\n\tflex-direction: column;\n\talign-items: center;\n\ttext-align: center;\n}\n.modal__item {\n\tmargin-bottom: 16px;\n\twidth: 100%;\n}\n.modal__item:not(:focus):not(:active) {\n\tborder-color: var(--color-border-dark);\n}\n.modal__item::v-deep .multiselect {\n\twidth: 100%;\n}\n.user-actions {\n\tmargin-top: 20px;\n}\n.modal__content::v-deep .multiselect__single {\n\ttext-align: left;\n\tbox-sizing: border-box;\n}\n.modal__content::v-deep .multiselect__content-wrapper {\n\tbox-sizing: border-box;\n}\n.row::v-deep .multiselect__single {\n\tz-index: auto !important;\n}\n\n/* fake input for groups validation */\ninput#newgroups {\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'],sourceRoot:""}]);const o=r},66638:(e,t,s)=>{s.d(t,{Z:()=>o});var a=s(87537),i=s.n(a),n=s(23645),r=s.n(n)()(i());r.push([e.id,".row--menu-opened[data-v-0912dcf4]{z-index:1 !important}.row[data-v-0912dcf4] .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 o=r},11582:(e,t,s)=>{s.d(t,{Z:()=>o});var a=s(87537),i=s.n(a),n=s(23645),r=s.n(n)()(i());r.push([e.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 o=r},69049:(e,t,s)=>{s.d(t,{Z:()=>o});var a=s(87537),i=s.n(a),n=s(23645),r=s.n(n)()(i());r.push([e.id,".app-navigation__list #addgroup[data-v-c70f3f58] .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 o=r},48753:(e,s,a)=>{a.r(s),a.d(s,{default:()=>qe});var i=a(69680),n=a.n(i),r=a(55209),o=a.n(r),l=a(88696),d=a.n(l),u=a(53110),c=a.n(u),g=a(14032),p=a.n(g),h=a(73190),m=a.n(h),v=a(44439),w=a.n(v),f=a(93041),_=a.n(f),A=a(4820),b=a(27472),C=a.n(b),y=a(79753),U=a(98266),k=a.n(U),N=a(20144),M=a(87369),L=a.n(M),G=a(79570),S=a.n(G),x=a(45400),$=a.n(x),q=a(97039),D=a.n(q);const O={name:"GroupListItem",components:{NcActionInput:S(),NcActionButton:$(),NcCounterBubble:D(),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(e){if(""===e.trim())return;const t=this.$refs.displayNameInput.$el.querySelector('input[type="text"]').value;if(""!==t.trim())try{this.openGroupMenu=!1,this.loadingRenameGroup=!0,await this.$store.dispatch("renameGroup",{groupid:e.trim(),displayName:t.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 P=a(51900);const B=(0,P.Z)(O,(function(){var e=this,t=e._self._c;return t("NcAppNavigationItem",{key:e.id,attrs:{exact:!0,title:e.title,to:{name:"group",params:{selectedGroup:encodeURIComponent(e.id)}},icon:"icon-group",loading:e.loadingRenameGroup,"menu-open":e.openGroupMenu},on:{"update:menuOpen":e.handleGroupMenuOpen},scopedSlots:e._u([{key:"counter",fn:function(){return[e.count?t("NcCounterBubble",[e._v("\n\t\t\t"+e._s(e.count)+"\n\t\t")]):e._e()]},proxy:!0},{key:"actions",fn:function(){return["admin"!==e.id&&"disabled"!==e.id&&e.settings.isAdmin?t("NcActionInput",{ref:"displayNameInput",attrs:{icon:"icon-edit",type:"text",value:e.title},on:{submit:function(t){return e.renameGroup(e.id)}}},[e._v("\n\t\t\t"+e._s(e.t("settings","Rename group"))+"\n\t\t")]):e._e(),e._v(" "),"admin"!==e.id&&"disabled"!==e.id&&e.settings.isAdmin?t("NcActionButton",{attrs:{icon:"icon-delete"},on:{click:function(t){return e.removeGroup(e.id)}}},[e._v("\n\t\t\t"+e._s(e.t("settings","Remove group"))+"\n\t\t")]):e._e()]},proxy:!0}])})}),[],!1,null,null,null).exports;var Q=a(69183),z=a(30306),I=a.n(z),R=a(70110),E=a.n(R),T=a(10861),F=a.n(T),Z=a(2649),j=a.n(Z),W=a(15961),Y=a(32996),H=a.n(Y),V=a(12945),J=a.n(V),K=a(77958);const X={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((e=>this.user.groups.includes(e.id)))},userSubAdminsGroups(){return this.subAdminsGroups.filter((e=>this.user.subadmin.includes(e.id)))},availableGroups(){return this.groups.map((e=>{const t=Object.assign({},e);return t.$isDisabled=!1===e.canAdd&&!this.user.groups.includes(e.id)||!1===e.canRemove&&this.user.groups.includes(e.id),t}))},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 e=this.user.quota.quota;return e=e>0?Math.min(100,Math.round(this.user.quota.used/e*100)):95*(1-1/(this.user.quota.used/(10*Math.pow(2,30))+1)),isNaN(e)?0:e},userQuota(){if(this.user.quota.quota>=0){const e=OC.Util.humanFileSize(this.user.quota.quota);return this.quotaOptions.find((t=>t.id===e))||{id:e,label:e}}return"default"===this.user.quota.quota?this.quotaOptions[0]:this.quotaOptions[1]},minPasswordLength(){return this.$store.getters.getPasswordPolicyMinLength},userLanguage(){const e=this.languages[0].languages.concat(this.languages[1].languages).find((e=>e.code===this.user.language));return"object"!=typeof e&&""!==this.user.language?{code:this.user.language,name:this.user.language}:""!==this.user.language&&e},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:(e,t)=>t?(0,y.generateUrl)("/avatar/{user}/64/dark?v={version}",{user:e,version:oc_userconfig.avatar.version}):(0,y.generateUrl)("/avatar/{user}/64?v={version}",{user:e,version:oc_userconfig.avatar.version})}},ee={name:"UserRowSimple",components:{NcPopoverMenu:H(),NcActionButton:$(),NcActions:J()},directives:{ClickOutside:j()},mixins:[X],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((e=>e.name)).join(", ")},userSubAdminsGroupsLabels(){return this.userSubAdminsGroups.map((e=>e.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,K.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 te=a(93379),se=a.n(te),ae=a(7795),ie=a.n(ae),ne=a(90569),re=a.n(ne),oe=a(3565),le=a.n(oe),de=a(19216),ue=a.n(de),ce=a(44589),ge=a.n(ce),pe=a(11582),he={};he.styleTagTransform=ge(),he.setAttributes=le(),he.insert=re().bind(null,"head"),he.domAPI=ie(),he.insertStyleElement=ue(),se()(pe.Z,he),pe.Z&&pe.Z.locals&&pe.Z.locals;const me=(0,P.Z)(ee,(function(){var e=this,t=e._self._c;return t("div",{staticClass:"row",class:{disabled:e.loading.delete||e.loading.disable},attrs:{"data-id":e.user.id}},[t("div",{staticClass:"avatar",class:{"icon-loading-small":e.loading.delete||e.loading.disable||e.loading.wipe}},[e.loading.delete||e.loading.disable||e.loading.wipe?e._e():t("img",{attrs:{alt:"",width:"32",height:"32",src:e.generateAvatar(e.user.id,e.isDarkTheme)}})]),e._v(" "),t("div",{staticClass:"name"},[t("div",{staticClass:"displayName subtitle"},[t("div",{staticClass:"cellText",attrs:{title:e.user.displayname.length>20?e.user.displayname:""}},[t("strong",[e._v("\n\t\t\t\t\t"+e._s(e.user.displayname)+"\n\t\t\t\t")])])]),e._v("\n\t\t"+e._s(e.user.id)+"\n\t")]),e._v(" "),t("div"),e._v(" "),t("div",{staticClass:"mailAddress"},[t("div",{staticClass:"cellText",attrs:{title:null!==e.user.email&&e.user.email.length>20?e.user.email:""}},[e._v("\n\t\t\t"+e._s(e.user.email)+"\n\t\t")])]),e._v(" "),t("div",{staticClass:"groups"},[e._v("\n\t\t"+e._s(e.userGroupsLabels)+"\n\t")]),e._v(" "),e.subAdminsGroups.length>0&&e.settings.isAdmin?t("div",{staticClass:"subAdminsGroups"},[e._v("\n\t\t"+e._s(e.userSubAdminsGroupsLabels)+"\n\t")]):e._e(),e._v(" "),t("div",{staticClass:"userQuota"},[t("div",{staticClass:"quota"},[e._v("\n\t\t\t"+e._s(e.userQuota)+" ("+e._s(e.usedSpace)+")\n\t\t\t"),t("progress",{staticClass:"quota-user-progress",class:{warn:e.usedQuota>80},attrs:{max:"100"},domProps:{value:e.usedQuota}})])]),e._v(" "),e.showConfig.showLanguages?t("div",{staticClass:"languages"},[e._v("\n\t\t"+e._s(e.userLanguage.name)+"\n\t")]):e._e(),e._v(" "),e.showConfig.showUserBackend||e.showConfig.showStoragePath?t("div",{staticClass:"userBackend"},[e.showConfig.showUserBackend?t("div",{staticClass:"userBackend"},[e._v("\n\t\t\t"+e._s(e.user.backend)+"\n\t\t")]):e._e(),e._v(" "),e.showConfig.showStoragePath?t("div",{staticClass:"storageLocation subtitle",attrs:{title:e.user.storageLocation}},[e._v("\n\t\t\t"+e._s(e.user.storageLocation)+"\n\t\t")]):e._e()]):e._e(),e._v(" "),e.showConfig.showLastLogin?t("div",{staticClass:"lastLogin",attrs:{title:e.userLastLoginTooltip}},[e._v("\n\t\t"+e._s(e.userLastLogin)+"\n\t")]):e._e(),e._v(" "),t("div",{staticClass:"managers"},[e._v("\n\t\t"+e._s(e.user.manager)+"\n\t")]),e._v(" "),t("div",{staticClass:"userActions"},[e.canEdit&&!e.loading.all?t("div",{staticClass:"toggleUserActions"},[t("NcActions",[t("NcActionButton",{attrs:{icon:"icon-rename",title:e.t("settings","Edit User"),"aria-label":e.t("settings","Edit User")},on:{click:e.toggleEdit}})],1),e._v(" "),t("div",{staticClass:"userPopoverMenuWrapper"},[t("button",{directives:[{name:"click-outside",rawName:"v-click-outside",value:e.hideMenu,expression:"hideMenu"}],staticClass:"icon-more",attrs:{"aria-expanded":e.openedMenu,"aria-label":e.t("settings","Toggle user actions menu")},on:{click:function(t){return t.preventDefault(),e.toggleMenu.apply(null,arguments)}}}),e._v(" "),t("div",{staticClass:"popovermenu",class:{open:e.openedMenu}},[t("NcPopoverMenu",{attrs:{menu:e.userActions}})],1)])],1):e._e(),e._v(" "),t("div",{staticClass:"feedback",style:{opacity:""!==e.feedbackMessage?1:0}},[t("div",{staticClass:"icon-checkmark"}),e._v("\n\t\t\t"+e._s(e.feedbackMessage)+"\n\t\t")])])])}),[],!1,null,null,null).exports;var ve=a(25108);const we={name:"UserRow",components:{UserRowSimple:me,NcPopoverMenu:W.Rs,NcActions:W.O3,NcActionButton:W.Js,NcMultiselect:W.Z2},directives:{ClickOutside:j()},mixins:[X],props:{users:{type:Array,required:!0},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:"",loadingPossibleManagers:!1,possibleManagers:[],currentManager:"",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,manager:!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)}},async beforeMount(){this.user.manager&&await this.initManager(this.user.manager)},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)},filterManagers(e){return e.filter((e=>e.id!==this.user.id))},async initManager(e){await this.$store.dispatch("getUser",e).then((e=>{this.currentManager=null==e?void 0:e.data.ocs.data}))},async searchInitialUserManager(){this.loadingPossibleManagers=!0,await this.searchUserManager(),this.loadingPossibleManagers=!1},async searchUserManager(e){await this.$store.dispatch("searchUsers",{offset:0,limit:10,search:e}).then((e=>{const t=null!=e&&e.data?this.filterManagers(Object.values(null==e?void 0:e.data.ocs.data.users)):[];t.length>0&&(this.possibleManagers=t)}))},updateUserManager(e){this.loading.manager=!0,this.$store.dispatch("setUserData",{userid:this.user.id,key:"manager",value:this.currentManager?this.currentManager.id:""}).then((()=>{this.loading.manager=!1}))},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 e=this.user.id,t=!this.user.enabled;return this.$store.dispatch("enableDisableUser",{userid:e,enabled:t}).then((()=>{this.loading.delete=!1,this.loading.all=!1}))},updateDisplayName(){const e=this.$refs.displayName.value;this.loading.displayName=!0,this.$store.dispatch("setUserData",{userid:this.user.id,key:"displayname",value:e}).then((()=>{this.loading.displayName=!1,this.$refs.displayName.value=e}))},updatePassword(){const e=this.$refs.password.value;this.loading.password=!0,this.$store.dispatch("setUserData",{userid:this.user.id,key:"password",value:e}).then((()=>{this.loading.password=!1,this.$refs.password.value=""}))},updateEmail(){const e=this.$refs.mailAddress.value;this.loading.mailAddress=!0,this.$store.dispatch("setUserData",{userid:this.user.id,key:"email",value:e}).then((()=>{this.loading.mailAddress=!1,this.$refs.mailAddress.value=e}))},async createGroup(e){this.loading={groups:!0,subadmins:!0};try{await this.$store.dispatch("addGroup",e);const t=this.user.id;await this.$store.dispatch("addUserGroup",{userid:t,gid:e})}catch(e){ve.error(e)}finally{this.loading={groups:!1,subadmins:!1}}return this.$store.getters.getGroups[this.groups.length]},async addUserGroup(e){if(!1===e.canAdd)return!1;this.loading.groups=!0;const t=this.user.id,s=e.id;try{await this.$store.dispatch("addUserGroup",{userid:t,gid:s})}catch(e){ve.error(e)}finally{this.loading.groups=!1}},async removeUserGroup(e){if(!1===e.canRemove)return!1;this.loading.groups=!0;const t=this.user.id,s=e.id;try{await this.$store.dispatch("removeUserGroup",{userid:t,gid:s}),this.loading.groups=!1,this.$route.params.selectedGroup===s&&this.$store.commit("deleteUser",t)}catch{this.loading.groups=!1}},async addUserSubAdmin(e){this.loading.subadmins=!0;const t=this.user.id,s=e.id;try{await this.$store.dispatch("addUserSubAdmin",{userid:t,gid:s}),this.loading.subadmins=!1}catch(e){ve.error(e)}},async removeUserSubAdmin(e){this.loading.subadmins=!0;const t=this.user.id,s=e.id;try{await this.$store.dispatch("removeUserSubAdmin",{userid:t,gid:s})}catch(e){ve.error(e)}finally{this.loading.subadmins=!1}},async setUserQuota(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"none";this.loading.quota=!0,e=e.id?e.id:e;try{await this.$store.dispatch("setUserData",{userid:this.user.id,key:"quota",value:e})}catch(e){ve.error(e)}finally{this.loading.quota=!1}return e},validateQuota(e){const t=OC.Util.computerFileSize(e);return null!==t&&t>=0&&this.setUserQuota(OC.Util.humanFileSize(OC.Util.computerFileSize(e)))},async setUserLanguage(e){this.loading.languages=!0;try{await this.$store.dispatch("setUserData",{userid:this.user.id,key:"language",value:e.code})}catch(e){ve.error(e)}finally{this.loading.languages=!1}return e},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 fe=a(66638),_e={};_e.styleTagTransform=ge(),_e.setAttributes=le(),_e.insert=re().bind(null,"head"),_e.domAPI=ie(),_e.insertStyleElement=ue(),se()(fe.Z,_e),fe.Z&&fe.Z.locals&&fe.Z.locals;const Ae=(0,P.Z)(we,(function(){var e=this,t=e._self._c;return 1===Object.keys(e.user).length?t("div",{staticClass:"row",attrs:{"data-id":e.user.id}},[t("div",{staticClass:"avatar",class:{"icon-loading-small":e.loading.delete||e.loading.disable||e.loading.wipe}},[e.loading.delete||e.loading.disable||e.loading.wipe?e._e():t("img",{attrs:{src:e.generateAvatar(e.user.id,e.isDarkTheme),alt:"",height:"32",width:"32"}})]),e._v(" "),t("div",{staticClass:"name"},[e._v("\n\t\t"+e._s(e.user.id)+"\n\t")]),e._v(" "),t("div",{staticClass:"obfuscated"},[e._v("\n\t\t"+e._s(e.t("settings","You do not have permissions to see the details of this user"))+"\n\t")])]):e.editing?t("div",{staticClass:"row row--editable",class:{disabled:e.loading.delete||e.loading.disable,"row--menu-opened":e.openedMenu},attrs:{"data-id":e.user.id}},[t("div",{staticClass:"avatar",class:{"icon-loading-small":e.loading.delete||e.loading.disable||e.loading.wipe}},[e.loading.delete||e.loading.disable||e.loading.wipe?e._e():t("img",{attrs:{src:e.generateAvatar(e.user.id,e.isDarkTheme),alt:"",height:"32",width:"32"}})]),e._v(" "),e.user.backendCapabilities.setDisplayName?t("div",{staticClass:"displayName"},[t("form",{staticClass:"displayName",class:{"icon-loading-small":e.loading.displayName},on:{submit:function(t){return t.preventDefault(),e.updateDisplayName.apply(null,arguments)}}},[t("label",{staticClass:"hidden-visually",attrs:{for:"displayName"+e.user.id+e.rand}},[e._v(e._s(e.t("settings","Edit display name")))]),e._v(" "),t("input",{ref:"displayName",attrs:{id:"displayName"+e.user.id+e.rand,disabled:e.loading.displayName||e.loading.all,autocapitalize:"off",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text"},domProps:{value:e.user.displayname}}),e._v(" "),t("input",{staticClass:"icon-confirm",attrs:{type:"submit",value:""}})])]):t("div",{staticClass:"name"},[e._v("\n\t\t"+e._s(e.user.id)+"\n\t\t"),t("div",{staticClass:"displayName subtitle"},[t("div",{staticClass:"cellText",attrs:{title:e.user.displayname.length>20?e.user.displayname:""}},[e._v("\n\t\t\t\t"+e._s(e.user.displayname)+"\n\t\t\t")])])]),e._v(" "),e.settings.canChangePassword&&e.user.backendCapabilities.setPassword?t("form",{staticClass:"password",class:{"icon-loading-small":e.loading.password},on:{submit:function(t){return t.preventDefault(),e.updatePassword.apply(null,arguments)}}},[t("label",{staticClass:"hidden-visually",attrs:{for:"password"+e.user.id+e.rand}},[e._v(e._s(e.t("settings","Add new password")))]),e._v(" "),t("input",{ref:"password",attrs:{id:"password"+e.user.id+e.rand,disabled:e.loading.password||e.loading.all,minlength:e.minPasswordLength,maxlength:"469",placeholder:e.t("settings","Add new password"),autocapitalize:"off",autocomplete:"new-password",autocorrect:"off",required:"",spellcheck:"false",type:"password",value:""}}),e._v(" "),t("input",{staticClass:"icon-confirm",attrs:{type:"submit",value:""}})]):t("div"),e._v(" "),t("form",{staticClass:"mailAddress",class:{"icon-loading-small":e.loading.mailAddress},on:{submit:function(t){return t.preventDefault(),e.updateEmail.apply(null,arguments)}}},[t("label",{staticClass:"hidden-visually",attrs:{for:"mailAddress"+e.user.id+e.rand}},[e._v(e._s(e.t("settings","Add new email address")))]),e._v(" "),t("input",{ref:"mailAddress",attrs:{id:"mailAddress"+e.user.id+e.rand,disabled:e.loading.mailAddress||e.loading.all,placeholder:e.t("settings","Add new email address"),autocapitalize:"off",autocomplete:"new-password",autocorrect:"off",spellcheck:"false",type:"email"},domProps:{value:e.user.email}}),e._v(" "),t("input",{staticClass:"icon-confirm",attrs:{type:"submit",value:""}})]),e._v(" "),t("div",{staticClass:"groups",class:{"icon-loading-small":e.loading.groups}},[t("label",{staticClass:"hidden-visually",attrs:{for:"groups"+e.user.id+e.rand}},[e._v(e._s(e.t("settings","Add user to group")))]),e._v(" "),t("NcMultiselect",{staticClass:"multiselect-vue",attrs:{id:"groups"+e.user.id+e.rand,"close-on-select":!1,disabled:e.loading.groups||e.loading.all,limit:2,multiple:!0,options:e.availableGroups,placeholder:e.t("settings","Add user to group"),"tag-width":60,taggable:e.settings.isAdmin,value:e.userGroups,label:"name","tag-placeholder":"create","track-by":"id"},on:{remove:e.removeUserGroup,select:e.addUserGroup,tag:e.createGroup}},[t("span",{attrs:{slot:"noResult"},slot:"noResult"},[e._v(e._s(e.t("settings","No results")))])])],1),e._v(" "),e.subAdminsGroups.length>0&&e.settings.isAdmin?t("div",{staticClass:"subadmins",class:{"icon-loading-small":e.loading.subadmins}},[t("label",{staticClass:"hidden-visually",attrs:{for:"subadmins"+e.user.id+e.rand}},[e._v(e._s(e.t("settings","Set user as admin for")))]),e._v(" "),t("NcMultiselect",{staticClass:"multiselect-vue",attrs:{id:"subadmins"+e.user.id+e.rand,"close-on-select":!1,disabled:e.loading.subadmins||e.loading.all,limit:2,multiple:!0,options:e.subAdminsGroups,placeholder:e.t("settings","Set user as admin for"),"tag-width":60,value:e.userSubAdminsGroups,label:"name","track-by":"id"},on:{remove:e.removeUserSubAdmin,select:e.addUserSubAdmin}},[t("span",{attrs:{slot:"noResult"},slot:"noResult"},[e._v(e._s(e.t("settings","No results")))])])],1):e._e(),e._v(" "),t("div",{staticClass:"quota",class:{"icon-loading-small":e.loading.quota},attrs:{title:e.usedSpace}},[t("label",{staticClass:"hidden-visually",attrs:{for:"quota"+e.user.id+e.rand}},[e._v(e._s(e.t("settings","Select user quota")))]),e._v(" "),t("NcMultiselect",{staticClass:"multiselect-vue",attrs:{id:"quota"+e.user.id+e.rand,"allow-empty":!1,disabled:e.loading.quota||e.loading.all,options:e.quotaOptions,placeholder:e.t("settings","Select user quota"),taggable:!0,value:e.userQuota,label:"label","tag-placeholder":"create","track-by":"id"},on:{input:e.setUserQuota,tag:e.validateQuota}})],1),e._v(" "),e.showConfig.showLanguages?t("div",{staticClass:"languages",class:{"icon-loading-small":e.loading.languages}},[t("label",{staticClass:"hidden-visually",attrs:{for:"language"+e.user.id+e.rand}},[e._v(e._s(e.t("settings","Set the language")))]),e._v(" "),t("NcMultiselect",{staticClass:"multiselect-vue",attrs:{id:"language"+e.user.id+e.rand,"allow-empty":!1,disabled:e.loading.languages||e.loading.all,options:e.languages,placeholder:e.t("settings","No language set"),value:e.userLanguage,"group-label":"label","group-values":"languages",label:"name","track-by":"code"},on:{input:e.setUserLanguage}})],1):e._e(),e._v(" "),t("div",{staticClass:"managers",class:{"icon-loading-small":e.loading.manager}},[t("NcMultiselect",{ref:"manager",staticClass:"multiselect-vue",attrs:{"close-on-select":!0,"user-select":!0,options:e.possibleManagers,placeholder:e.t("settings","Select manager"),loading:e.loadingPossibleManagers||e.loading.manager,label:"displayname","track-by":"id"},on:{open:e.searchInitialUserManager,"search-change":e.searchUserManager,remove:e.updateUserManager,select:e.updateUserManager},model:{value:e.currentManager,callback:function(t){e.currentManager=t},expression:"currentManager"}},[t("span",{attrs:{slot:"noResult"},slot:"noResult"},[e._v(e._s(e.t("settings","No results")))])])],1),e._v(" "),e.showConfig.showStoragePath||e.showConfig.showUserBackend?t("div",{staticClass:"storageLocation"}):e._e(),e._v(" "),e.showConfig.showLastLogin?t("div"):e._e(),e._v(" "),t("div",{staticClass:"userActions"},[e.loading.all?e._e():t("div",{staticClass:"toggleUserActions"},[t("NcActions",[t("NcActionButton",{attrs:{icon:"icon-checkmark",title:e.t("settings","Done"),"aria-label":e.t("settings","Done")},on:{click:function(t){e.editing=!1}}})],1),e._v(" "),t("div",{directives:[{name:"click-outside",rawName:"v-click-outside",value:e.hideMenu,expression:"hideMenu"}],staticClass:"userPopoverMenuWrapper"},[t("button",{staticClass:"icon-more",attrs:{"aria-expanded":e.openedMenu,"aria-label":e.t("settings","Toggle user actions menu")},on:{click:function(t){return t.preventDefault(),e.toggleMenu.apply(null,arguments)}}}),e._v(" "),t("div",{staticClass:"popovermenu",class:{open:e.openedMenu}},[t("NcPopoverMenu",{attrs:{menu:e.userActions}})],1)])],1),e._v(" "),t("div",{staticClass:"feedback",style:{opacity:""!==e.feedbackMessage?1:0}},[t("div",{staticClass:"icon-checkmark"}),e._v("\n\t\t\t"+e._s(e.feedbackMessage)+"\n\t\t")])])]):t("UserRowSimple",{class:{"row--menu-opened":e.openedMenu},attrs:{editing:e.editing,"feedback-message":e.feedbackMessage,groups:e.groups,languages:e.languages,loading:e.loading,"opened-menu":e.openedMenu,settings:e.settings,"show-config":e.showConfig,"sub-admins-groups":e.subAdminsGroups,"user-actions":e.userActions,user:e.user,"is-dark-theme":e.isDarkTheme},on:{"update:editing":function(t){e.editing=t},"update:openedMenu":function(t){e.openedMenu=t},"update:opened-menu":function(t){e.openedMenu=t}}})}),[],!1,null,"0912dcf4",null).exports,be={id:"none",label:t("settings","Unlimited")},Ce={id:"default",label:t("settings","Default quota")},ye={id:"",displayName:"",password:"",mailAddress:"",groups:[],manager:"",subAdminsGroups:[],quota:Ce,language:{code:"en",name:t("settings","Default language")}},Ue={name:"UserList",components:{NcModal:E(),userRow:Ae,NcMultiselect:k(),InfiniteLoading:I(),NcButton:F()},props:{users:{type:Array,default:()=>[]},showConfig:{type:Object,required:!0},selectedGroup:{type:String,default:null},externalActions:{type:Array,default:()=>[]}},data:()=>({unlimitedQuota:be,defaultQuota:Ce,loading:{all:!1,groups:!1},scrolled:!1,possibleManagers:[],searchQuery:"",newUser:Object.assign({},ye)}),computed:{settings(){return this.$store.getters.getServerData},selectedGroupDecoded(){return decodeURIComponent(this.selectedGroup)},filteredUsers(){return"disabled"===this.selectedGroup?this.users.filter((e=>!1===e.enabled)):(this.settings.isAdmin,this.users.filter((e=>!1!==e.enabled)))},groups(){return this.$store.getters.getGroups.filter((e=>"disabled"!==e.id)).sort(((e,t)=>e.name.localeCompare(t.name)))},canAddGroups(){return this.groups.map((e=>((e=Object.assign({},e)).$isDisabled=!1===e.canAdd,e)))},subAdminsGroups(){return this.$store.getters.getSubadminGroups},quotaOptions(){const e=this.settings.quotaPreset.reduce(((e,t)=>e.concat({id:t,label:t})),[]);return this.settings.allowUnlimitedQuota&&e.unshift(this.unlimitedQuota),e.unshift(this.defaultQuota),e},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(e,t){this.redirectIfDisabled(),this.$store.commit("resetUsers"),this.$refs.infiniteLoading.stateChanger.reset(),this.setNewUserDefaultGroup(e)},usersCount(e,t){0===e&&1===t?this.$refs.infiniteLoading.stateChanger.reset():1===e&&0===t&&this.$refs.infiniteLoading.stateChanger.loaded()}},async beforeMount(){await this.searchUserManager()},mounted(){this.settings.canChangePassword||OC.Notification.showTemporary(t("settings","Password change is disabled because the master key is disabled")),this.resetForm(),(0,Q.Ld)("nextcloud:unified-search.search",this.search),(0,Q.Ld)("nextcloud:unified-search.reset",this.resetSearch),this.redirectIfDisabled()},beforeDestroy(){(0,Q.r1)("nextcloud:unified-search.search",this.search),(0,Q.r1)("nextcloud:unified-search.reset",this.resetSearch)},methods:{async searchUserManager(e){await this.$store.dispatch("searchUsers",{offset:0,limit:10,search:e}).then((e=>{const t=null!=e&&e.data?Object.values(null==e?void 0:e.data.ocs.data.users):[];t.length>0&&(this.possibleManagers=t)}))},onScroll(e){this.scrolled=e.target.scrollTo>0},validateQuota(e){const t=OC.Util.computerFileSize(e);return null!==t&&t>=0?(e=OC.Util.humanFileSize(OC.Util.computerFileSize(e)),this.newUser.quota={id:e,label:e},this.newUser.quota):(this.newUser.quota=this.quotaOptions[0],this.quotaOptions[0])},infiniteHandler(e){this.$store.dispatch("getUsers",{offset:this.usersOffset,limit:this.usersLimit,group:"disabled"!==this.selectedGroup?this.selectedGroup:"",search:this.searchQuery}).then((t=>{t>0&&e.loaded(),t<this.usersLimit&&e.complete()}))},search(e){let{query:t}=e;this.searchQuery=t,this.$store.commit("resetUsers"),this.$refs.infiniteLoading.stateChanger.reset()},resetSearch(){this.search({query:""})},resetForm(){this.newUser=Object.assign({},ye),this.settings.defaultLanguage&&N.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((e=>e.id)),subadmin:this.newUser.subAdminsGroups.map((e=>e.id)),quota:this.newUser.quota.id,language:this.newUser.language.code,manager:this.newUser.manager.id}).then((()=>{this.resetForm(),this.$refs.newusername.focus(),this.closeModal()})).catch((e=>{if(this.loading.all=!1,e.response&&e.response.data&&e.response.data.ocs&&e.response.data.ocs.meta){const t=e.response.data.ocs.meta.statuscode;102===t?this.$refs.newusername.focus():107===t&&this.$refs.newuserpassword.focus()}}))},setNewUserDefaultGroup(e){if(e&&e.length>0){const t=this.groups.find((t=>t.id===e));if(t)return void(this.newUser.groups=[t])}this.newUser.groups=[]},createGroup(e){return this.loading.groups=!0,this.$store.dispatch("addGroup",e).then((t=>{this.newUser.groups.push(this.groups.find((t=>t.id===e))),this.loading.groups=!1})).catch((()=>{this.loading.groups=!1})),this.$store.getters.getGroups[this.groups.length]},redirectIfDisabled(){const e=this.$store.getters.getGroups;"disabled"===this.selectedGroup&&e.findIndex((e=>"disabled"===e.id&&0===e.usercount))>-1&&(this.$router.push({name:"users"}),this.$refs.infiniteLoading.stateChanger.reset())},closeModal(){this.showConfig.showNewUserForm=!1}}};var ke=a(21849),Ne={};Ne.styleTagTransform=ge(),Ne.setAttributes=le(),Ne.insert=re().bind(null,"head"),Ne.domAPI=ie(),Ne.insertStyleElement=ue(),se()(ke.Z,Ne),ke.Z&&ke.Z.locals&&ke.Z.locals;const Me=(0,P.Z)(Ue,(function(){var e=this,t=e._self._c;return t("div",{staticClass:"user-list-grid",attrs:{id:"app-content",role:"grid","aria-label":e.t("settings","User's table")},on:{"&scroll":function(t){return e.onScroll.apply(null,arguments)}}},[e.showConfig.showNewUserForm?t("NcModal",{attrs:{size:"small"},on:{close:e.closeModal}},[t("form",{staticClass:"modal__content",attrs:{id:"new-user",disabled:e.loading.all},on:{submit:function(t){return t.preventDefault(),e.createUser.apply(null,arguments)}}},[t("h2",[e._v(e._s(e.t("settings","New user")))]),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.newUser.id,expression:"newUser.id"}],ref:"newusername",staticClass:"modal__item",attrs:{id:"newusername",disabled:e.settings.newUserGenerateUserID,placeholder:e.settings.newUserGenerateUserID?e.t("settings","Will be autogenerated"):e.t("settings","Username"),autocapitalize:"none",autocomplete:"off",autocorrect:"off",name:"username",pattern:"[a-zA-Z0-9 _\\.@\\-']+",required:"",type:"text"},domProps:{value:e.newUser.id},on:{input:function(t){t.target.composing||e.$set(e.newUser,"id",t.target.value)}}}),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.newUser.displayName,expression:"newUser.displayName"}],staticClass:"modal__item",attrs:{id:"newdisplayname",placeholder:e.t("settings","Display name"),autocapitalize:"none",autocomplete:"off",autocorrect:"off",name:"displayname",type:"text"},domProps:{value:e.newUser.displayName},on:{input:function(t){t.target.composing||e.$set(e.newUser,"displayName",t.target.value)}}}),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.newUser.password,expression:"newUser.password"}],ref:"newuserpassword",staticClass:"modal__item",attrs:{id:"newuserpassword",minlength:e.minPasswordLength,maxlength:469,placeholder:e.t("settings","Password"),required:""===e.newUser.mailAddress,autocapitalize:"none",autocomplete:"new-password",autocorrect:"off",name:"password",type:"password"},domProps:{value:e.newUser.password},on:{input:function(t){t.target.composing||e.$set(e.newUser,"password",t.target.value)}}}),e._v(" "),t("input",{directives:[{name:"model",rawName:"v-model",value:e.newUser.mailAddress,expression:"newUser.mailAddress"}],staticClass:"modal__item",attrs:{id:"newemail",placeholder:e.t("settings","Email"),required:""===e.newUser.password||e.settings.newUserRequireEmail,autocapitalize:"none",autocomplete:"off",autocorrect:"off",name:"email",type:"email"},domProps:{value:e.newUser.mailAddress},on:{input:function(t){t.target.composing||e.$set(e.newUser,"mailAddress",t.target.value)}}}),e._v(" "),t("div",{staticClass:"groups modal__item"},[e.settings.isAdmin?e._e():t("input",{class:{"icon-loading-small":e.loading.groups},attrs:{id:"newgroups",required:!e.settings.isAdmin,tabindex:"-1",type:"text"},domProps:{value:e.newUser.groups}}),e._v(" "),t("NcMultiselect",{staticClass:"multiselect-vue",attrs:{"close-on-select":!1,disabled:e.loading.groups||e.loading.all,multiple:!0,options:e.canAddGroups,placeholder:e.t("settings","Add user to group"),"tag-width":60,taggable:!0,label:"name","tag-placeholder":"create","track-by":"id"},on:{tag:e.createGroup},model:{value:e.newUser.groups,callback:function(t){e.$set(e.newUser,"groups",t)},expression:"newUser.groups"}},[t("span",{attrs:{slot:"noResult"},slot:"noResult"},[e._v(e._s(e.t("settings","No results")))])])],1),e._v(" "),e.subAdminsGroups.length>0&&e.settings.isAdmin?t("div",{staticClass:"subadmins modal__item"},[t("NcMultiselect",{staticClass:"multiselect-vue",attrs:{"close-on-select":!1,multiple:!0,options:e.subAdminsGroups,placeholder:e.t("settings","Set user as admin for"),"tag-width":60,label:"name","track-by":"id"},model:{value:e.newUser.subAdminsGroups,callback:function(t){e.$set(e.newUser,"subAdminsGroups",t)},expression:"newUser.subAdminsGroups"}},[t("span",{attrs:{slot:"noResult"},slot:"noResult"},[e._v(e._s(e.t("settings","No results")))])])],1):e._e(),e._v(" "),t("div",{staticClass:"quota modal__item"},[t("NcMultiselect",{staticClass:"multiselect-vue",attrs:{"allow-empty":!1,options:e.quotaOptions,placeholder:e.t("settings","Select user quota"),taggable:!0,label:"label","track-by":"id"},on:{tag:e.validateQuota},model:{value:e.newUser.quota,callback:function(t){e.$set(e.newUser,"quota",t)},expression:"newUser.quota"}})],1),e._v(" "),e.showConfig.showLanguages?t("div",{staticClass:"languages modal__item"},[t("NcMultiselect",{staticClass:"multiselect-vue",attrs:{"allow-empty":!1,options:e.languages,placeholder:e.t("settings","Default language"),"group-label":"label","group-values":"languages",label:"name","track-by":"code"},model:{value:e.newUser.language,callback:function(t){e.$set(e.newUser,"language",t)},expression:"newUser.language"}})],1):e._e(),e._v(" "),e.showConfig.showStoragePath?t("div",{staticClass:"storageLocation"}):e._e(),e._v(" "),e.showConfig.showUserBackend?t("div",{staticClass:"userBackend"}):e._e(),e._v(" "),e.showConfig.showLastLogin?t("div",{staticClass:"lastLogin"}):e._e(),e._v(" "),t("div",{staticClass:"modal__item managers",class:{"icon-loading-small":e.loading.manager}},[t("NcMultiselect",{ref:"manager",staticClass:"multiselect-vue",attrs:{"close-on-select":!0,"user-select":!0,options:e.possibleManagers,placeholder:e.t("settings","Select user manager"),label:"displayname","track-by":"id"},on:{"search-change":e.searchUserManager},model:{value:e.newUser.manager,callback:function(t){e.$set(e.newUser,"manager",t)},expression:"newUser.manager"}},[t("span",{attrs:{slot:"noResult"},slot:"noResult"},[e._v(e._s(e.t("settings","No results")))])])],1),e._v(" "),t("div",{staticClass:"user-actions"},[t("NcButton",{attrs:{id:"newsubmit",type:"primary","native-type":"submit",value:""}},[e._v("\n\t\t\t\t\t"+e._s(e.t("settings","Add a new user"))+"\n\t\t\t\t")])],1)])]):e._e(),e._v(" "),t("div",{staticClass:"row",class:{sticky:e.scrolled&&!e.showConfig.showNewUserForm},attrs:{id:"grid-header"}},[t("div",{staticClass:"avatar",attrs:{id:"headerAvatar"}}),e._v(" "),t("div",{staticClass:"name",attrs:{id:"headerName"}},[t("div",{staticClass:"subtitle"},[t("strong",[e._v("\n\t\t\t\t\t"+e._s(e.t("settings","Display name"))+"\n\t\t\t\t")])]),e._v("\n\t\t\t"+e._s(e.t("settings","Username"))+"\n\t\t")]),e._v(" "),t("div",{staticClass:"password",attrs:{id:"headerPassword"}},[e._v("\n\t\t\t"+e._s(e.t("settings","Password"))+"\n\t\t")]),e._v(" "),t("div",{staticClass:"mailAddress",attrs:{id:"headerAddress"}},[e._v("\n\t\t\t"+e._s(e.t("settings","Email"))+"\n\t\t")]),e._v(" "),t("div",{staticClass:"groups",attrs:{id:"headerGroups"}},[e._v("\n\t\t\t"+e._s(e.t("settings","Groups"))+"\n\t\t")]),e._v(" "),e.subAdminsGroups.length>0&&e.settings.isAdmin?t("div",{staticClass:"subadmins",attrs:{id:"headerSubAdmins"}},[e._v("\n\t\t\t"+e._s(e.t("settings","Group admin for"))+"\n\t\t")]):e._e(),e._v(" "),t("div",{staticClass:"quota",attrs:{id:"headerQuota"}},[e._v("\n\t\t\t"+e._s(e.t("settings","Quota"))+"\n\t\t")]),e._v(" "),e.showConfig.showLanguages?t("div",{staticClass:"languages",attrs:{id:"headerLanguages"}},[e._v("\n\t\t\t"+e._s(e.t("settings","Language"))+"\n\t\t")]):e._e(),e._v(" "),e.showConfig.showUserBackend||e.showConfig.showStoragePath?t("div",{staticClass:"headerUserBackend userBackend"},[e.showConfig.showUserBackend?t("div",{staticClass:"userBackend"},[e._v("\n\t\t\t\t"+e._s(e.t("settings","User backend"))+"\n\t\t\t")]):e._e(),e._v(" "),e.showConfig.showStoragePath?t("div",{staticClass:"subtitle storageLocation"},[e._v("\n\t\t\t\t"+e._s(e.t("settings","Storage location"))+"\n\t\t\t")]):e._e()]):e._e(),e._v(" "),e.showConfig.showLastLogin?t("div",{staticClass:"headerLastLogin lastLogin"},[e._v("\n\t\t\t"+e._s(e.t("settings","Last login"))+"\n\t\t")]):e._e(),e._v(" "),t("div",{staticClass:"manager",attrs:{id:"headerManager"}},[e._v("\n\t\t\t"+e._s(e.t("settings","Manager"))+"\n\t\t")]),e._v(" "),t("div",{staticClass:"userActions"})]),e._v(" "),e._l(e.filteredUsers,(function(s){return t("user-row",{key:s.id,attrs:{"external-actions":e.externalActions,groups:e.groups,languages:e.languages,"quota-options":e.quotaOptions,settings:e.settings,"show-config":e.showConfig,"sub-admins-groups":e.subAdminsGroups,user:s,users:e.users,"is-dark-theme":e.isDarkTheme}})})),e._v(" "),t("InfiniteLoading",{ref:"infiniteLoading",on:{infinite:e.infiniteHandler}},[t("div",{attrs:{slot:"spinner"},slot:"spinner"},[t("div",{staticClass:"users-icon-loading icon-loading"})]),e._v(" "),t("div",{attrs:{slot:"no-more"},slot:"no-more"},[t("div",{staticClass:"users-list-end"})]),e._v(" "),t("div",{attrs:{slot:"no-results"},slot:"no-results"},[t("div",{attrs:{id:"emptycontent"}},[t("div",{staticClass:"icon-contacts-dark"}),e._v(" "),t("h2",[e._v(e._s(e.t("settings","No users in here")))])])])])],2)}),[],!1,null,"228801f0",null).exports;var Le=a(61149),Ge=a(25108);N.default.use(L());const Se={name:"Users",components:{NcAppContent:n(),NcAppNavigation:o(),NcAppNavigationCaption:d(),NcAppNavigationCounter:c(),NcAppNavigationItem:p(),NcAppNavigationNew:m(),NcAppNavigationNewItem:w(),NcAppNavigationSettings:_(),NcContent:C(),GroupListItem:B,NcMultiselect:k(),Plus:Le.Z,UserList:Me},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(e){this.setLocalStorage("showLanguages",e)}},showLastLogin:{get(){return this.getLocalstorage("showLastLogin")},set(e){this.setLocalStorage("showLastLogin",e)}},showUserBackend:{get(){return this.getLocalstorage("showUserBackend")},set(e){this.setLocalStorage("showUserBackend",e)}},showStoragePath:{get(){return this.getLocalstorage("showStoragePath")},set(e){this.setLocalStorage("showStoragePath",e)}},userCount(){return this.$store.getters.getUserCount},settings(){return this.$store.getters.getServerData},quotaOptions(){const e=this.settings.quotaPreset.reduce(((e,t)=>e.concat({id:t,label:t})),[]);return this.settings.allowUnlimitedQuota&&e.unshift(this.unlimitedQuota),e},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(e){this.selectedQuota=e}},sendWelcomeMail:{get(){return this.settings.newUserSendEmail},async set(e){try{this.loadingSendMail=!0,this.$store.commit("setServerData",{...this.settings,newUserSendEmail:e}),await A.default.post((0,y.generateUrl)("/settings/users/preferences/newUser.sendEmail"),{value:e?"yes":"no"})}catch(e){Ge.error("could not update newUser.sendEmail preference: "+e.message,e)}finally{this.loadingSendMail=!1}}},groupList(){return(Array.isArray(this.groups)?this.groups:[]).filter((e=>"disabled"!==e.id&&"admin"!==e.id)).map((e=>this.formatGroupMenu(e)))},adminGroupMenu(){return this.formatGroupMenu(this.groups.find((e=>"admin"===e.id)))},disabledGroupMenu(){return this.formatGroupMenu(this.groups.find((e=>"disabled"===e.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&&N.default.nextTick((()=>{window.newusername.focus()}))},getLocalstorage(e){const t=this.$localStorage.get(e);return this.showConfig[e]=null!==t?"true"===t:this.showConfig[e],this.showConfig[e]},setLocalStorage(e,t){return this.showConfig[e]=t,this.$localStorage.set(e,t),t},setDefaultQuota(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"none";this.$store.dispatch("setAppConfig",{app:"files",key:"default_quota",value:e.id?e.id:e}).then((()=>{"object"!=typeof e&&(e={id:e,label:e}),this.defaultQuota=e}))},validateQuota(e){return null===OC.Util.computerFileSize(e)?this.setDefaultQuota("none"):this.setDefaultQuota(OC.Util.humanFileSize(OC.Util.computerFileSize(e)))},registerAction(e,t,s){return this.externalActions.push({icon:e,text:t,action:s}),this.externalActions},async createGroup(e){if(""!==e.trim())try{this.loadingAddGroup=!0,await this.$store.dispatch("addGroup",e.trim()),this.hideAddGroupForm(),await this.$router.push({name:"group",params:{selectedGroup:encodeURIComponent(e.trim())}})}catch{this.showAddGroupForm()}finally{this.loadingAddGroup=!1}},showAddGroupForm(){this.$refs.addGroup.newItemActive=!0,this.$nextTick((()=>{this.$refs.addGroup.$refs.newItemInput.focusInput()}))},hideAddGroupForm(){this.$refs.addGroup.newItemActive=!1,this.$refs.addGroup.newItemValue=""},formatGroupMenu(e){const t={};return void 0===e?{}:(t.id=e.id,t.title=e.name,t.usercount=e.usercount,e.usercount-e.disabled>0&&(t.count=e.usercount-e.disabled),t)}}};var xe=a(69049),$e={};$e.styleTagTransform=ge(),$e.setAttributes=le(),$e.insert=re().bind(null,"head"),$e.domAPI=ie(),$e.insertStyleElement=ue(),se()(xe.Z,$e),xe.Z&&xe.Z.locals&&xe.Z.locals;const qe=(0,P.Z)(Se,(function(){var e=this,t=e._self._c;return t("NcContent",{attrs:{"app-name":"settings","navigation-class":{"icon-loading":e.loadingAddGroup}}},[t("NcAppNavigation",{scopedSlots:e._u([{key:"list",fn:function(){return[t("NcAppNavigationNewItem",{ref:"addGroup",attrs:{id:"addgroup","edit-placeholder":e.t("settings","Enter group name"),editable:!0,loading:e.loadingAddGroup,title:e.t("settings","Add group")},on:{click:e.showAddGroupForm,"new-item":e.createGroup},scopedSlots:e._u([{key:"icon",fn:function(){return[t("Plus",{attrs:{size:20}})]},proxy:!0}])}),e._v(" "),t("NcAppNavigationItem",{attrs:{id:"everyone",exact:!0,title:e.t("settings","Active users"),to:{name:"users"},icon:"icon-contacts-dark"}},[e.userCount>0?t("NcAppNavigationCounter",{attrs:{slot:"counter"},slot:"counter"},[e._v("\n\t\t\t\t\t"+e._s(e.userCount)+"\n\t\t\t\t")]):e._e()],1),e._v(" "),e.settings.isAdmin?t("NcAppNavigationItem",{attrs:{id:"admin",exact:!0,title:e.t("settings","Admins"),to:{name:"group",params:{selectedGroup:"admin"}},icon:"icon-user-admin"}},[e.adminGroupMenu.count?t("NcAppNavigationCounter",{attrs:{slot:"counter"},slot:"counter"},[e._v("\n\t\t\t\t\t"+e._s(e.adminGroupMenu.count)+"\n\t\t\t\t")]):e._e()],1):e._e(),e._v(" "),e.disabledGroupMenu.usercount>0||-1===e.disabledGroupMenu.usercount?t("NcAppNavigationItem",{attrs:{id:"disabled",exact:!0,title:e.t("settings","Disabled users"),to:{name:"group",params:{selectedGroup:"disabled"}},icon:"icon-disabled-users"}},[e.disabledGroupMenu.usercount>0?t("NcAppNavigationCounter",{attrs:{slot:"counter"},slot:"counter"},[e._v("\n\t\t\t\t\t"+e._s(e.disabledGroupMenu.usercount)+"\n\t\t\t\t")]):e._e()],1):e._e(),e._v(" "),e.groupList.length>0?t("NcAppNavigationCaption",{attrs:{title:e.t("settings","Groups")}}):e._e(),e._v(" "),e._l(e.groupList,(function(e){return t("GroupListItem",{key:e.id,attrs:{id:e.id,title:e.title,count:e.count}})}))]},proxy:!0},{key:"footer",fn:function(){return[t("NcAppNavigationSettings",[t("div",[t("p",[e._v(e._s(e.t("settings","Default quota:")))]),e._v(" "),t("NcMultiselect",{attrs:{value:e.defaultQuota,options:e.quotaOptions,"tag-placeholder":"create",placeholder:e.t("settings","Select default quota"),label:"label","track-by":"id","allow-empty":!1,taggable:!0},on:{tag:e.validateQuota,input:e.setDefaultQuota}})],1),e._v(" "),t("div",[t("input",{directives:[{name:"model",rawName:"v-model",value:e.showLanguages,expression:"showLanguages"}],staticClass:"checkbox",attrs:{id:"showLanguages",type:"checkbox"},domProps:{checked:Array.isArray(e.showLanguages)?e._i(e.showLanguages,null)>-1:e.showLanguages},on:{change:function(t){var s=e.showLanguages,a=t.target,i=!!a.checked;if(Array.isArray(s)){var n=e._i(s,null);a.checked?n<0&&(e.showLanguages=s.concat([null])):n>-1&&(e.showLanguages=s.slice(0,n).concat(s.slice(n+1)))}else e.showLanguages=i}}}),e._v(" "),t("label",{attrs:{for:"showLanguages"}},[e._v(e._s(e.t("settings","Show Languages")))])]),e._v(" "),t("div",[t("input",{directives:[{name:"model",rawName:"v-model",value:e.showLastLogin,expression:"showLastLogin"}],staticClass:"checkbox",attrs:{id:"showLastLogin",type:"checkbox"},domProps:{checked:Array.isArray(e.showLastLogin)?e._i(e.showLastLogin,null)>-1:e.showLastLogin},on:{change:function(t){var s=e.showLastLogin,a=t.target,i=!!a.checked;if(Array.isArray(s)){var n=e._i(s,null);a.checked?n<0&&(e.showLastLogin=s.concat([null])):n>-1&&(e.showLastLogin=s.slice(0,n).concat(s.slice(n+1)))}else e.showLastLogin=i}}}),e._v(" "),t("label",{attrs:{for:"showLastLogin"}},[e._v(e._s(e.t("settings","Show last login")))])]),e._v(" "),t("div",[t("input",{directives:[{name:"model",rawName:"v-model",value:e.showUserBackend,expression:"showUserBackend"}],staticClass:"checkbox",attrs:{id:"showUserBackend",type:"checkbox"},domProps:{checked:Array.isArray(e.showUserBackend)?e._i(e.showUserBackend,null)>-1:e.showUserBackend},on:{change:function(t){var s=e.showUserBackend,a=t.target,i=!!a.checked;if(Array.isArray(s)){var n=e._i(s,null);a.checked?n<0&&(e.showUserBackend=s.concat([null])):n>-1&&(e.showUserBackend=s.slice(0,n).concat(s.slice(n+1)))}else e.showUserBackend=i}}}),e._v(" "),t("label",{attrs:{for:"showUserBackend"}},[e._v(e._s(e.t("settings","Show user backend")))])]),e._v(" "),t("div",[t("input",{directives:[{name:"model",rawName:"v-model",value:e.showStoragePath,expression:"showStoragePath"}],staticClass:"checkbox",attrs:{id:"showStoragePath",type:"checkbox"},domProps:{checked:Array.isArray(e.showStoragePath)?e._i(e.showStoragePath,null)>-1:e.showStoragePath},on:{change:function(t){var s=e.showStoragePath,a=t.target,i=!!a.checked;if(Array.isArray(s)){var n=e._i(s,null);a.checked?n<0&&(e.showStoragePath=s.concat([null])):n>-1&&(e.showStoragePath=s.slice(0,n).concat(s.slice(n+1)))}else e.showStoragePath=i}}}),e._v(" "),t("label",{attrs:{for:"showStoragePath"}},[e._v(e._s(e.t("settings","Show storage path")))])]),e._v(" "),t("div",[t("input",{directives:[{name:"model",rawName:"v-model",value:e.sendWelcomeMail,expression:"sendWelcomeMail"}],staticClass:"checkbox",attrs:{id:"sendWelcomeMail",disabled:e.loadingSendMail,type:"checkbox"},domProps:{checked:Array.isArray(e.sendWelcomeMail)?e._i(e.sendWelcomeMail,null)>-1:e.sendWelcomeMail},on:{change:function(t){var s=e.sendWelcomeMail,a=t.target,i=!!a.checked;if(Array.isArray(s)){var n=e._i(s,null);a.checked?n<0&&(e.sendWelcomeMail=s.concat([null])):n>-1&&(e.sendWelcomeMail=s.slice(0,n).concat(s.slice(n+1)))}else e.sendWelcomeMail=i}}}),e._v(" "),t("label",{attrs:{for:"sendWelcomeMail"}},[e._v(e._s(e.t("settings","Send email to new user")))])])])]},proxy:!0}])},[t("NcAppNavigationNew",{attrs:{"button-id":"new-user-button",text:e.t("settings","New user"),"button-class":"icon-add"},on:{click:e.showNewUserMenu,keyup:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.showNewUserMenu.apply(null,arguments)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"space",32,t.key,[" ","Spacebar"])?null:e.showNewUserMenu.apply(null,arguments)}]}})],1),e._v(" "),t("NcAppContent",[t("UserList",{attrs:{users:e.users,"show-config":e.showConfig,"selected-group":e.selectedGroupDecoded,"external-actions":e.externalActions}})],1)],1)}),[],!1,null,"c70f3f58",null).exports}}]);
  3. //# sourceMappingURL=settings-users-8351.js.map?v=8b7284eb096e5c63052f