Skip to main content

current_user

Gets or lists a current_user resource.

Overview​

Namecurrent_user
TypeResource
Idgitlab.users.current_user

Fields​

The following fields are returned by SELECT queries:

GraphQL response envelope

NameDatatypeDescription
idstringGlobal ID of the user.
namestringHuman-readable name of the user. Returns **** if the user is a project bot and the requester does not have permission to view the project.
activebooleanIndicates if the user is active.
adminbooleanIndicates if the user is an instance administrator.
avatar_urlstringURL of the user's avatar.
biostringBio of the user.
botbooleanIndicates if the user is a bot.
commit_emailstringUser's default commit email.
composite_identity_enforcedbooleanIndicates if composite identity is enforced for the user.
created_atstringTimestamp of when the user was created.
discordstringDiscord ID of the user.
duo_classic_chat_availablebooleanUser access to GitLab Duo Chat (non-agentic) feature.
githubstringGitHub profile name of the user.
gitpod_enabledbooleanWhether Ona is enabled at the user level.
group_countintegerGroup count for the user.
humanbooleanIndicates if the user is a regular user.
job_titlestringJob title of the user.
last_activity_onstringDate the user last performed any actions.
linkedinstringLinkedIn profile name of the user.
locationstringLocation of the user.
namespaceobjectNamespace identity (id, full_path, name)
organizationstringWho the user represents or works for.
preferences_gitpod_pathstringWeb path to the Ona section within user preferences.
profile_enable_gitpod_pathstringWeb path to enable Ona for the user.
project_countintegerProject count for the user.
pronounsstringPronouns of the user.
public_emailstringUser's public email.
statestringState of the user. (active, blocked, deactivated, banned, ldap_blocked, blocked_pending_approval)
twitterstringX (formerly Twitter) username of the user.
typestringType of the user. (HUMAN, SUPPORT_BOT, ALERT_BOT, VISUAL_REVIEW_BOT, SERVICE_USER, GHOST, PROJECT_BOT, SECURITY_BOT, AUTOMATION_BOT, SECURITY_POLICY_BOT, ADMIN_BOT, SERVICE_ACCOUNT, PLACEHOLDER, DUO_CODE_REVIEW_BOT, IMPORT_USER)
usernamestringUsername of the user. Unique within the instance of GitLab.
web_pathstringWeb path of the user.
web_urlstringWeb URL of the user.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselecthostGet information about current user. Generated from the GitLab GraphQL schema field Query.currentUser (CurrentUser).

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
hoststringGitLab host, with an optional port (default gitlab.com). Resolved from the GITLAB_HOST environment variable when it is set (x-stackQL-envVar); a WHERE host value always takes precedence. Self-managed instances: the provider is generated from the gitlab.com schema, so older instances may reject fields they do not serve. (default: gitlab.com, x-stackQL-envVar: GITLAB_HOST)

SELECT examples​

Get information about current user. Generated from the GitLab GraphQL schema field Query.currentUser (CurrentUser).

SELECT
id,
name,
active,
admin,
avatar_url,
bio,
bot,
commit_email,
composite_identity_enforced,
created_at,
discord,
duo_classic_chat_available,
github,
gitpod_enabled,
group_count,
human,
job_title,
last_activity_on,
linkedin,
location,
namespace,
organization,
preferences_gitpod_path,
profile_enable_gitpod_path,
project_count,
pronouns,
public_email,
state,
twitter,
type,
username,
web_path,
web_url
FROM gitlab.users.current_user
WHERE host = '{{ host }}' -- required (defaults to gitlab.com; or set GITLAB_HOST)
;