aboutsummaryrefslogtreecommitdiffstats
path: root/core/src/OC/currentuser.js
blob: a022698eab0fbc9db8ecc1c39e6b32605357bb7c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/**
 * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

const rawUid = document
	.getElementsByTagName('head')[0]
	.getAttribute('data-user')
const displayName = document
	.getElementsByTagName('head')[0]
	.getAttribute('data-user-displayname')

export const currentUser = rawUid !== undefined ? rawUid : false

export const getCurrentUser = () => {
	return {
		uid: currentUser,
		displayName,
	}
}