PLM之家 UG NX11.0二次开发(ufun和NXOpen C++)网络培训火热报名

PLM之家-上海点团信息科技有限公司工业4.0数字化软件官方知识管理平台

查看: 319|回复: 0

[服务器端ITK] Teamcenter二次开发源码分享: 报告用户登录信息

[复制链接]
  • TA的每日心情
    无聊
    前天 09:37
  • 签到天数: 103 天

    连续签到: 9 天

    [LV.6]常住居民II

    1919

    主题

    3193

    帖子

    5万

    积分

    管理员

    PLM之家mildcat

    Rank: 9Rank: 9Rank: 9

    积分
    57835
    发表于 2017-11-20 13:49:47 | 显示全部楼层 |阅读模式

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

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

    x
    Teamcenter二次开发源码分享: 报告用户登录信息


    Teamcenter c++ 方式:


    #include <iostream>
    #include <sa/group.h>
    #include <sa/user.h>
    #include <TC/LoggedInUser.hxx>


    using namespace Teamcenter;
    using namespace Core;
    using namespace std;


    static void reportCurrentLoginInfomation()
    {
        int ifail = ITK_ok;
        LoggedInUser* loggedInUser = LoggedInUser::getInstance();
       
        tag_t currentUserTag = loggedInUser->getCurrentUserTag();
        cout << "    currentUserTag: " << currentUserTag << endl;
       
        char *personName = NULL;
        IFERR_ABORT(SA_ask_user_person_name2(currentUserTag, &personName));
        cout << "    personName: " << personName << endl;
        if(personName) MEM_free(personName);
       
        const char* userID = loggedInUser->getCurrentUserID();
        cout << "    userID: " << userID << endl;


        tag_t currentGroupTag = loggedInUser->getCurrentGroupTag();
       
        char *groupName = NULL;
        IFERR_ABORT(SA_ask_group_name2(currentGroupTag, &groupName));
        cout << "    groupName: " << groupName << endl;
        if(groupName) MEM_free(groupName);


        tag_t currentRoleTag = loggedInUser->getCurrentRoleTag();
        char *roleName = NULL;
        IFERR_REPORT(SA_ask_role_name2(currentRoleTag, &roleName));
        cout << "    roleName: " << roleName << endl;
        if(roleName) MEM_free(roleName);
       
        logical isDba = loggedInUser->isUserSystemAdministrator();
        if(isDba == TRUE) cout << "    User is dba member "<< endl;
        if(isDba == FALSE) cout << "    User is not dba member "<< endl;      
    }





    Teamcenter ITK 方式:


    /*HEAD REPORT_CURRENT_LOGIN_INFOMATION CCC ITK */
    static void report_current_login_infomation()
    {
        tag_t
            current_member = NULLTAG,
            current_user = NULLTAG,
            current_group = NULLTAG,  
            current_role = NULLTAG;
        char
            person_name[SA_person_name_size_c+1] = "",
            user_id[SA_user_size_c+1] = "",  
            group_name[SA_name_size_c+1] = "",
            role_name[SA_name_size_c+1] = "";  


        IFERR_ABORT(SA_ask_current_groupmember(&current_member));
        IFERR_REPORT(SA_ask_groupmember_user(current_member, &current_user));
       IFERR_REPORT(SA_ask_groupmember_group(current_member, &current_group));
        IFERR_REPORT(SA_ask_groupmember_role(current_member, &current_role));


        IFERR_REPORT(SA_ask_user_person_name(current_user, person_name));
        IFERR_REPORT(SA_ask_user_identifier(current_user, user_id));
        IFERR_REPORT(SA_ask_group_name(current_group, group_name));
        IFERR_REPORT(SA_ask_role_name(current_role, role_name));


        ECHO("\n        Person: %s\n", person_name);
        ECHO("       User ID: %s\n", user_id);
        ECHO("         Group: %s\n", group_name);
        ECHO("          Role: %s\n", role_name);
    }

    上海点团信息科技有限公司,承接NX,CATIA,CREO等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施开发培训,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com
    回复

    使用道具 举报

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

    本版积分规则

    <

    QQ|小黑屋|手机版|Archiver|PLM之家-工业4.0数字化驱动之家 ( 沪ICP备13003373-3

    GMT+8, 2018-1-21 05:14 , Processed in 0.124783 second(s), 28 queries .

    快速回复 返回顶部 返回列表