|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
a- M2 P' S! MTeamcenter二次开发源码分享: 获取当前用户信息4 }" Y* A9 o3 _: K$ g
Q7 R$ b7 }- C" b4 U" b0 ^, d[mw_shl_code=cpp,true]#include <iostream>7 }* H9 R; C& H3 u* W; e
#include <sa/group.h>5 B1 U. z/ {. V0 v3 r, b' P( v) p
#include <sa/user.h>/ f2 l1 q* H! t8 W. |) y7 H
#include <TC/LoggedInUser.hxx>' {6 S7 Q" \( v, s: \4 ~
* L$ V5 c4 N8 X1 L. y
using namespace Teamcenter;
! Q3 q0 n! X+ }' M' E, j: l2 uusing namespace Core;/ ?% `# h* x% C$ O" e2 O9 m
using namespace std;: v, ?1 m* W# w1 ]
_$ o5 J1 s4 E g' t
static void reportCurrentLoginInfomation()3 O5 `5 H* x( `* N ~3 b- r1 u/ I: Z
{" S* R+ ~6 x0 P% q5 g2 h
int ifail = ITK_ok;- d8 l' V0 t* j5 |( B4 A, |
LoggedInUser* loggedInUser = LoggedInUser::getInstance();
: q2 m9 w2 M* ~* E, d8 p9 f
6 j( \( u( b; P. Z6 L tag_t currentUserTag = loggedInUser->getCurrentUserTag();
- S" i& x, ^! J" W" z, ? cout << " currentUserTag: " << currentUserTag << endl;' Y# ^( V& b9 D; d
; i' u6 v; V" ~! |! X% {
char *personName = NULL;
1 |; l" T/ {6 V3 @1 n6 e2 { s, ? IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));
5 f: Q' C. e4 u- T& j cout << " personName: " << personName << endl;
. b! q n0 c3 W# I if(personName) MEM_free(personName);
n) D2 ^2 K5 o7 `- ]" t' O
x- `, H0 G! @* r& R const char* userID = loggedInUser->getCurrentUserID();
' @: A+ r& H7 X cout << " userID: " << userID << endl;
* H) X) N9 n( w" s, T
V' V$ o; b/ _2 |/ f. O- a r tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();$ Z s2 y8 I# m5 U2 z
8 y0 s8 m9 p3 w M) z4 c5 g
char *groupName = NULL;
$ y/ t# C# B5 ~' R# U IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));
4 u' ]- J" x: Q1 A cout << " groupName: " << groupName << endl;, A# [" ?1 w I( }
if(groupName) MEM_free(groupName);
0 E) x, g6 G3 u" z
/ l6 P9 b$ F' H) d; y( l: }' h tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();/ O4 G) L2 N6 K2 U+ S6 ?
char *roleName = NULL;
5 Q% O+ l' W. C R. K IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));
8 T' T- v. y' g- Z5 Y" F& o, Z cout << " roleName: " << roleName << endl;
5 E' v3 f6 U |* ?9 Q if(roleName) MEM_free(roleName);
, p* R U: X! W p$ y6 u 2 S: z" ~' S8 X0 d, p/ {: A& q
logical isDba = loggedInUser->isUserSystemAdministrator();
3 Q. C& E% u7 T3 f4 D/ X if(isDba == TRUE) cout << " User is dba member "<< endl;2 \+ }8 R& i; `- \% R0 s
if(isDba == FALSE) cout << " User is not dba member "<< endl; * X" `! R. J" I# _
}[/mw_shl_code]" W0 k- K0 M! i7 d6 t: |( `
|
|