|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
( B9 a1 |$ o) f1 o; t
Teamcenter二次开发源码分享: 获取当前用户信息& d/ D9 `5 p' l- ?2 @3 r
, s7 k% K2 P# _8 e& d( C+ [& G[mw_shl_code=cpp,true]#include <iostream>
6 a8 U7 z- o0 P#include <sa/group.h>% y. m6 E) U r& ]9 s/ F; P# Q
#include <sa/user.h>
7 M0 r& K7 q2 E0 |" b#include <TC/LoggedInUser.hxx>6 r( [) {& ]( ^' z& m1 u- \
% z* Q; \% d. E4 \using namespace Teamcenter;
/ M2 Y5 L( c/ e5 z/ q8 m0 A+ a/ rusing namespace Core;) t/ @, p) h7 Z- F2 H
using namespace std;
' d: i) f1 T) _. \1 ~0 \
6 q9 c" |3 K" S+ c. Ustatic void reportCurrentLoginInfomation()( K2 e4 ~+ i! a
{
- _ a2 p( @, x0 ]9 m% D: A int ifail = ITK_ok;: P2 D$ u0 t+ C; u# |0 D
LoggedInUser* loggedInUser = LoggedInUser::getInstance();4 Y' n& O2 z8 [* L/ `
1 C( H+ T% Y! F) D tag_t currentUserTag = loggedInUser->getCurrentUserTag();$ W' X9 P4 Y; \" J9 \
cout << " currentUserTag: " << currentUserTag << endl;2 M' w( S' Z3 b; m6 s# l
1 f0 P9 v. \+ c u _ char *personName = NULL;( u& k |- x3 h8 t4 B( @; h
IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));8 l( e6 y5 @ C5 a2 T4 ^
cout << " personName: " << personName << endl;: l, w1 F/ m1 c/ Z' D
if(personName) MEM_free(personName);
% c* S! h% W7 P , W" \; W: D4 T( b
const char* userID = loggedInUser->getCurrentUserID();
0 v) Y5 K- v1 C' {# _ cout << " userID: " << userID << endl;$ F& N+ q) X- T1 s1 t G
^0 e8 Z. O! [ tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();0 W: k" Q; N# P7 F# R3 ]! V
# r8 |$ }' i$ l7 e0 P% E; i
char *groupName = NULL;
7 S. o, @1 ]- u! u% X2 z+ F$ n IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));! b' _2 w! Z( Y$ I) V3 N9 I
cout << " groupName: " << groupName << endl;
- V) p, {5 w) t2 C$ V0 e if(groupName) MEM_free(groupName);
0 k9 l( @( M4 d5 T5 }4 J! a. e% ?
tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();
, {# } p5 p6 T! p; M, G char *roleName = NULL;, w7 @- `3 T2 r
IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));
, a* R: W$ H: k+ t- G: H4 X$ | cout << " roleName: " << roleName << endl;
% f6 q" y* D, R8 C if(roleName) MEM_free(roleName);
% h8 w5 B5 H$ p& c# Q( B
6 o7 k( {- h- u' ?6 ] logical isDba = loggedInUser->isUserSystemAdministrator();2 j6 v5 @ x( Z) y& ~1 q3 F
if(isDba == TRUE) cout << " User is dba member "<< endl;
: j, J( C6 N0 ` M& ~8 g, J! V if(isDba == FALSE) cout << " User is not dba member "<< endl;
% D. \' z1 _" a) q' L}[/mw_shl_code]
* `: X' l& u5 E5 P+ _1 i |
|