PLM之家PLMHome-工业软件践行者

Teamcenter二次开发源码分享: 获取当前用户信息

[复制链接]

2020-2-8 09:34:22 2389 0

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

积分
82168
QQ
发表于 2020-2-8 09:34:22 | 显示全部楼层 |阅读模式

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

x

4 Y/ j$ o! A2 ?" v4 C! r  N% oTeamcenter二次开发源码分享: 获取当前用户信息
* \, C) {( }9 A5 p0 e4 S! K9 u6 s: O2 n* Z4 @$ I
[mw_shl_code=cpp,true]#include <iostream>
6 i9 i+ v- s6 c$ k#include <sa/group.h>; t5 ^- a: h* n" N
#include <sa/user.h>
5 b: x: @5 K2 ?1 P#include <TC/LoggedInUser.hxx>; s; [" e; s3 Q. V+ W/ h
5 M( M* R3 O% c1 i
using namespace Teamcenter;
  d7 g5 B7 h6 d/ i4 q, O6 ?5 _using namespace Core;
0 B8 _5 K2 v3 z- ?. fusing namespace std;
& d! K- m' A- S0 K2 u9 X0 D4 r0 \' J/ ~2 {* ]
static void reportCurrentLoginInfomation(), ?; ?* |" d' x! E; q8 ]5 ]5 M$ l
{
6 m- a$ R, u) v+ ~! \8 \    int ifail = ITK_ok;
& \; R& @1 g& i# \( r3 }. L    LoggedInUser* loggedInUser = LoggedInUser::getInstance();
5 Q% S4 V& {5 r- M$ [: a    ! G5 s9 ^$ X1 K+ ]
    tag_t currentUserTag = loggedInUser->getCurrentUserTag();
2 _3 f* G* b) x: q7 B    cout << "    currentUserTag: " << currentUserTag << endl;  K5 @* d! f% h7 z
      P2 U- e7 D# _( {
    char *personName = NULL;4 E  P: e' l/ _# F- n
    IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));7 k6 T, Z; M' O% M# r5 K5 X
    cout << "    personName: " << personName << endl;
; u7 f$ `2 g3 {5 L$ y, T) a& A    if(personName) MEM_free(personName);
0 W" u4 _' @' O: \( @0 J6 V   
# H, c! ?; q& J    const char* userID = loggedInUser->getCurrentUserID();# V1 F( S& c& q0 f$ V. g9 L
    cout << "    userID: " << userID << endl;. ~: I; U) w5 j" y6 n$ M/ s
. Q2 @  K) J. r' c' a/ M, `
    tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();& Z6 a: `1 l% G3 Z" n9 x
    5 B/ Z0 t. a' O1 y+ J
    char *groupName = NULL;
: w' L; S( y' n; g. K/ A    IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));
$ W4 T6 n3 u0 @$ X    cout << "    groupName: " << groupName << endl;6 `, o, o, o. K( x* [) h( s
    if(groupName) MEM_free(groupName);& N: {1 [* s, h8 q2 A
$ n6 m+ Z* L5 e  X* c7 X7 d
    tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();
' z4 q4 _6 y$ c% m    char *roleName = NULL;) M7 H8 F" f6 i% u0 ?$ E
    IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));
( h/ I1 c! O& ]' O# q- `& E8 Z    cout << "    roleName: " << roleName << endl;
- L, r# L6 A7 c6 J6 `; G7 v    if(roleName) MEM_free(roleName);3 t( L" |& y2 T! l  H* S) c
   
8 Q0 \- \7 F' l  ~    logical isDba = loggedInUser->isUserSystemAdministrator();
, z! n) {# V0 P& X% n' ?    if(isDba == TRUE) cout << "    User is dba member "<< endl;
& {+ P" @- J+ l- J    if(isDba == FALSE) cout << "    User is not dba member "<< endl;      
& N+ ~) Y1 i+ R; f( I2 b}[/mw_shl_code]: \% N# G: X3 l4 L" J3 A6 Q+ u0 B
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 注册

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了