|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
- Q8 z: q# C5 I" dTeamcenter二次开发源码分享: 获取当前用户信息1 d" _6 _) }5 w7 k- T" H( b
V( s1 u7 K5 j. w
[mw_shl_code=cpp,true]#include <iostream>
# h6 A9 F: _0 J#include <sa/group.h>
2 S/ i# I) P Y# |#include <sa/user.h>/ z' M4 ~, M ?7 h y7 B5 K
#include <TC/LoggedInUser.hxx>- K' S2 Q3 e( h$ _
9 G" s0 @! S1 l7 ^. gusing namespace Teamcenter;1 d4 J) A4 y8 k" t
using namespace Core;' t; D( W7 p5 G( c! _2 d/ A" d; x2 I
using namespace std;
; v1 t: \) M1 B5 O C$ l. ^
$ \8 ]( I% ^: Vstatic void reportCurrentLoginInfomation()
- E% W+ c6 Q/ |8 t& g$ V{& s. ^' S2 L+ U2 ^, m3 Z. q
int ifail = ITK_ok;
B0 d6 L7 w @ LoggedInUser* loggedInUser = LoggedInUser::getInstance();
1 _" j: H# m7 w$ N& @ \( y2 `
* [0 Y2 P3 _2 |$ I7 D tag_t currentUserTag = loggedInUser->getCurrentUserTag();
5 M% }5 W7 p% f g( h5 G; l cout << " currentUserTag: " << currentUserTag << endl;2 `1 A& p: W; x' M3 N* q
5 I" ^! X9 Z& s$ o char *personName = NULL;
$ o% |9 g. v8 Y* N, f. p7 e7 P5 R IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));# b0 C# F* x! B l* |4 a8 T1 m
cout << " personName: " << personName << endl;5 ?, u$ I) n. u2 S( }; n8 u' a% Q) P
if(personName) MEM_free(personName);
0 v% s0 a+ z9 [
; ^& G" @/ S6 D7 ]' G& U const char* userID = loggedInUser->getCurrentUserID();
2 C& W% U x( n! ? cout << " userID: " << userID << endl;) f; V' s& a3 i* G
+ M& r/ U& @, ~. m8 |( y+ P; Y
tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();" h8 D$ o" I+ v7 U% `
, N2 M9 {$ C W8 F
char *groupName = NULL;
+ i0 ]! {1 W0 F! T( ^) P IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));1 g& y: W3 G# V
cout << " groupName: " << groupName << endl;) ?- H* k) K% d5 P5 D
if(groupName) MEM_free(groupName);3 K$ m; C) @+ Y$ F6 R4 `; e1 w
! i. t& {9 N) w) s tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();
: I( b1 c. \$ K. [$ u( ] char *roleName = NULL;
9 m: q: K. G& n( Y IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));
9 B. U8 \# v' ^& V cout << " roleName: " << roleName << endl;
$ W* q6 L" i1 P" y if(roleName) MEM_free(roleName);
* J. ^ S2 I, \8 H. A; p. R1 M
3 p) B9 ]) b3 J7 [, ] logical isDba = loggedInUser->isUserSystemAdministrator();
# `; _) p" T9 ]) T0 f if(isDba == TRUE) cout << " User is dba member "<< endl;+ c% p- E5 g5 U* Y2 w7 u
if(isDba == FALSE) cout << " User is not dba member "<< endl; + L# [# @' w( Z$ W" I+ y
}[/mw_shl_code]
( ~, a2 k5 c6 D |
|