2026-06-10 01:58:49 +03:00
|
|
|
import { last } from 'lodash'
|
|
|
|
|
|
|
|
|
|
import ConfirmModal from 'src/components/confirm_modal/confirm_modal.vue'
|
2026-06-04 21:56:25 +03:00
|
|
|
import Popover from 'src/components/popover/popover.vue'
|
2019-02-18 17:49:32 +03:00
|
|
|
|
2026-06-10 01:58:49 +03:00
|
|
|
import { useAdminSettingsStore } from 'src/stores/admin_settings.js'
|
2026-01-29 20:40:00 +02:00
|
|
|
import { useInstanceStore } from 'src/stores/instance.js'
|
2026-02-05 00:28:45 +02:00
|
|
|
import { useInstanceCapabilitiesStore } from 'src/stores/instance_capabilities.js'
|
2026-01-29 20:40:00 +02:00
|
|
|
|
2026-01-08 17:26:52 +02:00
|
|
|
import { library } from '@fortawesome/fontawesome-svg-core'
|
|
|
|
|
import { faChevronDown } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
|
|
2021-03-15 17:41:34 +03:00
|
|
|
library.add(faChevronDown)
|
|
|
|
|
|
2019-02-18 17:49:32 +03:00
|
|
|
const FORCE_NSFW = 'mrf_tag:media-force-nsfw'
|
|
|
|
|
const STRIP_MEDIA = 'mrf_tag:media-strip'
|
|
|
|
|
const FORCE_UNLISTED = 'mrf_tag:force-unlisted'
|
|
|
|
|
const DISABLE_REMOTE_SUBSCRIPTION = 'mrf_tag:disable-remote-subscription'
|
|
|
|
|
const DISABLE_ANY_SUBSCRIPTION = 'mrf_tag:disable-any-subscription'
|
|
|
|
|
const SANDBOX = 'mrf_tag:sandbox'
|
|
|
|
|
const QUARANTINE = 'mrf_tag:quarantine'
|
2026-06-10 01:58:49 +03:00
|
|
|
const TAGS = new Set([
|
|
|
|
|
FORCE_NSFW,
|
|
|
|
|
STRIP_MEDIA,
|
|
|
|
|
FORCE_UNLISTED,
|
|
|
|
|
DISABLE_REMOTE_SUBSCRIPTION,
|
|
|
|
|
DISABLE_ANY_SUBSCRIPTION,
|
|
|
|
|
SANDBOX,
|
|
|
|
|
QUARANTINE,
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
const ENTRIES = [
|
|
|
|
|
{
|
|
|
|
|
check: '!state:activated',
|
|
|
|
|
label: 'user_card.admin_menu.activate_account',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
check: 'state:activated',
|
|
|
|
|
label: 'user_card.admin_menu.deactivate_account',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
separator: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
check: '!state:confirmed',
|
|
|
|
|
label: 'user_card.admin_menu.confirm_account',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
check: 'action:resend_confirmation',
|
|
|
|
|
conditions: ['!state:confirmed'],
|
|
|
|
|
label: 'user_card.admin_menu.resend_confirmation',
|
|
|
|
|
},
|
|
|
|
|
// No API for revocation
|
|
|
|
|
// {
|
|
|
|
|
// check: 'state:confirmed',
|
|
|
|
|
// label: 'user_card.admin_menu.unconfirm_account',
|
|
|
|
|
// },
|
|
|
|
|
{
|
|
|
|
|
check: '!state:approved',
|
|
|
|
|
conditions: ['property:local'],
|
|
|
|
|
label: 'user_card.admin_menu.approve_account',
|
|
|
|
|
},
|
|
|
|
|
// No API for revocation
|
|
|
|
|
// {
|
|
|
|
|
// check: 'state:approved',
|
|
|
|
|
// label: 'user_card.admin_menu.unapprove_account',
|
|
|
|
|
// },
|
|
|
|
|
{
|
|
|
|
|
check: '!state:suggested',
|
|
|
|
|
// conditions: ['property:local'], // TODO Should we allow non-local users in suggested?
|
|
|
|
|
label: 'user_card.admin_menu.suggest_account',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
check: 'state:suggested',
|
|
|
|
|
label: 'user_card.admin_menu.remove_suggested_account',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
separator: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
2026-06-10 14:39:58 +03:00
|
|
|
check: 'action:disable_mfa',
|
2026-06-10 01:58:49 +03:00
|
|
|
label: 'user_card.admin_menu.disable_mfa',
|
|
|
|
|
},
|
|
|
|
|
{
|
2026-06-10 14:39:58 +03:00
|
|
|
check: 'action:require_password_change',
|
2026-06-10 01:58:49 +03:00
|
|
|
label: 'user_card.admin_menu.require_password_change',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
separator: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
check: '!rights:moderator',
|
|
|
|
|
label: 'user_card.admin_menu.grant_moderator',
|
|
|
|
|
conditions: ['property:local', 'state:activated'],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
check: 'rights:moderator',
|
|
|
|
|
label: 'user_card.admin_menu.revoke_moderator',
|
|
|
|
|
conditions: ['property:local', 'state:activated'],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
check: '!rights:admin',
|
|
|
|
|
label: 'user_card.admin_menu.grant_admin',
|
|
|
|
|
conditions: ['property:local', 'state:activated'],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
check: 'rights:admin',
|
|
|
|
|
label: 'user_card.admin_menu.revoke_admin',
|
|
|
|
|
conditions: ['property:local', 'state:activated'],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
separator: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
check: FORCE_NSFW,
|
|
|
|
|
label: 'user_card.admin_menu.force_nsfw',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
check: STRIP_MEDIA,
|
|
|
|
|
label: 'user_card.admin_menu.strip_media',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
check: FORCE_UNLISTED,
|
|
|
|
|
label: 'user_card.admin_menu.force_unlisted',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
check: SANDBOX,
|
|
|
|
|
label: 'user_card.admin_menu.sandbox',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
check: DISABLE_ANY_SUBSCRIPTION,
|
|
|
|
|
conditions: ['property:local'],
|
|
|
|
|
label: 'user_card.admin_menu.disable_any_subscription',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
check: DISABLE_REMOTE_SUBSCRIPTION,
|
|
|
|
|
conditions: ['property:local'],
|
|
|
|
|
label: 'user_card.admin_menu.disable_remote_subscription',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
check: QUARANTINE,
|
|
|
|
|
conditions: ['property:local'],
|
|
|
|
|
label: 'user_card.admin_menu.quarantine',
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
separator: true,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
check: 'action:delete',
|
|
|
|
|
label: 'user_card.admin_menu.delete_account',
|
|
|
|
|
},
|
|
|
|
|
]
|
2019-02-18 17:49:32 +03:00
|
|
|
|
|
|
|
|
const ModerationTools = {
|
2026-06-10 01:58:49 +03:00
|
|
|
props: {
|
|
|
|
|
users: {
|
|
|
|
|
type: Array,
|
|
|
|
|
required: true,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
if (this.users.length !== 1) return
|
|
|
|
|
useAdminSettingsStore().getUserData({ user: this.users[0] })
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
data() {
|
2019-02-18 17:49:32 +03:00
|
|
|
return {
|
2026-06-10 01:58:49 +03:00
|
|
|
open: false,
|
|
|
|
|
confirmDialogShow: false,
|
|
|
|
|
confirmDialogTitle: null,
|
|
|
|
|
confirmDialogContent: null,
|
|
|
|
|
confirmDialogConfirm: null,
|
|
|
|
|
confirmDialogAction: null,
|
|
|
|
|
confirmDialogGroup: null,
|
|
|
|
|
confirmDialogName: null,
|
2019-02-18 17:49:32 +03:00
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
components: {
|
2026-06-10 01:58:49 +03:00
|
|
|
ConfirmModal,
|
2026-01-06 16:22:52 +02:00
|
|
|
Popover,
|
2019-02-18 17:49:32 +03:00
|
|
|
},
|
|
|
|
|
computed: {
|
2026-06-10 01:58:49 +03:00
|
|
|
ready() {
|
|
|
|
|
return this.users.every((u) => u.adminData)
|
|
|
|
|
},
|
|
|
|
|
entries() {
|
|
|
|
|
return ENTRIES.map(({ check, label, separator, conditions }) => {
|
|
|
|
|
if (separator) return 'separator'
|
|
|
|
|
const [, negateToken, group, name] = /^([!~]?)([a-z-_]+):([a-z-_]+)$/.exec(
|
|
|
|
|
check,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const hasTag = this.tagsSet.has(`${group}:${name}`)
|
|
|
|
|
const noTag = this.tagsSet.has(`!${group}:${name}`)
|
|
|
|
|
const maybeTag = this.tagsSet.has(`~${group}:${name}`)
|
|
|
|
|
|
|
|
|
|
// We are checking for condition to show element, i.e. only show "activate" if user is "deactivated"
|
|
|
|
|
const checkNegated = (negateToken === '!' || negateToken === '~')
|
|
|
|
|
|
|
|
|
|
// Naturally, new value should also be the same
|
|
|
|
|
const value = checkNegated
|
|
|
|
|
|
|
|
|
|
const action = (() => {
|
|
|
|
|
switch (group) {
|
|
|
|
|
case 'rights':
|
|
|
|
|
return () => this.setRight(name, value)
|
|
|
|
|
case 'state':
|
|
|
|
|
return () => this.setStatus(name, value)
|
|
|
|
|
case 'mrf_tag':
|
|
|
|
|
return () => this.setTag(`${group}:${name}`, noTag)
|
|
|
|
|
case 'action': {
|
|
|
|
|
switch (name) {
|
|
|
|
|
case 'delete': {
|
|
|
|
|
return () => this.deleteUsers()
|
|
|
|
|
}
|
|
|
|
|
case 'resend_confirmation': {
|
|
|
|
|
return () => this.resendConfirmationEmail()
|
|
|
|
|
}
|
|
|
|
|
case 'disable_mfa': {
|
|
|
|
|
return () => this.disableMFA()
|
|
|
|
|
}
|
|
|
|
|
case 'require_password_change': {
|
|
|
|
|
return () => this.requirePasswordChange()
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
throw new Error(`Unknown action group: ${name}`)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
throw new Error(`Unknown moderation group: ${group}`)
|
|
|
|
|
}
|
|
|
|
|
})()
|
|
|
|
|
|
|
|
|
|
let checkboxClass = ''
|
|
|
|
|
if (maybeTag) {
|
|
|
|
|
checkboxClass = 'menu-checkbox-indeterminate'
|
|
|
|
|
} else if (hasTag) {
|
|
|
|
|
checkboxClass = 'menu-checkbox-checked'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
check,
|
|
|
|
|
negateToken,
|
|
|
|
|
checkbox: group === 'mrf_tag',
|
|
|
|
|
checkboxClass,
|
|
|
|
|
conditions,
|
|
|
|
|
group,
|
|
|
|
|
name,
|
|
|
|
|
action,
|
|
|
|
|
label,
|
|
|
|
|
value,
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.filter((entry) => {
|
|
|
|
|
if (entry === 'separator') return true
|
|
|
|
|
const { group, name, value, conditions } = entry
|
|
|
|
|
|
|
|
|
|
if (conditions) {
|
|
|
|
|
// Checking that all items match positive criteria
|
|
|
|
|
const positive = conditions.every((condition) =>
|
|
|
|
|
this.totalSet.has(condition),
|
|
|
|
|
)
|
|
|
|
|
// Checking that there are no items that don't match criteria
|
|
|
|
|
const negative = conditions.some((condition) =>
|
|
|
|
|
this.totalSet.has('!' + condition),
|
|
|
|
|
)
|
|
|
|
|
if (!(positive && !negative)) return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (group) {
|
|
|
|
|
case 'action': {
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
case 'rights': {
|
|
|
|
|
return this.canGrantRole(name, value)
|
|
|
|
|
}
|
|
|
|
|
case 'state': {
|
|
|
|
|
return this.canChangeState(name, value)
|
|
|
|
|
}
|
|
|
|
|
case 'mrf_tag': {
|
|
|
|
|
return this.canUseTagPolicy
|
|
|
|
|
}
|
|
|
|
|
default: {
|
|
|
|
|
throw new Error(`Unknown moderation group: ${group}`)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
.reduce((acc, entry, index) => {
|
|
|
|
|
if (entry === 'separator') {
|
|
|
|
|
if (
|
|
|
|
|
acc.length === 0 ||
|
|
|
|
|
last(acc) === 'separator' ||
|
|
|
|
|
index === ENTRIES.length - 1
|
|
|
|
|
) {
|
|
|
|
|
return acc
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return [...acc, entry]
|
|
|
|
|
}, [])
|
|
|
|
|
},
|
|
|
|
|
rightsSet() {
|
|
|
|
|
return this.users.reduce((acc, user) => {
|
|
|
|
|
if (user.rights.admin) {
|
|
|
|
|
acc.add('rights:admin')
|
|
|
|
|
} else {
|
|
|
|
|
acc.add('!rights:admin')
|
|
|
|
|
}
|
|
|
|
|
if (user.rights.moderator) {
|
|
|
|
|
acc.add('rights:moderator')
|
|
|
|
|
} else {
|
|
|
|
|
acc.add('!rights:moderator')
|
|
|
|
|
}
|
|
|
|
|
return acc
|
|
|
|
|
}, new Set())
|
|
|
|
|
},
|
|
|
|
|
stateSet() {
|
|
|
|
|
return this.users.reduce((acc, user) => {
|
|
|
|
|
if (!user.deactivated) {
|
|
|
|
|
acc.add('state:activated')
|
|
|
|
|
} else {
|
|
|
|
|
acc.add('!state:activated')
|
|
|
|
|
}
|
|
|
|
|
if (user.adminData?.is_confirmed) {
|
|
|
|
|
acc.add('state:confirmed')
|
|
|
|
|
} else {
|
|
|
|
|
acc.add('!state:confirmed')
|
|
|
|
|
}
|
|
|
|
|
if (user.adminData?.is_approved) {
|
|
|
|
|
acc.add('state:approved')
|
|
|
|
|
} else {
|
|
|
|
|
acc.add('!state:approved')
|
|
|
|
|
}
|
|
|
|
|
if (user.adminData?.is_suggested) {
|
|
|
|
|
acc.add('state:suggested')
|
|
|
|
|
} else {
|
|
|
|
|
acc.add('!state:suggested')
|
|
|
|
|
}
|
|
|
|
|
return acc
|
|
|
|
|
}, new Set())
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
tagsSet() {
|
2026-06-10 01:58:49 +03:00
|
|
|
const present = new Set()
|
|
|
|
|
const missing = new Set()
|
|
|
|
|
|
|
|
|
|
this.users.forEach((user) => {
|
|
|
|
|
TAGS.forEach((tag) => {
|
|
|
|
|
if (user.tags.has(tag)) {
|
|
|
|
|
present.add(tag)
|
|
|
|
|
} else {
|
|
|
|
|
missing.add(tag)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const result = new Set()
|
|
|
|
|
|
|
|
|
|
TAGS.forEach((tag) => {
|
|
|
|
|
if (present.has(tag) && missing.has(tag)) {
|
|
|
|
|
result.add(`~${tag}`)
|
|
|
|
|
} else if (missing.has(tag)) {
|
|
|
|
|
result.add(`!${tag}`)
|
|
|
|
|
} else {
|
|
|
|
|
result.add(tag)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
return result
|
2019-02-18 17:49:32 +03:00
|
|
|
},
|
2026-06-10 01:58:49 +03:00
|
|
|
propertySet() {
|
|
|
|
|
return this.users.reduce((acc, user) => {
|
|
|
|
|
if (user.is_local) {
|
|
|
|
|
acc.add('property:local')
|
|
|
|
|
} else {
|
|
|
|
|
acc.add('!property:local')
|
|
|
|
|
}
|
|
|
|
|
return acc
|
|
|
|
|
}, new Set())
|
|
|
|
|
},
|
|
|
|
|
disabled() {
|
|
|
|
|
return !this.ready || this.users.length === 0
|
2022-08-06 22:33:38 +02:00
|
|
|
},
|
2026-06-10 01:58:49 +03:00
|
|
|
totalSet() {
|
|
|
|
|
return new Set([
|
|
|
|
|
...this.rightsSet,
|
|
|
|
|
...this.stateSet,
|
|
|
|
|
...this.tagsSet,
|
|
|
|
|
...this.propertySet,
|
|
|
|
|
])
|
2022-08-06 22:33:38 +02:00
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
canDeleteAccount() {
|
2022-08-06 22:33:38 +02:00
|
|
|
return this.privileged('users_delete')
|
|
|
|
|
},
|
2026-01-06 16:22:52 +02:00
|
|
|
canUseTagPolicy() {
|
|
|
|
|
return (
|
2026-02-05 00:28:45 +02:00
|
|
|
useInstanceCapabilitiesStore().tagPolicyAvailable &&
|
2026-01-06 16:22:52 +02:00
|
|
|
this.privileged('users_manage_tags')
|
|
|
|
|
)
|
|
|
|
|
},
|
2019-02-18 17:49:32 +03:00
|
|
|
},
|
|
|
|
|
methods: {
|
2026-06-10 01:58:49 +03:00
|
|
|
canGrantRole(name, value) {
|
|
|
|
|
const setEntry = `${value ? '!' : ''}rights:${name}`
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
this.$store.state.users.currentUser.role === 'admin' &&
|
|
|
|
|
this.totalSet.has(setEntry)
|
|
|
|
|
)
|
2019-02-18 17:49:32 +03:00
|
|
|
},
|
2026-06-10 01:58:49 +03:00
|
|
|
canChangeState(name, value) {
|
|
|
|
|
let privilege
|
|
|
|
|
|
|
|
|
|
switch (name) {
|
|
|
|
|
// TODO detailed privileges
|
|
|
|
|
default: {
|
|
|
|
|
privilege = 'users_manage_activation_state'
|
|
|
|
|
}
|
2019-02-18 17:49:32 +03:00
|
|
|
}
|
2026-06-10 01:58:49 +03:00
|
|
|
|
|
|
|
|
const setEntry = `${value ? '!' : ''}state:${name}`
|
|
|
|
|
|
|
|
|
|
return this.privileged(privilege) && this.totalSet.has(setEntry)
|
2019-02-18 17:49:32 +03:00
|
|
|
},
|
2026-06-10 01:58:49 +03:00
|
|
|
doConfirmDialogAction() {
|
|
|
|
|
if (typeof this.confirmDialogAction !== 'function') {
|
|
|
|
|
console.error('Confirm Dialog action is not a function!!')
|
2019-02-18 17:49:32 +03:00
|
|
|
}
|
2026-06-10 01:58:49 +03:00
|
|
|
|
|
|
|
|
this.confirmDialogAction()
|
|
|
|
|
this.clearConfirmDialog()
|
|
|
|
|
},
|
|
|
|
|
clearConfirmDialog() {
|
|
|
|
|
this.confirmDialogShow = false
|
|
|
|
|
this.confirmDialogTitle = null
|
|
|
|
|
this.confirmDialogContent = null
|
|
|
|
|
this.confirmDialogContent2 = null
|
|
|
|
|
this.confirmDialogDanger = false
|
|
|
|
|
this.confirmDialogConfirm = null
|
|
|
|
|
this.confirmDialogAction = null
|
|
|
|
|
this.confirmDialogGroup = null
|
|
|
|
|
this.confirmDialogName = null
|
2019-02-18 17:49:32 +03:00
|
|
|
},
|
2026-06-10 01:58:49 +03:00
|
|
|
privileged(privilege) {
|
|
|
|
|
return this.$store.state.users.currentUser.privileges.has(privilege)
|
2019-02-18 17:49:32 +03:00
|
|
|
},
|
2026-06-10 01:58:49 +03:00
|
|
|
setTag(tag, value) {
|
|
|
|
|
useAdminSettingsStore().setUsersTags({ users: this.users, value, tags: [tag] })
|
2019-02-18 17:49:32 +03:00
|
|
|
},
|
2026-06-10 01:58:49 +03:00
|
|
|
setRight(right, value) {
|
|
|
|
|
useAdminSettingsStore().setUsersRight({ users: this.users, value, right })
|
|
|
|
|
},
|
|
|
|
|
setStatus(name, value) {
|
|
|
|
|
const noun = (() => {
|
|
|
|
|
switch (name) {
|
|
|
|
|
case 'activated':
|
|
|
|
|
return 'Activation'
|
|
|
|
|
case 'confirmed':
|
|
|
|
|
return 'Confirmation'
|
|
|
|
|
case 'approved':
|
|
|
|
|
return 'Approval'
|
|
|
|
|
case 'suggested':
|
|
|
|
|
return 'Suggestion'
|
2026-01-06 16:22:52 +02:00
|
|
|
}
|
2026-06-10 01:58:49 +03:00
|
|
|
})()
|
|
|
|
|
|
|
|
|
|
useAdminSettingsStore()[`setUsers${noun}Status`]({
|
|
|
|
|
users: this.users,
|
|
|
|
|
value,
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
resendConfirmationEmail() {
|
|
|
|
|
useAdminSettingsStore().resendConfirmationEmail({ users: this.users })
|
|
|
|
|
},
|
|
|
|
|
requirePasswordChange() {
|
|
|
|
|
useAdminSettingsStore().requirePasswordChange({ users: this.users })
|
|
|
|
|
},
|
|
|
|
|
disableMFA() {
|
|
|
|
|
this.users.forEach((user) => {
|
|
|
|
|
useAdminSettingsStore().disableMFA({ user })
|
2026-01-06 16:22:52 +02:00
|
|
|
})
|
2020-02-28 16:39:47 +00:00
|
|
|
},
|
2026-06-10 01:58:49 +03:00
|
|
|
deleteUsers() {
|
|
|
|
|
const { id, name } = this.users[0]
|
|
|
|
|
|
|
|
|
|
useAdminSettingsStore()
|
|
|
|
|
.deleteUsers({ users: this.users })
|
|
|
|
|
.then((userIds) => {
|
|
|
|
|
if (userIds.length > 1) return
|
|
|
|
|
|
|
|
|
|
const isProfile =
|
|
|
|
|
this.$route.name === 'external-user-profile' ||
|
|
|
|
|
this.$route.name === 'user-profile'
|
|
|
|
|
const isTargetUser =
|
|
|
|
|
this.$route.params.name === name || this.$route.params.id === id
|
|
|
|
|
|
|
|
|
|
if (isProfile && isTargetUser) {
|
|
|
|
|
window.history.back()
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
setOpen(value) {
|
|
|
|
|
this.open = value
|
|
|
|
|
},
|
|
|
|
|
maybeShowConfirm(close, { group, name, action, value }) {
|
|
|
|
|
close()
|
|
|
|
|
this.confirmDialogName = name
|
|
|
|
|
this.confirmDialogGroup = group
|
|
|
|
|
this.confirmDialogAction = () => action()
|
|
|
|
|
|
|
|
|
|
switch (group) {
|
|
|
|
|
case 'action': {
|
2026-06-10 14:39:58 +03:00
|
|
|
switch (name) {
|
|
|
|
|
case 'delete': {
|
|
|
|
|
this.confirmDialogShow = true
|
|
|
|
|
this.confirmDialogTitle = this.$t(
|
|
|
|
|
'user_card.admin_menu.confirm_modal.delete_title',
|
|
|
|
|
)
|
|
|
|
|
this.confirmDialogDanger = true
|
|
|
|
|
this.confirmDialogContent =
|
|
|
|
|
'user_card.admin_menu.confirm_modal.delete_content'
|
|
|
|
|
this.confirmDialogContent2 =
|
|
|
|
|
'user_card.admin_menu.confirm_modal.delete_content_2'
|
|
|
|
|
this.confirmDialogConfirm = this.$t(
|
|
|
|
|
'user_card.admin_menu.confirm_modal.delete',
|
|
|
|
|
)
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
case 'resend_confirmation': {
|
|
|
|
|
this.confirmDialogShow = true
|
|
|
|
|
this.confirmDialogTitle = this.$t(
|
|
|
|
|
'user_card.admin_menu.confirm_modal.resend_confirmation_title',
|
|
|
|
|
)
|
|
|
|
|
this.confirmDialogContent =
|
|
|
|
|
'user_card.admin_menu.confirm_modal.resend_confirmation_content'
|
|
|
|
|
this.confirmDialogConfirm = this.$t(
|
|
|
|
|
'user_card.admin_menu.confirm_modal.send',
|
|
|
|
|
)
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
case 'disable_mfa': {
|
|
|
|
|
this.confirmDialogShow = true
|
|
|
|
|
this.confirmDialogTitle = this.$t(
|
|
|
|
|
'user_card.admin_menu.confirm_modal.disable_mfa_title',
|
|
|
|
|
)
|
|
|
|
|
this.confirmDialogContent =
|
|
|
|
|
'user_card.admin_menu.confirm_modal.disable_mfa_content'
|
|
|
|
|
this.confirmDialogConfirm = this.$t(
|
|
|
|
|
'settings.confirm'
|
|
|
|
|
)
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
case 'require_password_change': {
|
|
|
|
|
this.confirmDialogShow = true
|
|
|
|
|
this.confirmDialogTitle = this.$t(
|
|
|
|
|
'user_card.admin_menu.confirm_modal.require_password_change_title',
|
|
|
|
|
)
|
|
|
|
|
this.confirmDialogContent =
|
|
|
|
|
'user_card.admin_menu.confirm_modal.require_password_change_content'
|
|
|
|
|
this.confirmDialogConfirm = this.$t(
|
|
|
|
|
'settings.confirm'
|
|
|
|
|
)
|
|
|
|
|
break
|
|
|
|
|
}
|
2026-06-10 01:58:49 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
case 'state': {
|
|
|
|
|
switch (name) {
|
|
|
|
|
case 'activated': {
|
|
|
|
|
this.confirmDialogShow = true
|
|
|
|
|
|
|
|
|
|
this.confirmDialogTitle = this.$t(
|
|
|
|
|
'user_card.admin_menu.confirm_modal.activate_title',
|
|
|
|
|
)
|
|
|
|
|
this.confirmDialogContent = value
|
|
|
|
|
? 'user_card.admin_menu.confirm_modal.activate_content'
|
|
|
|
|
: 'user_card.admin_menu.confirm_modal.deactivate_content'
|
|
|
|
|
this.confirmDialogConfirm = value
|
|
|
|
|
? this.$t('user_card.admin_menu.confirm_modal.activate')
|
|
|
|
|
: this.$t('user_card.admin_menu.confirm_modal.deactivate')
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
// Confirmation and Approval statuses cannot be revokedn(no API)
|
|
|
|
|
case 'confirmed': {
|
|
|
|
|
this.confirmDialogTitle = this.$t(
|
|
|
|
|
'user_card.admin_menu.confirm_modal.confirm_title',
|
|
|
|
|
)
|
|
|
|
|
this.confirmDialogContent = //value
|
|
|
|
|
/*?*/ 'user_card.admin_menu.confirm_modal.confirm_content'
|
|
|
|
|
//: 'user_card.admin_menu.confirm_modal.confirm_revoke_content'
|
|
|
|
|
this.confirmDialogConfirm = value
|
|
|
|
|
/*?*/ this.$t('user_card.admin_menu.confirm_modal.confirm')
|
|
|
|
|
//: this.$t('user_card.admin_menu.confirm_modal.revoke')
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
case 'approved': {
|
|
|
|
|
this.confirmDialogTitle = this.$t(
|
|
|
|
|
'user_card.admin_menu.confirm_modal.approval_title',
|
|
|
|
|
)
|
|
|
|
|
this.confirmDialogContent = //value
|
|
|
|
|
/*?*/ 'user_card.admin_menu.confirm_modal.approval_content'
|
|
|
|
|
//: 'user_card.admin_menu.confirm_modal.approval_revoke_content'
|
|
|
|
|
this.confirmDialogConfirm = value
|
|
|
|
|
/*?*/ this.$t('user_card.admin_menu.confirm_modal.approve')
|
|
|
|
|
//: this.$t('user_card.admin_menu.confirm_modal.revoke')
|
|
|
|
|
break
|
|
|
|
|
}
|
2026-06-10 14:39:58 +03:00
|
|
|
case 'suggested': {
|
2026-06-10 01:58:49 +03:00
|
|
|
this.confirmDialogTitle = this.$t(
|
|
|
|
|
'user_card.admin_menu.confirm_modal.suggest_title',
|
|
|
|
|
)
|
|
|
|
|
this.confirmDialogContent = value
|
|
|
|
|
? 'user_card.admin_menu.confirm_modal.add_suggest_content'
|
|
|
|
|
: 'user_card.admin_menu.confirm_modal.remove_suggest_content'
|
|
|
|
|
this.confirmDialogConfirm = value
|
|
|
|
|
? this.$t('user_card.admin_menu.confirm_modal.add')
|
|
|
|
|
: this.$t('user_card.admin_menu.confirm_modal.remove')
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
case 'rights': {
|
|
|
|
|
this.confirmDialogTitle = this.$t(
|
|
|
|
|
'user_card.admin_menu.confirm_modal.user_rights_title',
|
|
|
|
|
)
|
|
|
|
|
this.confirmDialogContent = value
|
|
|
|
|
? 'user_card.admin_menu.confirm_modal.grant_role_content'
|
|
|
|
|
: 'user_card.admin_menu.confirm_modal.revoke_role_content'
|
|
|
|
|
this.confirmDialogConfirm = value
|
|
|
|
|
? this.$t('user_card.admin_menu.confirm_modal.grant')
|
|
|
|
|
: this.$t('user_card.admin_menu.confirm_modal.revoke')
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
case 'mrf_tag': {
|
|
|
|
|
this.confirmDialogTitle = this.$t(
|
|
|
|
|
'user_card.admin_menu.user_tag_title',
|
|
|
|
|
)
|
|
|
|
|
this.confirmDialogContent = value
|
|
|
|
|
? 'user_card.admin_menu.confirm_modal.assign_tag_content'
|
|
|
|
|
: 'user_card.admin_menu.confirm_modal.unassign_tag_content'
|
|
|
|
|
this.confirmDialogConfirm = value
|
|
|
|
|
? this.$t('user_card.admin_menu.confirm_modal.assign')
|
|
|
|
|
: this.$t('user_card.admin_menu.confirm_modal.unassign')
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.users.length > 1) {
|
|
|
|
|
this.confirmDialogShow = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!this.confirmDialogShow) {
|
|
|
|
|
this.doConfirmDialogAction()
|
|
|
|
|
}
|
2026-01-06 16:22:52 +02:00
|
|
|
},
|
|
|
|
|
},
|
2019-02-18 17:49:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default ModerationTools
|