|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
1 l- f# ]6 {" @% _. D% S5 y
Teamcenter二次开发源码分享: 获取当前用户信息9 F/ \; x; [% b
. _' C3 A- N+ K4 h[mw_shl_code=cpp,true]#include <iostream>
7 \& V+ _! W+ }6 |' P F9 G#include <sa/group.h># N# m5 P5 L' w& X( t: g
#include <sa/user.h>
% ?: p! l: J G1 h; c3 Z) g4 u/ ]#include <TC/LoggedInUser.hxx>
8 s, F0 B# V; z, Y B' P; t9 s1 Z, I! l2 v, Q, K% h4 b, E
using namespace Teamcenter;
6 y4 Q1 s8 e3 U( v2 ~5 W0 uusing namespace Core;
! o! ]3 t5 ~/ u" Cusing namespace std;& H: {: V$ b! \4 ^7 H# l( G* T: m
8 y5 r; w8 Z3 ^/ W5 Z- b
static void reportCurrentLoginInfomation(); A& _1 l; O* A# a
{
1 J+ U3 O) A# ?/ \2 X0 d) N F int ifail = ITK_ok;8 v% N. S" Q' n0 P
LoggedInUser* loggedInUser = LoggedInUser::getInstance();" e5 D: P$ [6 R4 [+ s6 k+ N
1 m' n* {- M# P3 B( a* t* g
tag_t currentUserTag = loggedInUser->getCurrentUserTag();, ]% Z3 N; `: R. ^ w+ C4 j' J
cout << " currentUserTag: " << currentUserTag << endl;
4 o4 i0 h. e6 v, h, P4 n3 R! h 4 T7 s1 `0 l6 S/ A/ ^- f
char *personName = NULL; U, _9 W1 @6 p3 n! ^% k9 p; G/ p
IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));7 {4 L6 ?% _6 l2 S' m% m5 _
cout << " personName: " << personName << endl;
$ m' l) E2 g6 ~0 @+ C6 Q+ V2 L$ N0 Y8 ] if(personName) MEM_free(personName);9 w* O7 Y. f1 X2 \6 b3 r, F
4 G+ T- l+ H+ m9 S: M& \; l
const char* userID = loggedInUser->getCurrentUserID();5 K) v! L7 u# R/ U9 `& q* X
cout << " userID: " << userID << endl;* A. Y, L! L6 C0 O" F7 O' U& ^
3 h q2 `2 R: {/ [2 B! v" `/ u) ]
tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();, _* h) |1 B0 s& J
6 I& L) G! l, [& e
char *groupName = NULL;
7 `% R8 E- Z* J9 N# x7 V9 g IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));
$ B+ {- Z4 J `+ N- y+ R cout << " groupName: " << groupName << endl;" F! N X. T5 e, L' R
if(groupName) MEM_free(groupName);
. H) i3 }" ~8 q5 T* P7 j4 f
3 ~8 R2 ]1 T3 y1 b8 m7 I2 O7 Z7 f tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();
5 ~1 C+ b; y5 O5 `+ l, U8 b char *roleName = NULL;4 Q! l3 J' Y `0 h
IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));
2 Y9 W3 m2 Z! l7 W8 v- J cout << " roleName: " << roleName << endl;
4 W0 y; }' j+ i if(roleName) MEM_free(roleName);
2 E+ Y0 }; R$ J! W5 K
) Y! `2 {2 W7 X! f u9 ? logical isDba = loggedInUser->isUserSystemAdministrator();* ^6 I& `3 C/ [) m6 W
if(isDba == TRUE) cout << " User is dba member "<< endl; p2 J. ?7 ?" Q& O
if(isDba == FALSE) cout << " User is not dba member "<< endl; : |8 N3 Y, }' }. S
}[/mw_shl_code]" P( K7 w U3 ]0 u* w/ b
|
|