|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
! `' G: d- N; f$ _# a: nTeamcenter二次开发源码分享: 获取当前用户信息- y% `0 `! i4 s
: W0 w& _2 j5 l8 J4 N( u[mw_shl_code=cpp,true]#include <iostream>: @0 v6 J* q/ z* h, l; X$ t4 @
#include <sa/group.h>3 X! a `! b: k
#include <sa/user.h>$ l" s: t: T8 a/ I4 ?/ D
#include <TC/LoggedInUser.hxx>
* Y0 d: U9 ]' ?6 z' R% r1 U9 d% B# q, s
using namespace Teamcenter;8 y0 m: P7 V9 _. u- t
using namespace Core;$ C- W1 ]& L) D" w7 O$ I Z
using namespace std;8 x7 \7 y- D- T1 t" J8 _' ~! V
5 O) s8 h) z1 m. K. r3 N0 T
static void reportCurrentLoginInfomation()
! c/ b( c$ I' B& ~: u/ g{$ R" n$ Z4 L- T+ S7 C5 ^
int ifail = ITK_ok;6 P9 R$ Q2 O5 g, c. p9 B; O
LoggedInUser* loggedInUser = LoggedInUser::getInstance();
1 d% f8 H) U! \( n" J6 b: N 0 k; k% p! I) z% P2 f
tag_t currentUserTag = loggedInUser->getCurrentUserTag();
' c/ D4 K F1 ?3 V: Q cout << " currentUserTag: " << currentUserTag << endl;
+ w2 A) U8 u# ~/ e. Z/ m" G* U' q2 h/ y
. Y' }' v0 v- K* o* Z: m1 c char *personName = NULL;: h1 A+ X1 G. J3 P4 }! j; }
IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));9 ~3 a6 C4 B# `! J
cout << " personName: " << personName << endl;
# G$ @* R9 I. L' o if(personName) MEM_free(personName);" w2 K) s: Z" V! L
. d4 U$ H8 ?" [ I const char* userID = loggedInUser->getCurrentUserID();. |/ O5 Y2 {; A( p
cout << " userID: " << userID << endl;
& ]% A% b3 ?& \7 X' a9 Y
0 d* C4 i7 z" x4 T' y0 G tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();
' f/ L4 s9 }: o* x 6 K3 b P, V9 o- n8 K3 [
char *groupName = NULL;, r9 O! P. p/ _; t& l0 E" J5 y# j, q
IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));
' M' k0 F, c, i$ J d cout << " groupName: " << groupName << endl;4 ^/ Y3 k+ i) @% N* r6 D
if(groupName) MEM_free(groupName);
8 w* f* o: X/ _
( U2 W/ M% G2 e, H# ~/ k tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();: M. B6 U5 U2 m3 j: ]3 y) s
char *roleName = NULL;9 N# ]0 T: o$ c1 Q9 r+ d0 y3 X
IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));
" ?' d( d0 N5 ~4 d cout << " roleName: " << roleName << endl;! J/ F# F9 W# R* f
if(roleName) MEM_free(roleName);
) q- i' C# Y6 L9 \5 ^( p 6 G- |6 q8 ?9 b. H9 t
logical isDba = loggedInUser->isUserSystemAdministrator();
. r: F# X' r- P' t if(isDba == TRUE) cout << " User is dba member "<< endl;3 u3 T# ~+ M( C0 n' o: S/ I5 k
if(isDba == FALSE) cout << " User is not dba member "<< endl;
' h& c. }9 y j- d}[/mw_shl_code]
) v7 _' E5 H2 P: k2 v: Q3 G# [# l |
|