aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings/src/utils/userUtils.ts
blob: 7d9a516a5426c876269b8b26ad3600e9ce08be2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
 * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

import { translate as t } from '@nextcloud/l10n'

export const unlimitedQuota = {
	id: 'none',
	label: t('settings', 'Unlimited'),
}

export const defaultQuota = {
	id: 'default',
	label: t('settings', 'Default quota'),
}

/**
 * Return `true` if the logged in user does not have permissions to view the
 * data of `user`
 * @param user The user to check
 * @param user.id Id of the user
 */
export const isObfuscated = (user: { id: string, [key: string]: unknown }) => {
	const keys = Object.keys(user)
	return keys.length === 1 && keys.at(0) === 'id'
}