|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
1 l5 ?# ~0 v8 E9 N- b: @Teamcenter二次开发源码分享: 获取当前用户信息& a/ D6 ]0 K$ r$ a" V) P: m
4 _& u+ s) j4 r, T* [; J: H[mw_shl_code=cpp,true]#include <iostream>
& E5 e9 B! B2 y4 x( Z& q* G7 F% U#include <sa/group.h>3 k+ z. @3 B$ `* {) n4 i
#include <sa/user.h>
8 ^: v3 h _3 G. J6 Q* L#include <TC/LoggedInUser.hxx>
$ f. G, o- n- w. F+ ^ [: l1 T8 T4 Y/ @3 ^2 _3 ]% _3 v0 ]
using namespace Teamcenter;
. ?! |8 U# O. M9 fusing namespace Core;- T. F4 k) I' l1 K3 Y! n2 i( c
using namespace std;- \, }6 U8 G) p1 W( Z: {
" D, M( L3 O+ X6 H% X' E" jstatic void reportCurrentLoginInfomation()
$ h: p( M4 O/ ]' P6 Z2 k{9 w! _ ^, w% c$ J0 u2 T
int ifail = ITK_ok;! a0 t4 h& v" @2 [2 d
LoggedInUser* loggedInUser = LoggedInUser::getInstance();* H! G9 C `' [/ h) [) n
3 j2 M9 h. B; C
tag_t currentUserTag = loggedInUser->getCurrentUserTag();
$ B& v( s$ M: X* W8 | cout << " currentUserTag: " << currentUserTag << endl;
: M# ]' V8 b- Q/ @) G- e1 l% ~
9 b$ B5 T9 G, `1 p9 ~ char *personName = NULL;+ t+ K0 B9 @! U4 H8 h) @$ O
IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));
5 m# b( m5 s. p' N# u- |, e cout << " personName: " << personName << endl;
9 u& m n% E1 B* t if(personName) MEM_free(personName);# c1 n( t: p1 K7 B$ z* {
) p0 |7 ~# A5 X* D8 a( O const char* userID = loggedInUser->getCurrentUserID();
% p2 o4 a: G" L+ M3 Z3 r+ A cout << " userID: " << userID << endl;
" b6 n' l" M# z* r4 Y5 b+ r
5 B$ G9 j$ k, v" c8 @1 E tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();( k. i V* O( G3 Q! ~
) ^0 |9 w6 Z* G% V: C char *groupName = NULL;; [1 A) S& p: w
IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));
2 C% J: ^0 B" R7 e cout << " groupName: " << groupName << endl;7 Z- K2 m4 |1 [' @* @' d
if(groupName) MEM_free(groupName);+ Q1 ^1 L+ c. z
! @: r$ j4 _ ^. [
tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();) j, y* N, R- o; M- L1 i
char *roleName = NULL;% n# W. U1 u$ P7 C
IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));
# ~( S! v% |" M# h( V cout << " roleName: " << roleName << endl;
+ l# m7 }% u. M if(roleName) MEM_free(roleName);
3 ^0 h, j( C- f9 c/ N 9 n/ h- O8 @* q- z6 b- \
logical isDba = loggedInUser->isUserSystemAdministrator();
- t: j- X! h4 x" z1 H if(isDba == TRUE) cout << " User is dba member "<< endl;
7 J4 N: n( d, m, B3 m- `3 U if(isDba == FALSE) cout << " User is not dba member "<< endl; 0 D& y4 x4 {; i: U# G4 d s
}[/mw_shl_code]% f' d! `& @ I6 _
|
|