|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
) l( q4 R4 q5 aTeamcenter二次开发源码分享: 获取当前用户信息* I/ I$ v$ J0 o" N
# [: q3 y R* a# P6 u; N[mw_shl_code=cpp,true]#include <iostream>
0 K$ A; I4 Q- y" Y#include <sa/group.h>5 l" S+ k3 T( R3 k5 @, Z D" B" \
#include <sa/user.h>1 I7 L1 y0 q& E4 F! w8 X* H4 D
#include <TC/LoggedInUser.hxx>" l! N% l5 C: C& [; t7 R: _) c2 N6 Z
( |) }5 Q, g) i( N$ Cusing namespace Teamcenter; c" W& R2 R: K @ N
using namespace Core;
# `, n f* n2 C) O( Z+ pusing namespace std;# a( J/ E j: `0 U C
/ d. O5 K9 R9 t. `- P* Z9 @1 }static void reportCurrentLoginInfomation()7 p: f( d6 y! z1 \0 A: s! ]" Q
{
* ?1 f2 @6 w( w' R) v+ u int ifail = ITK_ok;
0 K. j$ u& f. Z) A9 o, V! f R* a+ p LoggedInUser* loggedInUser = LoggedInUser::getInstance();/ E6 D6 p- K( d% z. R# U
' t- A, U) w/ k: [! Z# n
tag_t currentUserTag = loggedInUser->getCurrentUserTag();' q6 D, v, t# l# F' ?0 s
cout << " currentUserTag: " << currentUserTag << endl;. C9 {7 i# I$ q" ?6 Z
' U0 R& f5 o- T8 @ char *personName = NULL;: l% }! c6 S1 s! {% z
IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));
3 {" w# m3 P% s% R cout << " personName: " << personName << endl;; f! A! e# j% T% `1 F2 D* P5 w
if(personName) MEM_free(personName);6 e; {9 I' O' t4 d. x" @; q
5 Z7 B8 U# w. A8 G
const char* userID = loggedInUser->getCurrentUserID();* I: k. ~& G0 u; Z" r; G
cout << " userID: " << userID << endl;6 N' ~8 f. ^1 w O
. f/ d* V5 ?$ @7 ` tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();
: K/ o& `/ r7 @1 e0 K3 u ! P1 m8 S3 v0 W6 X! l3 [" G! O2 [! F8 c
char *groupName = NULL;
- {, d: O3 X9 H7 y+ G7 b" v IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));
& |' ^" u' @8 K5 y/ M1 U! H cout << " groupName: " << groupName << endl;! J& K! l& |/ R
if(groupName) MEM_free(groupName);
7 W2 m( x h9 x4 \
, `0 P1 t; j' E; b tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();- Q5 h! r- a% j" {9 z+ T
char *roleName = NULL;( Z* g- C* u3 e$ n* \
IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));, t, y, m! Y K! E, `" C2 w$ s
cout << " roleName: " << roleName << endl;9 z; l* A# A! T1 G6 n9 v. |6 Q, `
if(roleName) MEM_free(roleName);/ C7 i/ X' i7 g5 S1 f2 l/ ^
& \$ I4 K7 E F7 d9 F+ a logical isDba = loggedInUser->isUserSystemAdministrator();, h& h J. {7 I* W; a1 H
if(isDba == TRUE) cout << " User is dba member "<< endl;0 j! B% I* K) R7 B5 \8 G% S
if(isDba == FALSE) cout << " User is not dba member "<< endl; 8 q2 E3 R3 N( f$ Y+ H
}[/mw_shl_code]0 }% D# h" }+ W. x
|
|