Login Page - Create Account

Support Board


Date/Time: Thu, 25 Apr 2024 02:02:03 +0000



Post From: DLL Authorization Checks (UserServiceLevel)

[2023-01-21 17:52:37]
SavantTrader - Posts: 109
I'd like to add UserServiceLevel to my existing implementation of UserAllowed checks. Can someone familiar with UserServiceLevel help me complete this implementation:


  // check authorization to run our DLL
  int ServiceLevel = 0x16;
  if (sc.IsUserAllowedForSCDLLName == false || sc.DLLNameUserServiceLevel != ServiceLevel)
  {
    if(sc.Index == 0) { // only pollute logfile once, at start
      SCString pre = "You are not authorized to use this amazing study. Contact ";
      sc.AddMessageToLog( pre + ContactEmail + " to discuss authorization.",1);
    }
    return;
  }

Specifically, can someone tell me:

1) Should I use an unsigned long for ServiceLevel?
2) Is my "all in one" implementation logic correct?
3) If I wanted items with ServiceLevel = 0 to always bypass this, but with a valid registered user still required, is there a (code) clean way to implement the logic?
4) What's the easiest way to implement bitmask user levels?

Thank you!
Date Time Of Last Edit: 2023-01-21 18:24:13