|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
8 _5 y$ |. E* F8 U4 N; @/ U$ ~Teamcenter二次开发源码分享: 获取当前用户信息& Y5 w* R$ e1 G+ I, |& t$ t
4 q" l3 R2 b4 V- }
[mw_shl_code=cpp,true]#include <iostream>' J& K! v& c' v# F$ ~' O! |
#include <sa/group.h>: p; o! l- i6 j% l7 N: ]# P6 m
#include <sa/user.h>
' s* N- m6 p( i& \' e#include <TC/LoggedInUser.hxx>
1 T2 _/ d( A' p* l3 l
: W6 B6 M4 g l) l* h% a6 B! ausing namespace Teamcenter;( Z: z9 h$ v9 s& r9 z
using namespace Core;
8 m+ ~7 y/ [0 ]7 J8 F Yusing namespace std;' T6 r5 U9 d/ t% L9 ^
( K+ f0 ~9 m2 l: P, wstatic void reportCurrentLoginInfomation()
. t- V2 e4 B) _* k{
' o( `/ \0 E2 L/ z) O int ifail = ITK_ok;% F# Q1 U8 n7 f m
LoggedInUser* loggedInUser = LoggedInUser::getInstance();- G( e: k+ \, W9 F" r. x% |7 R. H
+ {0 E& }1 L# w6 ^0 I
tag_t currentUserTag = loggedInUser->getCurrentUserTag();
5 _6 I0 p. o. L6 ~" G+ W+ \, H cout << " currentUserTag: " << currentUserTag << endl;
) [) o6 {) Y# t- ?! x0 A+ a
% O9 i3 C, n6 j! c7 H% J0 y char *personName = NULL;9 L% @% K6 A) h+ L& G
IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));, l. l/ ^. r1 f
cout << " personName: " << personName << endl;( @+ D& p( h* u. J
if(personName) MEM_free(personName);: q d" B; @( I9 N" g' [
1 i' ^; G c, H, V4 a( O
const char* userID = loggedInUser->getCurrentUserID();
! w+ n& y& x* a* `- R cout << " userID: " << userID << endl;9 S/ |" f8 x6 c! ~8 z
5 b- k: l5 n( ~, |
tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();+ O ^+ s! K" y7 I" \& E- }3 i) v
$ N# i5 X% [* s6 O1 @8 d
char *groupName = NULL;5 Q4 h! [) E/ `8 T0 _
IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));
& T3 c, L- k2 ?5 b/ A p cout << " groupName: " << groupName << endl;% G- E, U' f; ~; B
if(groupName) MEM_free(groupName);# J1 f$ D! f0 J/ v8 `( \
* f) w. X/ K3 y `' G
tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();
& L$ _0 R6 V7 M( l char *roleName = NULL;6 c, o% g1 }2 h
IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));
1 e, q" J. p, Z2 C( S* ^ cout << " roleName: " << roleName << endl;
9 o( P3 R( x" I& m& ]: P if(roleName) MEM_free(roleName);
( o8 x6 s# J7 T2 _$ D/ G9 E
# ~$ z8 V5 S1 G0 s6 | logical isDba = loggedInUser->isUserSystemAdministrator();
( `2 w' m4 C$ ~; X# v$ b if(isDba == TRUE) cout << " User is dba member "<< endl;+ }7 p# v$ o H7 q
if(isDba == FALSE) cout << " User is not dba member "<< endl;
+ s* @) e. y8 ] R* v9 G}[/mw_shl_code]( U6 Y; l6 P: d; Z* x- l
|
|