nextcloud/apps/settings/js/vue-5.js

23 lines
48 KiB
JavaScript

(window.webpackJsonpSettings=window.webpackJsonpSettings||[]).push([[5],{492:function(e,t,s){var i=s(582);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,s(172).default)("61ab8a86",i,!0,{})},493:function(e,t,s){var i=s(584);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,s(172).default)("02c3314b",i,!0,{})},494:function(e,t,s){var i=s(587);"string"==typeof i&&(i=[[e.i,i,""]]),i.locals&&(e.exports=i.locals);(0,s(172).default)("584a9a76",i,!0,{})},581:function(e,t,s){"use strict";var i=s(492);s.n(i).a},582:function(e,t,s){(t=s(171)(!1)).push([e.i,"\n.cellText[data-v-02d70d23] {\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n",""]),e.exports=t},583:function(e,t,s){"use strict";var i=s(493);s.n(i).a},584:function(e,t,s){(t=s(171)(!1)).push([e.i,".row--menu-opened[data-v-7696efa2]{z-index:1 !important}\n",""]),e.exports=t},586:function(e,t,s){"use strict";var i=s(494);s.n(i).a},587:function(e,t,s){(t=s(171)(!1)).push([e.i,"#usergrouplist #addgroup[data-v-96b08c5e] .app-navigation-entry__utils{display:none}\n",""]),e.exports=t},599:function(e,s,i){"use strict";i.r(s);var a=i(529),n=i.n(a),r=i(497),o=i.n(r),u=i(498),l=i.n(u),d=i(530),c=i.n(d),g=i(499),p=i.n(g),h=i(500),m=i.n(h),f=i(531),v=i.n(f),w=i(532),b=i.n(w),_=i(501),y=i.n(_),C=i(533),A=i.n(C),U=i(12),k=i(502),L=i.n(k),x=i(503),G=i.n(x),S=i(98),N=i(162),$=i(534);function M(e){return(M="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}
/**
* @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>
*
* @author John Molakvoæ <skjnldsv@protonmail.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/var q={props:{user:{type:Object,required:!0},settings:{type:Object,default:function(){return{}}},groups:{type:Array,default:function(){return[]}},subAdminsGroups:{type:Array,default:function(){return[]}},quotaOptions:{type:Array,default:function(){return[]}},showConfig:{type:Object,default:function(){return{}}},languages:{type:Array,required:!0},externalActions:{type:Array,default:function(){return[]}}},computed:{userGroups:function(){var e=this,t=this.groups.filter((function(t){return e.user.groups.includes(t.id)}));return t},userSubAdminsGroups:function(){var e=this,t=this.subAdminsGroups.filter((function(t){return e.user.subadmin.includes(t.id)}));return t},availableGroups:function(){var e=this;return this.groups.map((function(t){var s=Object.assign({},t);return s.$isDisabled=!1===t.canAdd&&!e.user.groups.includes(t.id)||!1===t.canRemove&&e.user.groups.includes(t.id),s}))},usedSpace:function(){return this.user.quota.used?t("settings","{size} used",{size:OC.Util.humanFileSize(this.user.quota.used)}):t("settings","{size} used",{size:OC.Util.humanFileSize(0)})},usedQuota:function(){var e=this.user.quota.quota;e>0?e=Math.min(100,Math.round(this.user.quota.used/e*100)):e=95*(1-1/(this.user.quota.used/(10*Math.pow(2,30))+1));return isNaN(e)?0:e},userQuota:function(){if(this.user.quota.quota>=0){var e=OC.Util.humanFileSize(this.user.quota.quota),t=this.quotaOptions.find((function(t){return t.id===e}));return t||{id:e,label:e}}return"default"===this.user.quota.quota?this.quotaOptions[0]:this.quotaOptions[1]},minPasswordLength:function(){return this.$store.getters.getPasswordPolicyMinLength},userLanguage:function(){var e=this,t=this.languages[0].languages.concat(this.languages[1].languages).find((function(t){return t.code===e.user.language}));return"object"!==M(t)&&""!==this.user.language?{code:this.user.language,name:this.user.language}:""!==this.user.language&&t},userLastLoginTooltip:function(){return this.user.lastLogin>0?OC.Util.formatDate(this.user.lastLogin):""},userLastLogin:function(){return this.user.lastLogin>0?OC.Util.relativeModifiedDate(this.user.lastLogin):t("settings","Never")}},methods:{generateAvatar:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:32;return OC.generateUrl("/avatar/{user}/{size}?v={version}",{user:e,size:t,version:oc_userconfig.avatar.version})}}},O={name:"UserRowSimple",components:{PopoverMenu:N.PopoverMenu,ActionButton:N.ActionButton,Actions:N.Actions},directives:{ClickOutside:G.a},mixins:[q],props:{user:{type:Object,required:!0},loading:{type:Object,required:!0},showConfig:{type:Object,required:!0},userActions:{type:Array,required:!0},openedMenu:{type:Boolean,required:!0},feedbackMessage:{type:String,required:!0},subAdminsGroups:{type:Array,required:!0},settings:{type:Object,required:!0}},computed:{userGroupsLabels:function(){return this.userGroups.map((function(e){return e.name})).join(", ")},userSubAdminsGroupsLabels:function(){return this.userSubAdminsGroups.map((function(e){return e.name})).join(", ")},usedSpace:function(){return this.user.quota.used?t("settings","{size} used",{size:OC.Util.humanFileSize(this.user.quota.used)}):t("settings","{size} used",{size:OC.Util.humanFileSize(0)})},canEdit:function(){return Object($.getCurrentUser)().uid!==this.user.id&&"admin"!==this.user.id}},methods:{hideMenu:function(){this.$emit("hideMenu")},toggleEdit:function(){this.$emit("update:editing",!0)}}},P=(i(581),i(41)),D=Object(P.a)(O,(function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"row",class:{disabled:e.loading.delete||e.loading.disable},attrs:{"data-id":e.user.id}},[s("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():s("img",{attrs:{alt:"",width:"32",height:"32",src:e.generateAvatar(e.user.id,32),srcset:e.generateAvatar(e.user.id,64)+" 2x, "+e.generateAvatar(e.user.id,128)+" 4x"}})]),e._v(" "),s("div",{staticClass:"name"},[e._v("\n\t\t"+e._s(e.user.id)+"\n\t\t"),s("div",{staticClass:"displayName subtitle"},[s("div",{directives:[{name:"tooltip",rawName:"v-tooltip",value:e.user.displayname.length>20?e.user.displayname:"",expression:"user.displayname.length > 20 ? user.displayname : ''"}],staticClass:"cellText"},[e._v("\n\t\t\t\t"+e._s(e.user.displayname)+"\n\t\t\t")])])]),e._v(" "),s("div"),e._v(" "),s("div",{staticClass:"mailAddress"},[s("div",{directives:[{name:"tooltip",rawName:"v-tooltip",value:null!==e.user.email&&e.user.email.length>20?e.user.email:"",expression:"user.email !== null && user.email.length > 20 ? user.email : ''"}],staticClass:"cellText"},[e._v("\n\t\t\t"+e._s(e.user.email)+"\n\t\t")])]),e._v(" "),s("div",{staticClass:"groups"},[e._v("\n\t\t"+e._s(e.userGroupsLabels)+"\n\t")]),e._v(" "),e.subAdminsGroups.length>0&&e.settings.isAdmin?s("div",{staticClass:"subAdminsGroups"},[e._v("\n\t\t"+e._s(e.userSubAdminsGroupsLabels)+"\n\t")]):e._e(),e._v(" "),s("div",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:e.usedSpace,expression:"usedSpace",modifiers:{auto:!0}}],staticClass:"quota"},[s("progress",{staticClass:"quota-user-progress",class:{warn:e.usedQuota>80},attrs:{max:"100"},domProps:{value:e.usedQuota}})]),e._v(" "),e.showConfig.showLanguages?s("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?s("div",{staticClass:"userBackend"},[e.showConfig.showUserBackend?s("div",{staticClass:"userBackend"},[e._v("\n\t\t\t"+e._s(e.user.backend)+"\n\t\t")]):e._e(),e._v(" "),e.showConfig.showStoragePath?s("div",{staticClass:"storageLocation subtitle"},[e._v("\n\t\t\t"+e._s(e.user.storageLocation)+"\n\t\t")]):e._e()]):e._e(),e._v(" "),e.showConfig.showLastLogin?s("div",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:e.userLastLoginTooltip,expression:"userLastLoginTooltip",modifiers:{auto:!0}}],staticClass:"lastLogin"},[e._v("\n\t\t"+e._s(e.userLastLogin)+"\n\t")]):e._e(),e._v(" "),s("div",{staticClass:"userActions"},[e.canEdit&&!e.loading.all?s("div",{staticClass:"toggleUserActions"},[s("Actions",[s("ActionButton",{attrs:{icon:"icon-rename"},on:{click:e.toggleEdit}},[e._v("\n\t\t\t\t\t"+e._s(e.t("settings","Edit User"))+"\n\t\t\t\t")])],1),e._v(" "),s("div",{directives:[{name:"click-outside",rawName:"v-click-outside",value:e.hideMenu,expression:"hideMenu"}],staticClass:"icon-more",on:{click:function(t){return e.$emit("toggleMenu")}}}),e._v(" "),s("div",{staticClass:"popovermenu",class:{open:e.openedMenu}},[s("PopoverMenu",{attrs:{menu:e.userActions}})],1)],1):e._e(),e._v(" "),s("div",{staticClass:"feedback",style:{opacity:""!==e.feedbackMessage?1:0}},[s("div",{staticClass:"icon-checkmark"}),e._v("\n\t\t\t"+e._s(e.feedbackMessage)+"\n\t\t")])])])}),[],!1,null,"02d70d23",null).exports;function B(e,t,s,i,a,n,r){try{var o=e[n](r),u=o.value}catch(e){return void s(e)}o.done?t(u):Promise.resolve(u).then(i,a)}function Q(e){return function(){var t=this,s=arguments;return new Promise((function(i,a){var n=e.apply(t,s);function r(e){B(n,i,a,r,o,"next",e)}function o(e){B(n,i,a,r,o,"throw",e)}r(void 0)}))}}U.default.use(S.default);var z,R,F,j,E,T,I,W={name:"UserRow",components:{UserRowSimple:D,PopoverMenu:N.PopoverMenu,Actions:N.Actions,ActionButton:N.ActionButton,Multiselect:N.Multiselect},directives:{ClickOutside:G.a},mixins:[q],props:{user:{type:Object,required:!0},settings:{type:Object,default:function(){return{}}},groups:{type:Array,default:function(){return[]}},subAdminsGroups:{type:Array,default:function(){return[]}},quotaOptions:{type:Array,default:function(){return[]}},showConfig:{type:Object,default:function(){return{}}},languages:{type:Array,required:!0},externalActions:{type:Array,default:function(){return[]}}},data:function(){return{rand:parseInt(1e3*Math.random()),openedMenu:!1,feedbackMessage:"",editing:!1,loading:{all:!1,displayName:!1,password:!1,mailAddress:!1,groups:!1,subadmins:!1,quota:!1,delete:!1,disable:!1,languages:!1,wipe:!1}}},computed:{userActions:function(){var 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:function(){this.openedMenu=!this.openedMenu},hideMenu:function(){this.openedMenu=!1},wipeUserDevices:function(){var e=this,s=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:s}),t("settings","Remote wipe of devices"),{type:OC.dialogs.YES_NO_BUTTONS,confirm:t("settings","Wipe {userid}'s devices",{userid:s}),confirmClasses:"error",cancel:t("settings","Cancel")},(function(t){t&&(e.loading.wipe=!0,e.loading.all=!0,e.$store.dispatch("wipeUserDevices",s).then((function(){e.loading.wipe=!1,e.loading.all=!1})))}),!0)},deleteUser:function(){var e=this,s=this.user.id;OC.dialogs.confirmDestructive(t("settings","Fully delete {userid}'s account including all their personal files, app data, etc.",{userid:s}),t("settings","Account deletion"),{type:OC.dialogs.YES_NO_BUTTONS,confirm:t("settings","Delete {userid}'s account",{userid:s}),confirmClasses:"error",cancel:t("settings","Cancel")},(function(t){if(t)return e.loading.delete=!0,e.loading.all=!0,e.$store.dispatch("deleteUser",s).then((function(){e.loading.delete=!1,e.loading.all=!1}))}),!0)},enableDisableUser:function(){var e=this;this.loading.delete=!0,this.loading.all=!0;var t=this.user.id,s=!this.user.enabled;return this.$store.dispatch("enableDisableUser",{userid:t,enabled:s}).then((function(){e.loading.delete=!1,e.loading.all=!1}))},updateDisplayName:function(){var e=this,t=this.$refs.displayName.value;this.loading.displayName=!0,this.$store.dispatch("setUserData",{userid:this.user.id,key:"displayname",value:t}).then((function(){e.loading.displayName=!1,e.$refs.displayName.value=t}))},updatePassword:function(){var e=this,t=this.$refs.password.value;this.loading.password=!0,this.$store.dispatch("setUserData",{userid:this.user.id,key:"password",value:t}).then((function(){e.loading.password=!1,e.$refs.password.value=""}))},updateEmail:function(){var e=this,t=this.$refs.mailAddress.value;this.loading.mailAddress=!0,this.$store.dispatch("setUserData",{userid:this.user.id,key:"email",value:t}).then((function(){e.loading.mailAddress=!1,e.$refs.mailAddress.value=t}))},createGroup:(I=Q(regeneratorRuntime.mark((function e(t){var s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.loading={groups:!0,subadmins:!0},e.prev=1,e.next=4,this.$store.dispatch("addGroup",t);case 4:return s=this.user.id,e.next=7,this.$store.dispatch("addUserGroup",{userid:s,gid:t});case 7:e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),console.error(e.t0);case 12:return e.prev=12,this.loading={groups:!1,subadmins:!1},e.finish(12);case 15:return e.abrupt("return",this.$store.getters.getGroups[this.groups.length]);case 16:case"end":return e.stop()}}),e,this,[[1,9,12,15]])}))),function(e){return I.apply(this,arguments)}),addUserGroup:(T=Q(regeneratorRuntime.mark((function e(t){var s,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!1!==t.canAdd){e.next=2;break}return e.abrupt("return",!1);case 2:return this.loading.groups=!0,s=this.user.id,i=t.id,e.prev=5,e.next=8,this.$store.dispatch("addUserGroup",{userid:s,gid:i});case 8:e.next=13;break;case 10:e.prev=10,e.t0=e.catch(5),console.error(e.t0);case 13:return e.prev=13,this.loading.groups=!1,e.finish(13);case 16:case"end":return e.stop()}}),e,this,[[5,10,13,16]])}))),function(e){return T.apply(this,arguments)}),removeUserGroup:(E=Q(regeneratorRuntime.mark((function e(t){var s,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!1!==t.canRemove){e.next=2;break}return e.abrupt("return",!1);case 2:return this.loading.groups=!0,s=this.user.id,i=t.id,e.prev=5,e.next=8,this.$store.dispatch("removeUserGroup",{userid:s,gid:i});case 8:this.loading.groups=!1,this.$route.params.selectedGroup===i&&this.$store.commit("deleteUser",s),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(5),this.loading.groups=!1;case 15:case"end":return e.stop()}}),e,this,[[5,12]])}))),function(e){return E.apply(this,arguments)}),addUserSubAdmin:(j=Q(regeneratorRuntime.mark((function e(t){var s,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.loading.subadmins=!0,s=this.user.id,i=t.id,e.prev=3,e.next=6,this.$store.dispatch("addUserSubAdmin",{userid:s,gid:i});case 6:this.loading.subadmins=!1,e.next=12;break;case 9:e.prev=9,e.t0=e.catch(3),console.error(e.t0);case 12:case"end":return e.stop()}}),e,this,[[3,9]])}))),function(e){return j.apply(this,arguments)}),removeUserSubAdmin:(F=Q(regeneratorRuntime.mark((function e(t){var s,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.loading.subadmins=!0,s=this.user.id,i=t.id,e.prev=3,e.next=6,this.$store.dispatch("removeUserSubAdmin",{userid:s,gid:i});case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(3),console.error(e.t0);case 11:return e.prev=11,this.loading.subadmins=!1,e.finish(11);case 14:case"end":return e.stop()}}),e,this,[[3,8,11,14]])}))),function(e){return F.apply(this,arguments)}),setUserQuota:(R=Q(regeneratorRuntime.mark((function e(){var t,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=s.length>0&&void 0!==s[0]?s[0]:"none",this.loading.quota=!0,t=t.id?t.id:t,e.prev=3,e.next=6,this.$store.dispatch("setUserData",{userid:this.user.id,key:"quota",value:t});case 6:e.next=11;break;case 8:e.prev=8,e.t0=e.catch(3),console.error(e.t0);case 11:return e.prev=11,this.loading.quota=!1,e.finish(11);case 14:return e.abrupt("return",t);case 15:case"end":return e.stop()}}),e,this,[[3,8,11,14]])}))),function(){return R.apply(this,arguments)}),validateQuota:function(e){var t=OC.Util.computerFileSize(e);return null!==t&&t>=0&&this.setUserQuota(OC.Util.humanFileSize(OC.Util.computerFileSize(e)))},setUserLanguage:(z=Q(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.loading.languages=!0,e.prev=1,e.next=4,this.$store.dispatch("setUserData",{userid:this.user.id,key:"language",value:t.code});case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),console.error(e.t0);case 9:return e.prev=9,this.loading.languages=!1,e.finish(9);case 12:return e.abrupt("return",t);case 13:case"end":return e.stop()}}),e,this,[[1,6,9,12]])}))),function(e){return z.apply(this,arguments)}),sendWelcomeMail:function(){var e=this;this.loading.all=!0,this.$store.dispatch("sendWelcomeMail",this.user.id).then((function(s){s&&(e.feedbackMessage=t("setting","Welcome mail sent!"),setTimeout((function(){e.feedbackMessage=""}),2e3)),e.loading.all=!1}))}}},Y=(i(583),Object(P.a)(W,(function(){var e=this,t=e.$createElement,s=e._self._c||t;return 1===Object.keys(e.user).length?s("div",{staticClass:"row",attrs:{"data-id":e.user.id}},[s("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():s("img",{attrs:{src:e.generateAvatar(e.user.id,32),srcset:e.generateAvatar(e.user.id,64)+" 2x, "+e.generateAvatar(e.user.id,128)+" 4x",alt:"",height:"32",width:"32"}})]),e._v(" "),s("div",{staticClass:"name"},[e._v("\n\t\t"+e._s(e.user.id)+"\n\t")]),e._v(" "),s("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?s("div",{staticClass:"row row--editable",class:{disabled:e.loading.delete||e.loading.disable,"row--menu-opened":e.openedMenu},attrs:{"data-id":e.user.id}},[s("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():s("img",{attrs:{src:e.generateAvatar(e.user.id,32),srcset:e.generateAvatar(e.user.id,64)+" 2x, "+e.generateAvatar(e.user.id,128)+" 4x",alt:"",height:"32",width:"32"}})]),e._v(" "),s("div",{staticClass:"displayName"},[s("form",{staticClass:"displayName",class:{"icon-loading-small":e.loading.displayName},on:{submit:function(t){return t.preventDefault(),e.updateDisplayName(t)}}},[e.user.backendCapabilities.setDisplayName?[e.user.backendCapabilities.setDisplayName?s("input",{ref:"displayName",attrs:{id:"displayName"+e.user.id+e.rand,disabled:e.loading.displayName||e.loading.all,autocapitalize:"off",autocomplete:"new-password",autocorrect:"off",spellcheck:"false",type:"text"},domProps:{value:e.user.displayname}}):e._e(),e._v(" "),e.user.backendCapabilities.setDisplayName?s("input",{staticClass:"icon-confirm",attrs:{type:"submit",value:""}}):e._e()]:s("div",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:e.t("settings","The backend does not support changing the display name"),expression:"t('settings', 'The backend does not support changing the display name')",modifiers:{auto:!0}}],staticClass:"name"})],2)]),e._v(" "),e.settings.canChangePassword&&e.user.backendCapabilities.setPassword?s("form",{staticClass:"password",class:{"icon-loading-small":e.loading.password},on:{submit:function(t){return t.preventDefault(),e.updatePassword(t)}}},[s("input",{ref:"password",attrs:{id:"password"+e.user.id+e.rand,disabled:e.loading.password||e.loading.all,minlength:e.minPasswordLength,placeholder:e.t("settings","Add new password"),autocapitalize:"off",autocomplete:"new-password",autocorrect:"off",required:"",spellcheck:"false",type:"password",value:""}}),e._v(" "),s("input",{staticClass:"icon-confirm",attrs:{type:"submit",value:""}})]):s("div"),e._v(" "),s("form",{staticClass:"mailAddress",class:{"icon-loading-small":e.loading.mailAddress},on:{submit:function(t){return t.preventDefault(),e.updateEmail(t)}}},[s("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(" "),s("input",{staticClass:"icon-confirm",attrs:{type:"submit",value:""}})]),e._v(" "),s("div",{staticClass:"groups",class:{"icon-loading-small":e.loading.groups}},[s("Multiselect",{staticClass:"multiselect-vue",attrs:{"close-on-select":!1,disabled:e.loading.groups||e.loading.all,limit:2,multiple:!0,options:e.availableGroups,placeholder:e.t("settings","Add user in 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}},[s("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?s("div",{staticClass:"subadmins",class:{"icon-loading-small":e.loading.subadmins}},[s("Multiselect",{staticClass:"multiselect-vue",attrs:{"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}},[s("span",{attrs:{slot:"noResult"},slot:"noResult"},[e._v(e._s(e.t("settings","No results")))])])],1):e._e(),e._v(" "),s("div",{directives:[{name:"tooltip",rawName:"v-tooltip.auto",value:e.usedSpace,expression:"usedSpace",modifiers:{auto:!0}}],staticClass:"quota",class:{"icon-loading-small":e.loading.quota}},[s("Multiselect",{staticClass:"multiselect-vue",attrs:{"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?s("div",{staticClass:"languages",class:{"icon-loading-small":e.loading.languages}},[s("Multiselect",{staticClass:"multiselect-vue",attrs:{"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(" "),e.showConfig.showStoragePath||e.showConfig.showUserBackend?s("div",{staticClass:"storageLocation"}):e._e(),e._v(" "),e.showConfig.showLastLogin?s("div"):e._e(),e._v(" "),s("div",{staticClass:"userActions"},[e.OC.currentUser===e.user.id||"admin"===e.user.id||e.loading.all?e._e():s("div",{staticClass:"toggleUserActions"},[s("Actions",[s("ActionButton",{attrs:{icon:"icon-checkmark"},on:{click:function(t){e.editing=!1}}},[e._v("\n\t\t\t\t\t"+e._s(e.t("settings","Done"))+"\n\t\t\t\t")])],1),e._v(" "),s("div",{directives:[{name:"click-outside",rawName:"v-click-outside",value:e.hideMenu,expression:"hideMenu"}],staticClass:"icon-more",on:{click:e.toggleMenu}}),e._v(" "),s("div",{staticClass:"popovermenu",class:{open:e.openedMenu}},[s("PopoverMenu",{attrs:{menu:e.userActions}})],1)],1),e._v(" "),s("div",{staticClass:"feedback",style:{opacity:""!==e.feedbackMessage?1:0}},[s("div",{staticClass:"icon-checkmark"}),e._v("\n\t\t\t"+e._s(e.feedbackMessage)+"\n\t\t")])])]):s("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},on:{"update:editing":function(t){e.editing=t},hideMenu:e.hideMenu,toggleMenu:e.toggleMenu}})}),[],!1,null,"7696efa2",null).exports),H=i(585),J=i.n(H),Z={id:"none",label:t("settings","Unlimited")},K={id:"default",label:t("settings","Default quota")},V={id:"",displayName:"",password:"",mailAddress:"",groups:[],subAdminsGroups:[],quota:K,language:{code:"en",name:t("settings","Default language")}},X={name:"UserList",components:{userRow:Y,Multiselect:N.Multiselect,InfiniteLoading:J.a,Actions:N.Actions,ActionButton:N.ActionButton},props:{users:{type:Array,default:function(){return[]}},showConfig:{type:Object,required:!0},selectedGroup:{type:String,default:null},externalActions:{type:Array,default:function(){return[]}}},data:function(){return{unlimitedQuota:Z,defaultQuota:K,loading:{all:!1,groups:!1},scrolled:!1,searchQuery:"",newUser:Object.assign({},V)}},computed:{settings:function(){return this.$store.getters.getServerData},filteredUsers:function(){return"disabled"===this.selectedGroup?this.users.filter((function(e){return!1===e.enabled})):this.settings.isAdmin?this.users.filter((function(e){return!1!==e.enabled})):this.users.filter((function(e){return!1!==e.enabled&&e.id!==OC.getCurrentUser().uid}))},groups:function(){return this.$store.getters.getGroups.filter((function(e){return"disabled"!==e.id})).sort((function(e,t){return e.name.localeCompare(t.name)}))},canAddGroups:function(){return this.groups.map((function(e){return(e=Object.assign({},e)).$isDisabled=!1===e.canAdd,e}))},subAdminsGroups:function(){return this.$store.getters.getSubadminGroups},quotaOptions:function(){var e=this.settings.quotaPreset.reduce((function(e,t){return e.concat({id:t,label:t})}),[]);return e.unshift(this.unlimitedQuota),e.unshift(this.defaultQuota),e},minPasswordLength:function(){return this.$store.getters.getPasswordPolicyMinLength},usersOffset:function(){return this.$store.getters.getUsersOffset},usersLimit:function(){return this.$store.getters.getUsersLimit},usersCount:function(){return this.users.length},languages:function(){return[{label:t("settings","Common languages"),languages:this.settings.languages.commonlanguages},{label:t("settings","All languages"),languages:this.settings.languages.languages}]}},watch:{selectedGroup:function(e,t){this.redirectIfDisabled(),this.$store.commit("resetUsers"),this.$refs.infiniteLoading.stateChanger.reset(),this.setNewUserDefaultGroup(e)},usersCount:function(e,t){0===e&&1===t?this.$refs.infiniteLoading.stateChanger.reset():1===e&&0===t&&this.$refs.infiniteLoading.stateChanger.loaded()}},mounted:function(){this.settings.canChangePassword||OC.Notification.showTemporary(t("settings","Password change is disabled because the master key is disabled")),this.resetForm(),this.userSearch=new OCA.Search(this.search,this.resetSearch),this.redirectIfDisabled()},methods:{onScroll:function(e){this.scrolled=e.target.scrollTo>0},validateQuota:function(e){var 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:function(e){this.$store.dispatch("getUsers",{offset:this.usersOffset,limit:this.usersLimit,group:"disabled"!==this.selectedGroup?this.selectedGroup:"",search:this.searchQuery}).then((function(t){t?e.loaded():e.complete()}))},search:function(e){this.searchQuery=e,this.$store.commit("resetUsers"),this.$refs.infiniteLoading.stateChanger.reset()},resetSearch:function(){this.search("")},resetForm:function(){this.newUser=Object.assign({},V),this.settings.defaultLanguage&&U.default.set(this.newUser.language,"code",this.settings.defaultLanguage),this.setNewUserDefaultGroup(this.selectedGroup),this.loading.all=!1},createUser:function(){var e=this;this.loading.all=!0,this.$store.dispatch("addUser",{userid:this.newUser.id,password:this.newUser.password,displayName:this.newUser.displayName,email:this.newUser.mailAddress,groups:this.newUser.groups.map((function(e){return e.id})),subadmin:this.newUser.subAdminsGroups.map((function(e){return e.id})),quota:this.newUser.quota.id,language:this.newUser.language.code}).then((function(){e.resetForm(),e.$refs.newusername.focus()})).catch((function(t){if(e.loading.all=!1,t.response&&t.response.data&&t.response.data.ocs&&t.response.data.ocs.meta){var s=t.response.data.ocs.meta.statuscode;102===s?e.$refs.newusername.focus():107===s&&e.$refs.newuserpassword.focus()}}))},setNewUserDefaultGroup:function(e){if(e&&e.length>0){var t=this.groups.find((function(t){return t.id===e}));if(t)return void(this.newUser.groups=[t])}this.newUser.groups=[]},createGroup:function(e){var t=this;return this.loading.groups=!0,this.$store.dispatch("addGroup",e).then((function(s){t.newUser.groups.push(t.groups.find((function(t){return t.id===e}))),t.loading.groups=!1})).catch((function(){t.loading.groups=!1})),this.$store.getters.getGroups[this.groups.length]},redirectIfDisabled:function(){var e=this.$store.getters.getGroups;"disabled"===this.selectedGroup&&e.findIndex((function(e){return"disabled"===e.id&&0===e.usercount}))>-1&&(this.$router.push({name:"users"}),this.$refs.infiniteLoading.stateChanger.reset())},onClose:function(){this.showConfig.showNewUserForm=!1}}},ee=Object(P.a)(X,(function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("div",{staticClass:"user-list-grid",attrs:{id:"app-content"},on:{"&scroll":function(t){return e.onScroll(t)}}},[s("form",{directives:[{name:"show",rawName:"v-show",value:e.showConfig.showNewUserForm,expression:"showConfig.showNewUserForm"}],staticClass:"row",class:{sticky:e.scrolled&&e.showConfig.showNewUserForm},attrs:{id:"new-user",disabled:e.loading.all},on:{submit:function(t){return t.preventDefault(),e.createUser(t)}}},[s("div",{class:e.loading.all?"icon-loading-small":"icon-add"}),e._v(" "),s("div",{staticClass:"name"},[s("input",{directives:[{name:"model",rawName:"v-model",value:e.newUser.id,expression:"newUser.id"}],ref:"newusername",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(" "),s("div",{staticClass:"displayName"},[s("input",{directives:[{name:"model",rawName:"v-model",value:e.newUser.displayName,expression:"newUser.displayName"}],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(" "),s("div",{staticClass:"password"},[s("input",{directives:[{name:"model",rawName:"v-model",value:e.newUser.password,expression:"newUser.password"}],ref:"newuserpassword",attrs:{id:"newuserpassword",minlength:e.minPasswordLength,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(" "),s("div",{staticClass:"mailAddress"},[s("input",{directives:[{name:"model",rawName:"v-model",value:e.newUser.mailAddress,expression:"newUser.mailAddress"}],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(" "),s("div",{staticClass:"groups"},[e.settings.isAdmin?e._e():s("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(" "),s("Multiselect",{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 in 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"}},[s("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?s("div",{staticClass:"subadmins"},[s("Multiselect",{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"}},[s("span",{attrs:{slot:"noResult"},slot:"noResult"},[e._v(e._s(e.t("settings","No results")))])])],1):e._e(),e._v(" "),s("div",{staticClass:"quota"},[s("Multiselect",{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?s("div",{staticClass:"languages"},[s("Multiselect",{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?s("div",{staticClass:"storageLocation"}):e._e(),e._v(" "),e.showConfig.showUserBackend?s("div",{staticClass:"userBackend"}):e._e(),e._v(" "),e.showConfig.showLastLogin?s("div",{staticClass:"lastLogin"}):e._e(),e._v(" "),s("div",{staticClass:"userActions"},[s("input",{staticClass:"button primary icon-checkmark-white has-tooltip",attrs:{id:"newsubmit",title:e.t("settings","Add a new user"),type:"submit",value:""}}),e._v(" "),s("div",{staticClass:"closeButton"},[s("Actions",[s("ActionButton",{attrs:{icon:"icon-close"},on:{click:e.onClose}},[e._v("\n\t\t\t\t\t\t"+e._s(e.t("settings","Close"))+"\n\t\t\t\t\t")])],1)],1)])]),e._v(" "),s("div",{staticClass:"row",class:{sticky:e.scrolled&&!e.showConfig.showNewUserForm},attrs:{id:"grid-header"}},[s("div",{staticClass:"avatar",attrs:{id:"headerAvatar"}}),e._v(" "),s("div",{staticClass:"name",attrs:{id:"headerName"}},[e._v("\n\t\t\t"+e._s(e.t("settings","Username"))+"\n\n\t\t\t"),s("div",{staticClass:"subtitle"},[e._v("\n\t\t\t\t"+e._s(e.t("settings","Display name"))+"\n\t\t\t")])]),e._v(" "),s("div",{staticClass:"password",attrs:{id:"headerPassword"}},[e._v("\n\t\t\t"+e._s(e.t("settings","Password"))+"\n\t\t")]),e._v(" "),s("div",{staticClass:"mailAddress",attrs:{id:"headerAddress"}},[e._v("\n\t\t\t"+e._s(e.t("settings","Email"))+"\n\t\t")]),e._v(" "),s("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?s("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(" "),s("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?s("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?s("div",{staticClass:"headerUserBackend userBackend"},[e.showConfig.showUserBackend?s("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?s("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?s("div",{staticClass:"headerLastLogin lastLogin"},[e._v("\n\t\t\t"+e._s(e.t("settings","Last login"))+"\n\t\t")]):e._e(),e._v(" "),s("div",{staticClass:"userActions"})]),e._v(" "),e._l(e.filteredUsers,(function(t,i){return s("user-row",{key:i,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:t}})})),e._v(" "),s("InfiniteLoading",{ref:"infiniteLoading",on:{infinite:e.infiniteHandler}},[s("div",{attrs:{slot:"spinner"},slot:"spinner"},[s("div",{staticClass:"users-icon-loading icon-loading"})]),e._v(" "),s("div",{attrs:{slot:"no-more"},slot:"no-more"},[s("div",{staticClass:"users-list-end"})]),e._v(" "),s("div",{attrs:{slot:"no-results"},slot:"no-results"},[s("div",{attrs:{id:"emptycontent"}},[s("div",{staticClass:"icon-contacts-dark"}),e._v(" "),s("h2",[e._v(e._s(e.t("settings","No users in here")))])])])])],2)}),[],!1,null,null,null).exports;function te(e,t,s,i,a,n,r){try{var o=e[n](r),u=o.value}catch(e){return void s(e)}o.done?t(u):Promise.resolve(u).then(i,a)}function se(e){return(se="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}U.default.use(L.a);var ie={name:"Users",components:{ActionButton:n.a,AppContent:o.a,AppNavigation:l.a,AppNavigationCaption:c.a,AppNavigationCounter:p.a,AppNavigationItem:m.a,AppNavigationNew:v.a,AppNavigationSettings:b.a,Content:y.a,Multiselect:A.a,UserList:ee},props:{selectedGroup:{type:String,default:null}},data:function(){return{unlimitedQuota:{id:"none",label:t("settings","Unlimited")},selectedQuota:!1,externalActions:[],loadingAddGroup:!1,showConfig:{showStoragePath:!1,showUserBackend:!1,showLastLogin:!1,showNewUserForm:!1,showLanguages:!1}}},computed:{users:function(){return this.$store.getters.getUsers},groups:function(){return this.$store.getters.getGroups},usersOffset:function(){return this.$store.getters.getUsersOffset},usersLimit:function(){return this.$store.getters.getUsersLimit},showLanguages:{get:function(){return this.getLocalstorage("showLanguages")},set:function(e){this.setLocalStorage("showLanguages",e)}},showLastLogin:{get:function(){return this.getLocalstorage("showLastLogin")},set:function(e){this.setLocalStorage("showLastLogin",e)}},showUserBackend:{get:function(){return this.getLocalstorage("showUserBackend")},set:function(e){this.setLocalStorage("showUserBackend",e)}},showStoragePath:{get:function(){return this.getLocalstorage("showStoragePath")},set:function(e){this.setLocalStorage("showStoragePath",e)}},userCount:function(){return this.$store.getters.getUserCount},settings:function(){return this.$store.getters.getServerData},quotaOptions:function(){var e=this.settings.quotaPreset.reduce((function(e,t){return e.concat({id:t,label:t})}),[]);return e.unshift(this.unlimitedQuota),e},defaultQuota:{get:function(){return!1!==this.selectedQuota?this.selectedQuota:this.settings.defaultQuota!==this.unlimitedQuota.id&&OC.Util.computerFileSize(this.settings.defaultQuota)>=0?{id:this.settings.defaultQuota,label:this.settings.defaultQuota}:this.unlimitedQuota},set:function(e){this.selectedQuota=e}},groupList:function(){var e=this;return(Array.isArray(this.groups)?this.groups:[]).filter((function(e){return"disabled"!==e.id&&"admin"!==e.id})).map((function(t){return e.formatGroupMenu(t)}))},adminGroupMenu:function(){return this.formatGroupMenu(this.groups.find((function(e){return"admin"===e.id})))},disabledGroupMenu:function(){return this.formatGroupMenu(this.groups.find((function(e){return"disabled"===e.id})))}},beforeMount:function(){this.$store.commit("initGroups",{groups:this.$store.getters.getServerData.groups,orderBy:this.$store.getters.getServerData.sortGroups,userCount:this.$store.getters.getServerData.userCount}),this.$store.dispatch("getPasswordPolicyMinLength")},created:function(){Object.assign(OCA,{Settings:{UserList:{registerAction:this.registerAction}}})},methods:{toggleNewUserMenu:function(){this.showConfig.showNewUserForm=!this.showConfig.showNewUserForm,this.showConfig.showNewUserForm&&U.default.nextTick((function(){window.newusername.focus()}))},getLocalstorage:function(e){var t=this.$localStorage.get(e);return this.showConfig[e]=null!==t?"true"===t:this.showConfig[e],this.showConfig[e]},setLocalStorage:function(e,t){return this.showConfig[e]=t,this.$localStorage.set(e,t),t},removeGroup:function(e){var 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)}))},setDefaultQuota:function(){var e=this,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((function(){"object"!==se(t)&&(t={id:t,label:t}),e.defaultQuota=t}))},validateQuota:function(e){return null===OC.Util.computerFileSize(e)?this.setDefaultQuota("none"):this.setDefaultQuota(OC.Util.humanFileSize(OC.Util.computerFileSize(e)))},registerAction:function(e,t,s){return this.externalActions.push({icon:e,text:t,action:s}),this.externalActions},createGroup:function(){var e,t=(e=regeneratorRuntime.mark((function e(t){var s=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(""!==t.trim()){e.next=3;break}return U.default.nextTick((function(){s.toggleAddGroupEntry(!0)})),e.abrupt("return");case 3:return e.prev=3,this.loadingAddGroup=!0,e.next=7,this.$store.dispatch("addGroup",t.trim());case 7:this.toggleAddGroupEntry(!1),this.$router.push({name:"group",params:{selectedGroup:t.trim()}}),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(3),this.toggleAddGroupEntry(!0);case 14:return e.prev=14,this.loadingAddGroup=!1,e.finish(14);case 17:case"end":return e.stop()}}),e,this,[[3,11,14,17]])})),function(){var t=this,s=arguments;return new Promise((function(i,a){var n=e.apply(t,s);function r(e){te(n,i,a,r,o,"next",e)}function o(e){te(n,i,a,r,o,"throw",e)}r(void 0)}))});return function(e){return t.apply(this,arguments)}}(),toggleAddGroupEntry:function(e){var t=this;void 0===e&&(e=!this.$refs.addGroup.editing),this.$refs.addGroup.editing=e,U.default.nextTick((function(){if(t.$refs.addGroup.$el){var e=t.$refs.addGroup.$el.querySelector('form > input[type="text"]');e&&e.focus()}}))},formatGroupMenu:function(e){var t={};return t.id=e.id.replace(" ","_"),t.title=e.name,t.usercount=e.usercount,e.usercount-e.disabled>0&&(t.count=e.usercount-e.disabled),t}}},ae=(i(586),Object(P.a)(ie,(function(){var e=this,t=e.$createElement,s=e._self._c||t;return s("Content",{attrs:{"app-name":"settings","navigation-class":{"icon-loading":e.loadingAddGroup}}},[s("AppNavigation",[s("AppNavigationNew",{attrs:{"button-id":"new-user-button",text:e.t("settings","New user"),"button-class":"icon-add"},on:{click:e.toggleNewUserMenu}}),e._v(" "),s("ul",{attrs:{id:"usergrouplist"}},[s("AppNavigationItem",{ref:"addGroup",attrs:{id:"addgroup","edit-placeholder":e.t("settings","Enter group name"),editable:!0,loading:e.loadingAddGroup,title:e.t("settings","Add group"),icon:"icon-add"},on:{click:function(t){return e.toggleAddGroupEntry(!0)},"update:title":e.createGroup}}),e._v(" "),s("AppNavigationItem",{attrs:{id:"everyone",exact:!0,title:e.t("settings","Everyone"),to:{name:"users"},icon:"icon-contacts-dark"}},[e.userCount>0?s("AppNavigationCounter",{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(" "),s("AppNavigationItem",{attrs:{id:"admin",exact:!0,title:e.t("settings","Admins"),to:{name:"users",params:{selectedGroup:"admin"}},icon:"icon-user-admin"}},[e.adminGroupMenu.count?s("AppNavigationCounter",{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._v(" "),e.disabledGroupMenu.usercount>0||-1===e.disabledGroupMenu.usercount?s("AppNavigationItem",{attrs:{id:"disabled",exact:!0,title:e.t("settings","Disabled users"),to:{name:"users",params:{selectedGroup:"disabled"}},icon:"icon-disabled-users"}},[e.disabledGroupMenu.usercount>0?s("AppNavigationCounter",{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?s("AppNavigationCaption",{attrs:{title:e.t("settings","Groups")}}):e._e(),e._v(" "),e._l(e.groupList,(function(t){return s("AppNavigationItem",{key:t.id,attrs:{id:t.id,exact:!0,title:t.title,to:{name:"users",params:{selectedGroup:t.id}}}},[t.count?s("AppNavigationCounter",{attrs:{slot:"counter"},slot:"counter"},[e._v("\n\t\t\t\t\t"+e._s(t.count)+"\n\t\t\t\t")]):e._e(),e._v(" "),s("template",{slot:"actions"},["admin"!==t.id&&"disabled"!==t.id&&e.settings.isAdmin?s("ActionButton",{attrs:{icon:"icon-delete"},on:{click:function(s){return e.removeGroup(t.id)}}},[e._v("\n\t\t\t\t\t\t"+e._s(e.t("settings","Remove group"))+"\n\t\t\t\t\t")]):e._e()],1)],2)}))],2),e._v(" "),s("AppNavigationSettings",[s("div",[s("p",[e._v(e._s(e.t("settings","Default quota:")))]),e._v(" "),s("Multiselect",{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(" "),s("div",[s("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,i=t.target,a=!!i.checked;if(Array.isArray(s)){var n=e._i(s,null);i.checked?n<0&&(e.showLanguages=s.concat([null])):n>-1&&(e.showLanguages=s.slice(0,n).concat(s.slice(n+1)))}else e.showLanguages=a}}}),e._v(" "),s("label",{attrs:{for:"showLanguages"}},[e._v(e._s(e.t("settings","Show Languages")))])]),e._v(" "),s("div",[s("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,i=t.target,a=!!i.checked;if(Array.isArray(s)){var n=e._i(s,null);i.checked?n<0&&(e.showLastLogin=s.concat([null])):n>-1&&(e.showLastLogin=s.slice(0,n).concat(s.slice(n+1)))}else e.showLastLogin=a}}}),e._v(" "),s("label",{attrs:{for:"showLastLogin"}},[e._v(e._s(e.t("settings","Show last login")))])]),e._v(" "),s("div",[s("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,i=t.target,a=!!i.checked;if(Array.isArray(s)){var n=e._i(s,null);i.checked?n<0&&(e.showUserBackend=s.concat([null])):n>-1&&(e.showUserBackend=s.slice(0,n).concat(s.slice(n+1)))}else e.showUserBackend=a}}}),e._v(" "),s("label",{attrs:{for:"showUserBackend"}},[e._v(e._s(e.t("settings","Show user backend")))])]),e._v(" "),s("div",[s("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,i=t.target,a=!!i.checked;if(Array.isArray(s)){var n=e._i(s,null);i.checked?n<0&&(e.showStoragePath=s.concat([null])):n>-1&&(e.showStoragePath=s.slice(0,n).concat(s.slice(n+1)))}else e.showStoragePath=a}}}),e._v(" "),s("label",{attrs:{for:"showStoragePath"}},[e._v(e._s(e.t("settings","Show storage path")))])])])],1),e._v(" "),s("AppContent",[s("UserList",{attrs:{users:e.users,"show-config":e.showConfig,"selected-group":e.selectedGroup,"external-actions":e.externalActions},scopedSlots:e._u([{key:"content",fn:function(){},proxy:!0}])})],1)],1)}),[],!1,null,"96b08c5e",null));s.default=ae.exports}}]);
//# sourceMappingURL=vue-5.js.map?v=fd9e3bd858d1ac10bc23