|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
& [4 ?) G9 R% i( V) U- c1 j
Teamcenter二次开发源码分享: 获取当前用户信息# M k* E4 U8 w# s! U6 o6 N& m
' p) G5 O+ C5 b% ?[mw_shl_code=cpp,true]#include <iostream>
' {7 d1 L& B. P7 h: t#include <sa/group.h>' M; H% ~+ _( {6 W0 n( O
#include <sa/user.h>! x; e L# ?$ z P+ s8 K" N
#include <TC/LoggedInUser.hxx>
7 C- G9 E+ I0 U7 P! e o3 s7 x9 i( Q8 E, s
using namespace Teamcenter;
1 r6 G6 E3 O* \4 t$ nusing namespace Core;; c# Y3 F% a( I6 x4 R! y
using namespace std;! a/ J3 l5 j, F+ l" P
m6 X% L6 v7 {$ {static void reportCurrentLoginInfomation()
( ~) x% Q& L0 D V{; t. e8 ~% E, a3 ?' ]
int ifail = ITK_ok;( ?! N/ D- t: [' l2 s
LoggedInUser* loggedInUser = LoggedInUser::getInstance();9 C/ I2 u. A4 s. q4 R
% ~8 o e8 _1 e+ U- ?1 U! Z/ p2 r tag_t currentUserTag = loggedInUser->getCurrentUserTag();
- Q( V; A" L1 h8 @* ^' `& m; b cout << " currentUserTag: " << currentUserTag << endl;
- l7 a7 b* F+ P, ~9 ~+ t( \
6 l4 D, u: g* `: ?( D char *personName = NULL;
/ a f: W3 E& T8 b IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));
& S2 l9 a1 z% O& p+ w, j# B9 W' f- h cout << " personName: " << personName << endl;8 |( N2 F8 ?1 l& F
if(personName) MEM_free(personName);
/ ]3 u5 s! a0 g; o/ [ ' i6 Y& S* O6 I
const char* userID = loggedInUser->getCurrentUserID();8 N/ h5 Y6 l: b3 b% R
cout << " userID: " << userID << endl;1 Y0 R4 D, W: W, f. |
, @2 n3 E2 }4 B
tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();! x5 I. A+ p) Y6 A4 _: c
* U" ^1 C8 ~/ k' \: p
char *groupName = NULL;. P* b5 \* o' ]! Q( q8 _
IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));, z: n. v6 r: E' T( I4 Z
cout << " groupName: " << groupName << endl;
" t. }* a$ Z; I3 X6 c6 p if(groupName) MEM_free(groupName);
: v$ P5 t/ f; e5 ^3 n; H3 z" |- q$ j* o" V4 n
tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();
) e, c% F6 r! T; i/ k& A& X; I9 h3 ^ char *roleName = NULL;
6 D G6 W; F( a# ^( v9 [. k IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));
5 [$ E# V( n- |% Q. y% _ cout << " roleName: " << roleName << endl;+ M t' P! G) m! u! K
if(roleName) MEM_free(roleName);
/ c+ M7 {9 Y1 [: d% A# |1 T " ^) r0 l( p1 t" h. }( p1 f
logical isDba = loggedInUser->isUserSystemAdministrator();
P/ O/ P8 I; g, |/ P# `1 l+ i if(isDba == TRUE) cout << " User is dba member "<< endl;
* D4 F! o7 x( a1 f/ L- E if(isDba == FALSE) cout << " User is not dba member "<< endl; " ^) _3 y z. P4 F
}[/mw_shl_code]% ]5 z/ ^2 Q+ A) ^. ?# k4 _
|
|