|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
' s" |' c$ \5 i0 L9 k. zTeamcenter二次开发源码分享: 获取当前用户信息
5 \. \3 l! Q! T# I, u v1 G
" F! }9 W2 k) e. O[mw_shl_code=cpp,true]#include <iostream>4 ?0 J* v/ K& \
#include <sa/group.h># [/ v- m7 f% {0 L+ ^) r
#include <sa/user.h>$ y# ]7 t( b% T7 p: }; `
#include <TC/LoggedInUser.hxx>
, e* `! e5 A6 k K4 }9 H& ?1 l! b9 G& g0 H% w* ~
using namespace Teamcenter;9 c0 N0 G6 p" T: g# l
using namespace Core;' q: @2 S! f5 I, y, `. @
using namespace std;+ r; G9 q9 ?" J9 [( Y
$ {; t7 K( M5 G& Z% Y2 ` Qstatic void reportCurrentLoginInfomation()7 g8 S% W5 w4 w% C: }; ]
{4 z! O; S0 r+ x: k: G; p
int ifail = ITK_ok;
! n9 G# M/ {2 r/ Y/ t3 c LoggedInUser* loggedInUser = LoggedInUser::getInstance();
* @" B! s- {. y1 p% N+ N , {4 d2 ^9 `! c; v2 K# ?
tag_t currentUserTag = loggedInUser->getCurrentUserTag();
4 }: [: C t7 M7 ?4 K9 J0 Y6 F5 J4 y$ \1 P cout << " currentUserTag: " << currentUserTag << endl;/ T: t1 e5 h) \& M1 S; ?7 S
: [% L" h3 `& O A& M( l4 t5 u char *personName = NULL;
% d0 o2 N1 @: R* _' e+ g7 S; K IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));( v$ C9 @6 C& x1 M7 v1 g" T
cout << " personName: " << personName << endl;
8 {! F( ^, j7 c2 T- d4 c3 r! x if(personName) MEM_free(personName);
4 L# X1 e5 y i2 p2 w& S) {1 C! w
( h1 S: F9 `! f6 b+ y+ a3 @$ ^ const char* userID = loggedInUser->getCurrentUserID();" s5 L/ C C* E7 [2 r( F: @7 _# s
cout << " userID: " << userID << endl;: y X; K r# \
1 Q0 {: s3 G' K7 U
tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();4 B7 U9 h- ]. f! l3 y9 O
! F: v8 _- W8 k char *groupName = NULL;
3 ?: {0 u4 A& V6 }7 ] IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));4 |2 r8 X- ]8 L. x% P0 R# D; J
cout << " groupName: " << groupName << endl;
' I5 S- n) D4 j% q, S+ f if(groupName) MEM_free(groupName);3 N& N! i# D# K; k. e ~
( F7 M! I7 u9 i* L$ H- ~ tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();
0 V9 b$ `* s* y! B char *roleName = NULL;5 ^7 f5 P+ H- v6 p( N. v9 Z9 e0 a
IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));
$ ~. R. Q" \, q! d+ X& L: k cout << " roleName: " << roleName << endl;1 A6 `* Q. `% d# \: q
if(roleName) MEM_free(roleName);; P& c& ]3 o( S! S, J* H
' ]% \2 H# x" X; w4 t, ^
logical isDba = loggedInUser->isUserSystemAdministrator(); H5 C% Y4 {' v0 f
if(isDba == TRUE) cout << " User is dba member "<< endl;
8 k8 m! ?% B6 Q% a5 z: T if(isDba == FALSE) cout << " User is not dba member "<< endl;
+ n, }( H$ d$ b6 c- Q}[/mw_shl_code]
5 v( u }1 I5 r |8 Q; N* f- U2 U |
|