|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
3 t4 k) W& w! ~2 rTeamcenter二次开发源码分享: 获取当前用户信息
) u% V: y+ ~( _6 D0 c
. v1 F- c" I* o8 g- ]$ J: c7 n[mw_shl_code=cpp,true]#include <iostream>6 ~) n! m9 H* D& T9 Q! Q& }; c
#include <sa/group.h>& T8 h) M4 K! x- A/ B
#include <sa/user.h>
: Z; W& E! z" O0 K#include <TC/LoggedInUser.hxx> {) d" ]9 W8 x& J
( G2 }% k$ ]- Y" e$ zusing namespace Teamcenter;' [/ U, X5 {6 L, E, r" ~4 W; B
using namespace Core;
# \3 d7 L- p5 B' E/ ]8 kusing namespace std;
; r% W) I" c2 h- Z/ f, g3 Q6 A4 p* q
static void reportCurrentLoginInfomation()
8 {& q0 s8 e6 \ I P3 J1 @# H{; j$ }& }7 O4 O/ x0 P
int ifail = ITK_ok;( y( W( Y( A' w2 Y2 r+ p' B% W
LoggedInUser* loggedInUser = LoggedInUser::getInstance();# Z4 q. p3 j# [2 q8 I3 [
+ g( N( U. ?& H. N( Q tag_t currentUserTag = loggedInUser->getCurrentUserTag();6 j7 e* N5 y) g# N! ~$ c6 G
cout << " currentUserTag: " << currentUserTag << endl;
' e" s3 ^8 V: Q$ k; _ - V7 o- v* B) P0 o' _
char *personName = NULL;' X8 c9 d! N6 G8 k" g- ?) r% U. P
IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));" H4 o! e' Y- i J: b/ k
cout << " personName: " << personName << endl;. h( Q, u( R9 u- ~9 _& x1 M
if(personName) MEM_free(personName);
8 q+ |+ I, s: {9 L ( _- p( b* O' C9 [' n6 W" P6 j1 b
const char* userID = loggedInUser->getCurrentUserID();
2 n' M+ P, M& W cout << " userID: " << userID << endl;
9 c! @, `) Z1 R" e/ ?
% }) B6 ?: K1 |# Y7 b0 w; ^* @ tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();
3 D/ n& l3 ?8 {; a0 J
. Y) w+ H8 N4 O" \* h char *groupName = NULL;) d; |* S& ]2 B6 z% e& @
IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));
# k, N7 X$ o7 J0 l cout << " groupName: " << groupName << endl;9 i# ]8 Z" M P) L9 S& |0 T0 @
if(groupName) MEM_free(groupName);
4 k5 F% c+ [; s# b% p8 k- a, G$ C$ l- r
tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();
' ~3 Q" W& A& U7 p8 C# Q7 E char *roleName = NULL;5 B2 ?; Q" @3 C v! ^6 b
IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));
" C% X: j! N5 e8 d s cout << " roleName: " << roleName << endl;& c( Q+ x u4 e2 Q
if(roleName) MEM_free(roleName);5 `! c% Z" b% B+ m4 c8 y
4 f1 v0 ]0 b4 |. [. W2 [+ X" N, i logical isDba = loggedInUser->isUserSystemAdministrator();
9 h( V1 \/ i, U% h if(isDba == TRUE) cout << " User is dba member "<< endl;
2 K+ |4 [1 o- b# d. f if(isDba == FALSE) cout << " User is not dba member "<< endl;
- h, h" W9 p7 f9 c7 Y9 t; ]5 u u% N}[/mw_shl_code]
0 h8 B9 o! U3 S" X |
|