diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2019-07-03 10:10:56 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2019-07-09 13:57:04 +0200 |
commit | d058ef2b6c6b3faf354fd8abeecb4cd71949d5a6 (patch) | |
tree | 34275b1f142f429f8c8982f7a79cc2327ee1c0b7 /settings/src | |
parent | 1c261675ad3da9804bd9a8c88326103eb2f56bd3 (diff) | |
download | nextcloud-server-d058ef2b6c6b3faf354fd8abeecb4cd71949d5a6.tar.gz nextcloud-server-d058ef2b6c6b3faf354fd8abeecb4cd71949d5a6.zip |
Make it possible to wipe all tokens/devices of a user
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'settings/src')
-rw-r--r-- | settings/src/components/userList/userRow.vue | 48 | ||||
-rw-r--r-- | settings/src/store/users.js | 14 |
2 files changed, 48 insertions, 14 deletions
diff --git a/settings/src/components/userList/userRow.vue b/settings/src/components/userList/userRow.vue index aa6fb230ad7..4bcc40965b0 100644 --- a/settings/src/components/userList/userRow.vue +++ b/settings/src/components/userList/userRow.vue @@ -23,10 +23,10 @@ <template> <!-- Obfuscated user: Logged in user does not have permissions to see all of the data --> <div class="row" v-if="Object.keys(user).length ===1" :data-id="user.id"> - <div class="avatar" :class="{'icon-loading-small': loading.delete || loading.disable}"> + <div class="avatar" :class="{'icon-loading-small': loading.delete || loading.disable || loading.wipe}"> <img alt="" width="32" height="32" :src="generateAvatar(user.id, 32)" :srcset="generateAvatar(user.id, 64)+' 2x, '+generateAvatar(user.id, 128)+' 4x'" - v-if="!loading.delete && !loading.disable"> + v-if="!loading.delete && !loading.disable && !loading.wipe"> </div> <div class="name">{{user.id}}</div> <div class="obfuscated">{{t('settings','You do not have permissions to see the details of this user')}}</div> @@ -34,10 +34,10 @@ <!-- User full data --> <div class="row" v-else :class="{'disabled': loading.delete || loading.disable}" :data-id="user.id"> - <div class="avatar" :class="{'icon-loading-small': loading.delete || loading.disable}"> + <div class="avatar" :class="{'icon-loading-small': loading.delete || loading.disable || loading.wipe}"> <img alt="" width="32" height="32" :src="generateAvatar(user.id, 32)" :srcset="generateAvatar(user.id, 64)+' 2x, '+generateAvatar(user.id, 128)+' 4x'" - v-if="!loading.delete && !loading.disable"> + v-if="!loading.delete && !loading.disable && !loading.wipe"> </div> <!-- dirty hack to ellipsis on two lines --> <div class="name">{{user.id}}</div> @@ -165,22 +165,31 @@ export default { quota: false, delete: false, disable: false, - languages: false + languages: false, + wipe: false, } } }, computed: { /* USER POPOVERMENU ACTIONS */ userActions() { - let actions = [{ - 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 - }]; + let actions = [ + { + 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, + }, + ]; if (this.user.email !== null && this.user.email !== '') { actions.push({ icon: 'icon-mail', @@ -308,6 +317,17 @@ export default { return names.slice(2,).join(', '); }, + wipeUserDevices() { + this.loading.wipe = true; + this.loading.all = true; + let userid = this.user.id; + return this.$store.dispatch('wipeUserDevices', userid) + .then(() => { + this.loading.wipe = false + this.loading.all = false + }); + }, + deleteUser() { this.loading.delete = true; this.loading.all = true; diff --git a/settings/src/store/users.js b/settings/src/store/users.js index 261c5baee69..1b174b21bf4 100644 --- a/settings/src/store/users.js +++ b/settings/src/store/users.js @@ -398,6 +398,20 @@ const actions = { }, /** + * Mark all user devices for remote wipe + * + * @param {Object} context + * @param {string} userid User id + * @returns {Promise} + */ + wipeUserDevices(context, userid) { + return api.requireAdmin().then((response) => { + return api.post(OC.linkToOCS(`cloud/users/${userid}/wipe`, 2)) + .catch((error) => {throw error;}); + }).catch((error) => context.commit('API_FAILURE', { userid, error })); + }, + + /** * Delete a user * * @param {Object} context |