|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
Y% p, F/ K6 V0 r9 v/ gTeamcenter二次开发源码分享: 获取当前用户信息
3 A! c" ~" M4 M8 ]! e7 w' r' R- E* m, j7 g( m
[mw_shl_code=cpp,true]#include <iostream>$ D; H$ P7 E" q3 q2 g
#include <sa/group.h>
! o* n6 P- G4 d4 ?; g) a#include <sa/user.h>
) _; a. [' t! J7 s' N& ]) K#include <TC/LoggedInUser.hxx>5 f# H* c6 [0 B5 b& z4 Q, _
7 M4 d. T6 H( } B7 Y8 eusing namespace Teamcenter;
0 Q, V7 v' x8 t5 xusing namespace Core;7 H3 s1 }0 i2 S; y
using namespace std;3 `0 P. s3 F! i, Q V: e- B6 F
/ S* ^! j% L7 o8 K X: m, d% ostatic void reportCurrentLoginInfomation()% s( t0 a, [+ m4 N
{% w! { F4 T$ L$ ^) M/ A
int ifail = ITK_ok;
* e, O6 @) M$ L5 C) w) } LoggedInUser* loggedInUser = LoggedInUser::getInstance();* B% T {' e9 B/ T: V
6 T# G+ q% V8 M0 k0 o tag_t currentUserTag = loggedInUser->getCurrentUserTag();
: `+ P, E! W" o7 z cout << " currentUserTag: " << currentUserTag << endl;/ ?3 l! J) V2 b- k; D' C4 M( h2 Z
* S. U2 x$ \1 V S0 g/ D$ H
char *personName = NULL;
! @( L, B7 C! w" j3 O7 m* ~% i$ U' k IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));: B+ p6 T3 G0 q5 H* M5 b
cout << " personName: " << personName << endl;
2 D+ k' A, h, {) K. \0 e8 c' s if(personName) MEM_free(personName);4 r$ S. t9 t5 n1 \# {2 W
: l6 N5 ^: M# |4 \. ^% n
const char* userID = loggedInUser->getCurrentUserID();
7 E$ C5 w% K) L cout << " userID: " << userID << endl;7 K' o. x6 L- o9 h* Z
4 n- Z- P+ G$ }6 f tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();
( S* h3 u2 i- Y0 M& B6 Y! i / q8 @/ }# O+ p! \0 f" D
char *groupName = NULL;
7 r3 W; l% u" h) K e+ U$ `. K IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));" A* g$ L/ M' F9 P& n
cout << " groupName: " << groupName << endl;
6 ~5 Z1 k) O! s6 v if(groupName) MEM_free(groupName);
\; D3 O0 s0 D/ `3 G# a: Q/ L; C2 K) J( V( @& G3 E
tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();2 |! k$ i2 z& M! |
char *roleName = NULL;
2 Q& l8 }. O; `4 I+ f2 U1 L7 ?1 ] IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));% \0 M8 u9 d1 B, ]
cout << " roleName: " << roleName << endl;+ ]' t0 g9 m4 I7 Q
if(roleName) MEM_free(roleName);
, q, y t8 ~. ?7 E3 q 4 E. D5 C9 m0 X0 @9 S$ X; L
logical isDba = loggedInUser->isUserSystemAdministrator();: d& o" k; H! Q6 w$ V! s
if(isDba == TRUE) cout << " User is dba member "<< endl;
% s8 z3 Z/ \; S if(isDba == FALSE) cout << " User is not dba member "<< endl;
8 b- h5 {# L& l! t9 }( b" `}[/mw_shl_code]
6 U$ c' ~4 q4 j, D |
|