|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
! I2 Y5 r( n7 A4 Z% T7 {Teamcenter二次开发源码分享: 获取当前用户信息6 n6 F% Z. V, I
4 \2 W# B7 I) S& i& q
[mw_shl_code=cpp,true]#include <iostream>4 |" R. w, t/ l& n
#include <sa/group.h>
4 v5 G$ N" N5 P% A#include <sa/user.h>6 C6 `. u' |8 \1 t
#include <TC/LoggedInUser.hxx>
2 v0 G9 G! }! d7 Z. q7 ^9 o8 J# r- j+ s8 W1 O
using namespace Teamcenter;7 u* O" V& W7 l/ e B4 n5 N0 F/ r7 }
using namespace Core;
4 i/ d5 r2 w+ J2 ?1 [using namespace std;
7 \7 a8 G" A1 Q- L
1 o3 l. r1 _1 t+ O+ X$ Pstatic void reportCurrentLoginInfomation()
* u+ v5 Q; ?! S* y5 O" D) _{& Y8 f+ q/ N1 n7 w& u' m( h
int ifail = ITK_ok;
! l+ k, q3 O* |$ I9 K( _9 }! g LoggedInUser* loggedInUser = LoggedInUser::getInstance();
! m) a( e" b0 {1 L
, D7 [( _9 \* J+ F, u6 x0 B" L tag_t currentUserTag = loggedInUser->getCurrentUserTag();. P) I& {% V4 V* w6 G
cout << " currentUserTag: " << currentUserTag << endl;) [7 F) ^) J( ~& k6 n' ~' H
/ `3 q& |: O0 O7 t! Z7 f {5 i char *personName = NULL;
% i2 h9 J: r7 k6 L, x( | IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));1 z: y8 l4 x5 j; ~
cout << " personName: " << personName << endl;- J+ j8 W0 }# t! Z* F8 I; { @
if(personName) MEM_free(personName);7 w' N$ t) d9 b
3 E+ m0 @8 J( x4 J D1 b
const char* userID = loggedInUser->getCurrentUserID();5 B1 o4 V5 n8 y8 q {4 h
cout << " userID: " << userID << endl;
4 v% B+ [1 X: L* ?" v* e% o$ y( o; S" ]8 f; \7 v
tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();- \) H; j: Q1 r. ], \
- I7 n4 m/ W5 k& [2 `# n" t4 l
char *groupName = NULL;
, |% _- K X/ V! f: P+ I IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));
+ a. a( G8 z" B' v# ~, C% o cout << " groupName: " << groupName << endl;
L$ [( M8 G' F$ h6 B. E1 R if(groupName) MEM_free(groupName);. t& J! H+ s4 j2 [$ s
/ k y$ i4 v8 m. M tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();
8 M! k: t) p) t O. Z char *roleName = NULL;; A% M5 n9 A" a; C) R$ e+ x
IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));" D) w" O: _! N2 u
cout << " roleName: " << roleName << endl;
+ g% ]2 N8 |& E$ R+ M, a0 g3 O if(roleName) MEM_free(roleName);: P; `# {/ q/ t/ C; @# w
! q/ G9 ]9 u! w4 N5 `" z logical isDba = loggedInUser->isUserSystemAdministrator();
) @. s# K& W/ e7 e. c# [ if(isDba == TRUE) cout << " User is dba member "<< endl;
6 W( a0 h" ~8 @! r2 I if(isDba == FALSE) cout << " User is not dba member "<< endl;
1 o% g. g$ r- u}[/mw_shl_code]
. H% n2 ]! r) T) w. }# j/ a |
|