|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
/ z1 G) m M& f, _0 @& j& f( n+ g
Teamcenter二次开发源码分享: 获取当前用户信息
J0 W/ Z# _6 f4 x% t. ^/ V# o+ a& A6 Y' H1 I6 A
[mw_shl_code=cpp,true]#include <iostream>
6 a" L$ ^# C9 {! K#include <sa/group.h>1 |3 }& G" [) _- C* ?: a
#include <sa/user.h>
* f" n; @6 f! Q+ d* p* m( k" L7 |#include <TC/LoggedInUser.hxx>
# }: A: P( [* `/ o( J( z9 _4 z
5 m/ |$ a; q9 \- Cusing namespace Teamcenter;- p: ]7 k* S& J1 c' U) l0 X! a8 S |
using namespace Core;
: z; a9 @4 \" c1 e+ }using namespace std;' S7 F( f3 x' P4 u% `
! N. l/ w/ r! ]/ W
static void reportCurrentLoginInfomation()# g( u0 M1 z$ I2 T. N# R$ S- x4 l
{
2 q0 c" L8 \7 Q/ Q! Q) s4 T/ v9 a W8 w1 ` int ifail = ITK_ok;
- _9 [0 z, b6 t; `; K1 Q$ y+ h LoggedInUser* loggedInUser = LoggedInUser::getInstance();. v+ L& Z% r& ? P+ H
% W6 e2 f7 d) R. I+ T
tag_t currentUserTag = loggedInUser->getCurrentUserTag();3 A& P0 ?2 k( K& ~) e+ i
cout << " currentUserTag: " << currentUserTag << endl;
( ^# M3 [* f7 ~ }% x / i$ D" h; _: x# q# J2 ^
char *personName = NULL;& _0 A- N! l& O, H8 X( K5 s
IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));0 R9 ?/ R& q# P0 F6 ^. c7 A
cout << " personName: " << personName << endl;
% |9 ?: Z/ D7 `/ V# K$ U' \) J if(personName) MEM_free(personName);
; |0 S7 m* L" l7 { 9 `6 t& W3 t! y {, U9 T
const char* userID = loggedInUser->getCurrentUserID();7 ^+ k o, b# ~' s" W, Z) ?
cout << " userID: " << userID << endl;
; Q5 E( s# Y; e, ^ ]3 X- M, n+ i1 t: n( L7 W l9 T
tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();
2 b$ P4 l2 O, u : q) c, K) M4 q4 {7 c! ?" y) @
char *groupName = NULL;
" u! j4 e: q1 Q: ^ IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));- ^3 F9 V' |: ?; M# [5 V
cout << " groupName: " << groupName << endl;
, u: T l# n" \: L* t if(groupName) MEM_free(groupName);
% k( N" ]: g. ~; ~
: k! d: ]* t9 `0 m3 T$ q tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();
# t1 O- s) e7 x+ g( j% K char *roleName = NULL;
l+ U6 u4 H7 \$ `8 B; }4 i# h: [7 v IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));
. @; r8 D2 Q" J cout << " roleName: " << roleName << endl;, q4 W# ]6 {5 W6 r% m6 w$ O
if(roleName) MEM_free(roleName);) Z6 `$ m" O0 c q" W
& {) D% y* m% U( D
logical isDba = loggedInUser->isUserSystemAdministrator();
0 C6 H; f1 k, B" m2 v: e9 C0 _ if(isDba == TRUE) cout << " User is dba member "<< endl;
" P; V) W9 J* F( f: X( u+ B* H if(isDba == FALSE) cout << " User is not dba member "<< endl;
/ g% X3 o U7 n/ p}[/mw_shl_code]
. w) u0 i: Q# `! w/ U9 R( { |
|