{
    "header": {
        "version": 1,
        "type": "record"
    },
    "body": {
        "record1": {
            "<1>": "declare function msg, send_event, security_check, post_event\r\ndeclare subroutine forward_event, record_lock\r\n\r\n$insert msg_equates\r\n$insert security_rights_equ\r\n$insert lsl_users_equ\r\n$insert lsl_common\r\n\r\nforward_event( Flag, FocusID )\r\nUList1 = get_property( @window, '@UList1', UList1 )\r\nUList2 = .users->list\r\n\r\nIf Get_Property('NDW_MAIN', 'VISIBLE') then\r\n    AppMain = 'NDW_MAIN'\r\nend else\r\n    AppMain = 'LSL_MAIN2'\r\nend\r\n\r\nChoosenUser = .users->text\r\n\r\nlocate ChoosenUser in UList2 using @fm setting UPos then\r\n   TUser = UList1<UPos>\r\n   Password = xlate( 'LSL_USERS', TUser, lsl_users_password$, 'X' )\r\n   PwdEntered = @CtrlEntId->text\r\n   if ( PwdEntered = Password ) then\r\n   \r\n      * THIS EXACT CODE IS IN THE CLOSE EVENT OF THE LSL_MAIN2 WINDOW\r\n      * COULD NOT CALL THE CLOSE EVENT CAUSE THAT KILLS THE ENTIRE SYSTEM\r\n      * will write out the x and y coords for the user, so the menu comes up at the last used\r\n      * location\r\n      \r\n      WinSize = get_property( AppMain, 'SIZE' )\r\n      X = WinSize<1>\r\n      Y = WinSize<2>\r\n      Xsize = WinSize<3>\r\n      Ysize = WinSize<4>\r\n      \r\n      open 'LSL_USERS' to LSLUsersTableVar else\r\n         MsgInfo = ''\r\n         MsgInfo<mtext$> = 'Unable to open LSL_USERS...'\r\n         MsgInfo<mcol$> = -2\r\n         MsgInfo<mrow$> = -2\r\n         Void = msg( '', MsgInfo )\r\n      end\r\n      \r\n      record_lock( LSLUsersTableVar, 'LSL_USERS', @user4 )\r\n      read UserRec from LSLUsersTableVar, @user4 else\r\n         MsgInfo = ''\r\n         MsgInfo<mtext$> = 'Unable to READ ':@user4:' IN LSL_USERS...'\r\n         MsgInfo<mcol$> = -2\r\n         MsgInfo<mrow$> = -2\r\n         Void = msg( '', MsgInfo )\r\n      end\r\n      \r\n      UserRec<lsl_users_menu_xpos$> = X\r\n      UserRec<lsl_users_menu_ypos$> = Y\r\n      UserRec<lsl_users_menu_xsize$> = Xsize\r\n      UserRec<lsl_users_menu_ysize$> = Ysize\r\n      \r\n      write UserRec on LSLUsersTableVar, @user4 else\r\n         MsgInfo = ''\r\n         MsgInfo<mtext$> = 'Unable to write LSL_USERS, ':@user4\r\n         MsgInfo<mcol$> = -2\r\n         MsgInfo<mrow$> = -2\r\n         Void = msg( '', MsgInfo )\r\n      end\r\n      \r\n      unlock LSLUsersTableVar, @user4 else\r\n         MsgInfo = ''\r\n         MsgInfo<mtext$> = 'Unable to open unlock LSL_USERS, ':@user4\r\n         MsgInfo<mcol$> = -2\r\n         MsgInfo<mrow$> = -2\r\n         Void = msg( '', MsgInfo )\r\n      end\r\n      \r\n      * END OF CLOSE CODE FROM LSL_MAIN2\r\n      \r\n      SecTables@ = ''\r\n      SecRights@ = ''\r\n      \r\n      * JUST USE RDS CAUSE EVERYONE HAS RIGHTS TO THE RDS AND BY SETTING THE\r\n      * ABOVE TWO VARIABLE TO NULL THIS WILL FORCE A REBUILD FOR @USER4\r\n      \r\n      @user4 = TUser\r\n      Tvar = security_check( 'RDS', Read$ )\r\n      Void = send_event( @window, 'CLOSE')\r\n      Void = post_event( AppMain, 'CREATE','RELOGIN' )\r\n      \r\n   end else\r\n   \r\n      MsgInfo = ''\r\n      MsgInfo<mtext$> = 'Invalid password...'\r\n      MsgInfo<micon$> = 'H'\r\n      Void = msg( '', MsgInfo )\r\n      return 0\r\n   end\r\n   \r\nend else\r\n\r\n   MsgInfo = ''\r\n   MsgInfo<mtext$> = 'Invalid user...'\r\n   MsgInfo<micon$> = 'H'\r\n   Void = msg( '', MsgInfo )\r\n   return 0\r\n   \r\nend\r\nRETURN 0"
        }
    }
}