|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
) [. w& m" ]& B
Teamcenter二次开发源码分享: 获取当前用户信息
" D% \4 t% O3 f- H W( ?- G6 x( s9 D. P. T, L
[mw_shl_code=cpp,true]#include <iostream>
! x" K( S7 e. x/ d#include <sa/group.h>4 F2 e) @3 j h2 R. v+ H% H7 p
#include <sa/user.h>8 e3 h0 ~; W8 D6 z
#include <TC/LoggedInUser.hxx>
' \& ^9 ?# G( d$ q4 Z3 t8 d& ~$ ]; C! a9 L
using namespace Teamcenter;: r, @% V3 {2 k2 ^' x: C
using namespace Core;% i# u0 o; s( ~* K% J2 ?3 H. U
using namespace std;3 ]( g/ ]( ]6 R4 ]6 U$ G
# {- p5 U$ F/ z: ustatic void reportCurrentLoginInfomation()0 i& w0 Q/ `/ q9 x+ H
{" t3 p. ^. _9 p; f) j3 X/ s; J, g
int ifail = ITK_ok;9 @2 G# B0 i: G. D
LoggedInUser* loggedInUser = LoggedInUser::getInstance();& g7 l' h8 v' i
8 ]9 D+ R1 Z7 P8 Y+ m |
tag_t currentUserTag = loggedInUser->getCurrentUserTag();
% q) F# _' o6 I cout << " currentUserTag: " << currentUserTag << endl;
; Z# q, d; J2 c ' b1 j+ c, ^$ s! g4 q& x
char *personName = NULL;
2 ?7 _6 p- ^0 Z# Z9 L% O" [! t" F IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));3 c4 D/ I# Z( Y
cout << " personName: " << personName << endl; ?5 d/ p, j, I/ E$ } v
if(personName) MEM_free(personName);
/ B2 `# B: _$ [ , m! ]0 @8 U2 q6 [7 Z1 D
const char* userID = loggedInUser->getCurrentUserID();2 p" N) ~) F; I; p1 ` T- q
cout << " userID: " << userID << endl;8 i/ V' i% a5 z3 L9 @ r! E# Y4 I; `
# i# `6 k( j: a5 j
tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();
* y' e- r$ E8 Y; P% @1 n1 w9 R, } / h& ^+ ?0 y$ F% N5 D. h3 @2 w
char *groupName = NULL;
4 B$ J( |" w7 u% S- D IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));
) U8 S. Z9 l, f" @( W cout << " groupName: " << groupName << endl;
0 N. |( d' |4 c, j( b if(groupName) MEM_free(groupName);
* `: t" r3 G& K# w- y4 Z& n3 }4 q* C+ o, o
tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();
) q3 Q# i( l! L$ {7 s! L* K( q char *roleName = NULL;
9 i7 a/ |5 ]! c- a* l- o9 z+ v IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));( J& U l' ^4 L) B
cout << " roleName: " << roleName << endl;, y+ e! y1 C. |0 }4 j
if(roleName) MEM_free(roleName);# m1 i3 F$ D4 X! }. A* t% M
, R' U5 M" o$ S$ L/ ]; S
logical isDba = loggedInUser->isUserSystemAdministrator();
5 ]& M, y0 _5 H if(isDba == TRUE) cout << " User is dba member "<< endl;6 }8 i/ N$ ^; X3 G% m
if(isDba == FALSE) cout << " User is not dba member "<< endl; & I" K) I) V$ z, b
}[/mw_shl_code]2 v' l, l/ S. p# H5 X0 |
|
|