From 6077d258b500b20e1e705f5cda567400240c7804 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 11:36:25 +0200 Subject: Adding upstream version 2.21.3+deb11u1. Signed-off-by: Daniel Baumann --- lib/Devscripts/Salsa/whoami.pm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 lib/Devscripts/Salsa/whoami.pm (limited to 'lib/Devscripts/Salsa/whoami.pm') diff --git a/lib/Devscripts/Salsa/whoami.pm b/lib/Devscripts/Salsa/whoami.pm new file mode 100644 index 0000000..176e591 --- /dev/null +++ b/lib/Devscripts/Salsa/whoami.pm @@ -0,0 +1,24 @@ +# Gives information on token owner +package Devscripts::Salsa::whoami; + +use strict; +use Devscripts::Output; +use Moo::Role; + +sub whoami { + my ($self) = @_; + my $current_user = $self->api->current_user; + print <{id} +Username: $current_user->{username} +Name : $current_user->{name} +Email : $current_user->{email} +State : $current_user->{state} +END + $self->cache->{user}->{ $current_user->{id} } = $current_user->{username}; + $self->cache->{user_id}->{ $current_user->{username} } + = $current_user->{id}; + return 0; +} + +1; -- cgit v1.2.3