• 同一时间只允许一个用户登录AX


    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;

        ;

        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);

            }

    }

  • 相关阅读:
    硅谷独角兽公司的监控系统长啥样?
    通过jQuery设置全局Ajax加载时呈现Loading
    Jquery遮罩插件,想罩哪就罩哪!
    jquery 读取textarea内容
    easy ui layout 高度 宽度自适应浏览器
    css调节样式
    ORACLE数据库的连接
    spring cloud API网关
    嵌套查询与连接查询的性能
    对于where 1=1 这种条件传入需要'%s'
  • 原文地址:https://www.cnblogs.com/perock/p/2157950.html
Copyright © 2020-2023  润新知