File tree Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Expand file tree Collapse file tree 1 file changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -493,6 +493,22 @@ namespace eval ::jira {
493
493
}
494
494
}
495
495
496
+ #
497
+ # Get info on the currenty-logged-in user. User data will be stored in _result.
498
+ #
499
+ proc getCurrentUser {_result} {
500
+ upvar 1 $_result result
501
+ unset -nocomplain result
502
+
503
+ set url " [ ::jira::baseurl] /rest/api/2/myself"
504
+ if {[::jira::raw $url GET json]} {
505
+ array set result [::yajl::json2dict $json(data) ]
506
+ return 1
507
+ } else {
508
+ return 0
509
+ }
510
+ }
511
+
496
512
#
497
513
# Given an email address, try to find a user with that address. This proc only
498
514
# returns true if one and only one user is found. In that case, the user data
@@ -763,7 +779,7 @@ namespace eval ::jira {
763
779
#
764
780
# Parse user JSON and generate basic BasicUser JSON.
765
781
#
766
- proc parseBasicUser {key _result args} {
782
+ proc parseBasicUser {email _result args} {
767
783
::jira::parse_args args argarray
768
784
769
785
upvar 1 $_result result
@@ -773,8 +789,12 @@ namespace eval ::jira {
773
789
array set result $argarray(userDefinition)
774
790
return
775
791
}
776
-
777
- ::jira::getUserByEmail $key getUserResult
792
+
793
+ if {$email eq " " } {
794
+ ::jira::getCurrentUser getUserResult
795
+ } else {
796
+ ::jira::getUserByEmail $email getUserResult
797
+ }
778
798
779
799
set keyMap [list self displayName active]
780
800
You can’t perform that action at this time.
0 commit comments