|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
" j. y8 ?* P5 g/ ~+ n2 C9 s
Teamcenter二次开发源码分享: 获取当前用户信息
. d; k- t' q/ d9 n+ z: t
: a& R7 i7 e0 w[mw_shl_code=cpp,true]#include <iostream>+ |! g6 Y5 W. o: v
#include <sa/group.h>
8 @) K3 l& _$ S' |0 f9 x. h7 m6 k#include <sa/user.h>
5 J0 N# O% C1 Q9 O l& }, [#include <TC/LoggedInUser.hxx>' `( b) E; j+ P! L
: \/ ` t E, Dusing namespace Teamcenter;: U6 `$ T$ c! R
using namespace Core;
% H& B2 s9 Z8 _6 G0 Qusing namespace std;8 a8 c" O, u @3 |- a
) J$ L8 d; u) Q4 B; o0 gstatic void reportCurrentLoginInfomation()
% F: D/ L! j4 e0 a, |, T0 ^. t P" I{
( x( B. n) k$ n( m1 n! Y int ifail = ITK_ok;3 K2 w$ ]% ^# s
LoggedInUser* loggedInUser = LoggedInUser::getInstance();
; W7 U$ S9 n+ Y6 ]# x & p9 ?% N; y. E1 P% W& }1 d
tag_t currentUserTag = loggedInUser->getCurrentUserTag();
7 H- F" S8 M* Q% E7 k0 E cout << " currentUserTag: " << currentUserTag << endl;
8 z$ W3 f' p* [9 m( S1 }( n( k6 v
6 n! {5 x( e- j6 l' S- m char *personName = NULL;+ ^( T; |9 E3 B" L I" m
IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));
1 P, Q7 q" q# L% D% A cout << " personName: " << personName << endl;
" v% g! @; ^# z9 i: t* E if(personName) MEM_free(personName);) ^! H# i& o3 v& r
2 b) m2 y% ?1 x V const char* userID = loggedInUser->getCurrentUserID();
' `- T; P+ \0 z9 P3 O3 k cout << " userID: " << userID << endl;
$ \" w# a! Z) S+ W% y1 K
1 O ?4 `; O. D7 A3 F tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();6 J& v% d" C3 P- C4 M- @( m
& U1 Q' H$ O2 G char *groupName = NULL;" [2 U' w/ d+ U5 e6 M" m4 m5 @5 _
IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));! e0 L D4 K+ R) D. T: p1 }
cout << " groupName: " << groupName << endl;, O1 H$ @/ ]2 C! F
if(groupName) MEM_free(groupName);
" S# b; p3 g7 s' _0 J# P9 U ?5 y+ R0 w/ @& ^
tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();
4 C2 f2 a8 E; A0 z char *roleName = NULL;
( C9 ?1 L0 d& c9 J IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));
( t7 n4 L8 P' v& ?% b7 i8 q cout << " roleName: " << roleName << endl;2 @3 u, {; `0 m( f
if(roleName) MEM_free(roleName);
& K* E, B; ]3 z1 r
- M9 }% [; k S5 ? logical isDba = loggedInUser->isUserSystemAdministrator();
& X* x6 r+ z# K% A6 | F if(isDba == TRUE) cout << " User is dba member "<< endl;
) [, v: _: y! M4 N3 e, h if(isDba == FALSE) cout << " User is not dba member "<< endl; ' }$ q0 Z& S8 [- m5 Z
}[/mw_shl_code]2 t% n; @8 [# b& D
|
|