|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
* e& U; s" A5 N" N6 b/ c
Teamcenter二次开发源码分享: 获取当前用户信息! S' U0 _0 a9 {: y6 `
/ a+ q! l) o b9 K8 k[mw_shl_code=cpp,true]#include <iostream>5 m& F7 q- g3 c! |6 J
#include <sa/group.h>
, {9 C: k/ I0 T# K+ t+ u#include <sa/user.h>5 G" e8 @ y4 T7 P8 T8 s) y
#include <TC/LoggedInUser.hxx>
) y# @1 B$ P. _$ }9 d
4 ~: [, ~, J' ` H, A7 f) Susing namespace Teamcenter;
/ l* E( n+ {( Q$ ?! n% G! M D0 Yusing namespace Core;2 V6 X. d3 J0 K. F J- e
using namespace std;! a3 F7 e5 g- \: s' V9 [
6 d8 ~2 p, i. j, I3 Fstatic void reportCurrentLoginInfomation()7 A5 p! b+ h V: r" C _
{
" i9 s p0 \: J int ifail = ITK_ok;
6 V; k! O' p7 X* X/ O LoggedInUser* loggedInUser = LoggedInUser::getInstance();
3 l/ A: C( K0 N
4 c4 I% T; c6 B8 {" z tag_t currentUserTag = loggedInUser->getCurrentUserTag();5 D, k" ~: L- w. z) B, D
cout << " currentUserTag: " << currentUserTag << endl;) o# v' u. B3 d, K3 F: E% I
, H' T; c- R4 K( R1 M. I, c
char *personName = NULL;
% I9 [, Q3 {' A IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));
' E; `, e. U2 r! I cout << " personName: " << personName << endl;
6 a, ?5 T" H |/ `) d) U if(personName) MEM_free(personName);
8 L3 J+ H# u h; p$ K 2 H- J8 f9 X5 x7 o3 q: _
const char* userID = loggedInUser->getCurrentUserID();( d) c/ }: l) d
cout << " userID: " << userID << endl;
% n/ I; Y+ u5 L) `. z8 d$ i( P; d
tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();
* g- H, }3 P: L3 |- @
5 t8 E- f4 a7 d8 L2 F8 s2 ~ char *groupName = NULL;
9 ^% q$ U1 H; g( H& z6 { IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));
- K+ z- t& `2 M6 M+ S5 y cout << " groupName: " << groupName << endl;
! u# t- z% O% u9 ?* Z- j6 W: z$ w if(groupName) MEM_free(groupName);5 U5 }8 b" v% K, s
+ ?) V- E. E1 a tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();
- E8 W. E9 k6 _; P char *roleName = NULL;
% x7 z- ?+ ?2 M( o3 E, h IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));. h; z t* F; Z ^
cout << " roleName: " << roleName << endl;
2 B$ ^1 w6 g( s ~- Y' I6 I& } D if(roleName) MEM_free(roleName);. K' z6 t/ [6 |0 {
$ z2 [- x9 J" p' W
logical isDba = loggedInUser->isUserSystemAdministrator();
7 k, f$ n7 ~% }9 t- D! }; [. [9 s3 P7 d if(isDba == TRUE) cout << " User is dba member "<< endl;
4 r" }& c U3 `- O: A2 e" _7 d i if(isDba == FALSE) cout << " User is not dba member "<< endl; + F) F m5 S7 A, u% j: C$ M
}[/mw_shl_code]
. P0 @, a& k3 P2 K4 [+ b% Z4 o s |
|