|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
3 Z( c% w" t& V0 S8 c9 Z8 j2 k {1 uTeamcenter二次开发源码分享: 获取当前用户信息* _, L/ B/ Q; I2 Q! P% v' e/ ?' B: k
2 V0 o. B |# p
[mw_shl_code=cpp,true]#include <iostream>) e: ]) `! S, u* ^
#include <sa/group.h>
o2 m! J% _3 z1 a5 M0 B h#include <sa/user.h>4 Q! P" y( ^1 L2 | `! G/ R
#include <TC/LoggedInUser.hxx>1 u7 A# O8 |% v! i) _& w: ~8 B# i% n
0 u* ]! L7 m/ f7 m! q
using namespace Teamcenter;) B: @ `/ n: C Y; E8 I
using namespace Core;
$ Y( X; ?" Q6 G6 B2 G$ Tusing namespace std;
( K6 R5 O7 M4 Z) i
/ A- {$ l' J! _" N7 h( d7 _/ ystatic void reportCurrentLoginInfomation()5 \: X' M; n8 r. V* W" E' X6 s; C2 Y
{
y4 f) j. j: d( \, D; L int ifail = ITK_ok;* M ~4 }& x" M5 \# V* |
LoggedInUser* loggedInUser = LoggedInUser::getInstance();
4 x2 \. w' R' k; c
0 x7 U8 A7 i6 s6 {, V% u tag_t currentUserTag = loggedInUser->getCurrentUserTag();& b2 u9 Y; Z1 ?8 x5 q, v# r; k5 h
cout << " currentUserTag: " << currentUserTag << endl;
1 u E, e* D6 c5 E+ K9 I) G) B
2 a0 G; U0 K5 A2 {0 L char *personName = NULL;
; e! B1 H9 t4 w IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));: D8 ?6 i* W5 O5 H8 F5 F) C* H% ~
cout << " personName: " << personName << endl;! G3 i' x' F9 {% z! Y; V8 v
if(personName) MEM_free(personName);8 s0 C& W, f' O. c# S; i2 k
5 u! Q& n# L+ M0 i. O/ q const char* userID = loggedInUser->getCurrentUserID();
9 p+ L4 {% W2 ^ cout << " userID: " << userID << endl;" f t: _( L6 u/ ~
. s4 f1 q: ?& V% t2 J5 ?4 q1 Q
tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();
! g% ?/ _" g5 H* p0 p, ^% z
. T1 j; [! v& V" @; W char *groupName = NULL;
. j6 o. S) T U6 ?" v5 I IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));
) W @" f: t( a% S5 @- p cout << " groupName: " << groupName << endl;& U% t0 R' ^! d8 V+ r+ s
if(groupName) MEM_free(groupName);& Y ]' v. O2 I, {) \! A
% f( [# K% M0 n5 K$ W: a tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();
) S, g, k+ Y8 |9 G1 F char *roleName = NULL;
6 Q4 B# W! P4 q _. ] IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));
1 @! w! G- f0 F4 i: c cout << " roleName: " << roleName << endl;
h( [$ g1 P" p- n if(roleName) MEM_free(roleName);- a! O* z9 X4 f+ P t: J% g9 |1 [$ B
: C$ o3 T6 l9 l( ?$ n' g
logical isDba = loggedInUser->isUserSystemAdministrator();- y$ J k5 i9 Q) {8 U2 T5 t
if(isDba == TRUE) cout << " User is dba member "<< endl;
: p7 L* O9 K% l if(isDba == FALSE) cout << " User is not dba member "<< endl; / M# }* S8 a$ w/ f$ C
}[/mw_shl_code]+ ?% y/ J y+ U3 J: n) Q% s$ O5 s
|
|