2019-05-07 19:42:03 +03:00
|
|
|
(window.webpackJsonp=window.webpackJsonp||[]).push([[7],{77:function(e,s,a){"use strict";a.r(s);var i=a(17),n=a(67),o=a.n(n),r=a(2),u=a(39);function l(e){return(l="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)}r.a.use(u.a);var d={name:"userRow",props:["user","settings","groups","subAdminsGroups","quotaOptions","showConfig","languages","externalActions"],components:{PopoverMenu:i.PopoverMenu,Multiselect:i.Multiselect},directives:{ClickOutside:o.a},mounted:function(){},data:function(){return{rand:parseInt(1e3*Math.random()),openedMenu:!1,feedbackMessage:"",loading:{all:!1,displayName:!1,password:!1,mailAddress:!1,groups:!1,subadmins:!1,quota:!1,delete:!1,disable:!1,languages:!1}}},computed:{userActions:function(){var e=[{icon:"icon-delete",text:t("settings","Delete user"),action:this.deleteUser},{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)},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"!==l(t)&&""!==this.user.language?{code:this.user.language,name:this.user.language}:""!==this.user.language&&t}},methods:{toggleMenu:function(){this.openedMenu=!this.openedMenu},hideMenu:function(){this.openedMenu=!1},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})},formatGroupsTitle:function(e){return e.map(function(e){return e.name}).slice(2).join(", ")},deleteUser:function(){var e=this;this.loading.delete=!0,this.loading.all=!0;var t=this.user.id;return this.$store.dispatch("deleteUser",t).then(function(){e.loading.delete=!1,e.loading.all=!1})},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.passwo
|