zoukankan      html  css  js  c++  java
  • 禁止同一用户 多次登录

    void startupPost()
    {
        int         counter;
        int         maxUserSessions = 1;
        int         maxAdminSessions = 4;
        int         num = 0;
        int         maxSessions = Info::licensedUsersTotal();
        xSession    session;
        UserInfo    userInfo;
        UserId      currentUserId;
        UserGroupList   UserGroupList;
        FormRun         formRun;
        ;
        currentUserId = curuserid();
        if (currentUserId == 'Admin')
            return;
        for(counter = 1; counter < maxSessions;counter++ )
        {
            session = new xSession(counter, true);
            if(session && session.userId())
            {
                select firstOnly userInfo
                    where userInfo.id == session.userId();
                if (userInfo && (currentUserId == session.userId()))
                    num++ ;
            }
        }

        while select userGroupList
            where userGroupList.userId == currentUserId
            && userGroupList.groupId == 'Admin'
            maxUserSessions = maxAdminSessions;

        if (num > maxUserSessions)
            {
            box::stop(strfmt("The same user id can't log in more than %1.", maxUserSessions));
            infolog.shutDown(true);
            }

        if(curuserid() == "MF" || (curuserid() == "AAL"))
        {
            if(!WinAPI::isControlButtonDown() &&
            DEV_AxAssistFunc::checkActiveXRegistered())
            {
                formRun = new MenuFunction(menuItemDisplayStr(DEV_AxAssistForm),MenuItemType::Display).create();
                if(formRun)
                {
                    formRun.run();
                    formRun.detach();
                }
            }
        }

        if(!WinAPI::isShiftButtonDown())
        {
            // check for user ID
            if(curUserId()=="MF") // <- change to your loginname
            {
                // actually run tabax
                TreeNode::findNode(@'\\Forms\\'+formStr(Tabax)).AOTrun();
            }
        }

    }

  • 相关阅读:
    maven打包不执行测试用例
    maven不打包子模块资源文件
    mvn打包时添加version和profile
    eclipse控制台中文乱码解决方法
    eclipse常用插件
    Spring Boot系列之-logging
    Spring Boot系列之-profile
    Spring Boot系列之-helloword入门
    sqlite入门
    解决eclipse spring配置报错:cvc-elt.1: Cannot find the declaration of element
  • 原文地址:https://www.cnblogs.com/perock/p/2375276.html
Copyright © 2011-2022 走看看