|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
6 {3 G3 L2 y: J$ V6 H! }Teamcenter二次开发源码分享: 获取当前用户信息
6 `9 ?9 z, x: x% [& y: d7 ^& R- l" q2 [
[mw_shl_code=cpp,true]#include <iostream>
$ l# G. Z1 \3 V! w; e2 g; a#include <sa/group.h>
* h: ?7 Q, l. Y% s#include <sa/user.h>: @6 y3 y4 m0 u5 u" J& `) Y
#include <TC/LoggedInUser.hxx>
9 I2 N5 Y8 z, i" C" I' @
+ K9 `2 t( o% w# \. `" |using namespace Teamcenter;2 @$ [8 {2 `: A/ h
using namespace Core;6 S* k: U: f' V- ?
using namespace std;' L, F' [/ u* A6 m7 M9 F! ]& i
. P2 P# R2 f+ ^7 h5 hstatic void reportCurrentLoginInfomation()
3 { M d: Y- u$ X- B) q{# w W' Q) |0 B: l% y
int ifail = ITK_ok;: w' I/ H: z) \ ~/ v# Q4 y
LoggedInUser* loggedInUser = LoggedInUser::getInstance();% I/ ?5 B( P8 p' |0 m
- L7 z% W3 O y; M
tag_t currentUserTag = loggedInUser->getCurrentUserTag();1 j. q' F& m! p; b
cout << " currentUserTag: " << currentUserTag << endl;2 C! K* `5 A U" T
3 F8 q! @/ [ h/ \/ Y8 ?
char *personName = NULL;
) { m `' ^# H IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));
; ` H8 l1 g( L* y) _ cout << " personName: " << personName << endl;
# E2 `7 d& g; X+ ? t if(personName) MEM_free(personName);. f: k9 P, ~* q+ t8 R
, ]4 U) y; O8 I- K const char* userID = loggedInUser->getCurrentUserID();
; a3 X6 |9 a3 J& g3 G! E cout << " userID: " << userID << endl; K- F' [ M3 g8 j- d W* ?6 z+ D
+ u: }) N7 z( C. p! F tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();) J/ |3 U- U+ _- J7 N3 Z+ K
! q9 s% b4 N: n# G& O char *groupName = NULL;
# E6 R) |) i$ X- B2 ~3 r' Y IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));
/ P# y8 b! }" k2 g7 ~/ l cout << " groupName: " << groupName << endl;
. j7 H- V) K2 Q/ Q6 x1 U! z if(groupName) MEM_free(groupName);/ x) h- ^" N7 O
9 O7 `/ {# F2 T6 \2 x+ I1 @$ _" l
tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();5 y5 @2 I2 H( M2 u3 v! w [
char *roleName = NULL;- S e P. y& r$ t* F; \
IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));
4 R( s8 b, Q6 {7 s, u' n- y cout << " roleName: " << roleName << endl;
! j3 [5 c% O& [" `4 B% w. p if(roleName) MEM_free(roleName);
; ]$ P) X1 p0 F A' N2 c2 M
+ `) F/ O0 b) {) [$ R. Q6 t logical isDba = loggedInUser->isUserSystemAdministrator();
2 t* K7 e* N( s: f3 W5 o3 x if(isDba == TRUE) cout << " User is dba member "<< endl;& N8 @- n8 i/ X% P4 S. U# r6 u$ R
if(isDba == FALSE) cout << " User is not dba member "<< endl;
- x2 T, c! V5 W) `; [( g0 }/ G' L}[/mw_shl_code]7 I* p4 V( r! c( v
|
|