Lazy again - anyone know what I could use instead of SessionMod.Login?

When we upgraded 2 weeks ago, I saw this in the BPM conversion:

WARNING: Method ‘Ice.Lib.SessionMod.Login’ is restricted now.
The method and related directives are available only for users with SM/GSM rights.

I was using this to determine if the user was trying to log into DataCollection or regular Epicor, and then do stuff (prohibit them from logging in if they weren’t on the cool-people list).

I’m not sure what to use instead now.

I’ll start tracing, etc. Just thought I’d ask and save some time if I could.

For the curious, this is my code block in the BPM. (Yes, I did a code block; I guess I cringed at the 5 nested if statements that would be the alternative.) And yes, the code really does thank @josecgomez. Gotta give credit.

// Thank you Jose: https://www.epiusers.help/t/epicor-license-guids/61669

switch (this.Session.SessionType.ToString().ToUpper()) 
{
  case "00000003-B615-4300-957B-34956697F040":
  MySessionType = "Default";
  break;
  
  case "00000003-B8EB-40C4-8897-248CB30C5D47":
  MySessionType = "Data Collection";
  break;
  
  case "00000003-9439-4B30-A6F4-6D2FD4B9FD0F":
  MySessionType = "Web Service";
  break;
  
  case "00000003-C071-4FD8-900D-F58EE96BBCCE":
  MySessionType = "Enterprise Processing";
  break;
  
  case "00000003-94E7-4DCB-BAFD-A6CA7F21AA9B":
  MySessionType = "Data Administraion"; 
  //What is this? See Ice.License.SessionTypes.DataAdministration
  break;
  
  default:
  MySessionType = "Other/Unknown";
  break;
 
}
1 Like

A few findings so far.

First, I re-enabled the old BPM, and got this warning.

Screenshot 2024-05-15 114550

So I changed the code block to begin as

switch (this.Session.LicenseTypeId.ToString().ToUpper()) 

(And this is acceptable.)

Second, IT WORKED. The original but modified BPM worked. I tried it with a non-security-manager user and it worked like before, blocking the user from using a “Default” license. So the warning that had me panicked may not be in effect yet?

Third, I did find that Ice.BO.KineticErp.GetUserSessionAndVersion runs right after SessionMod.Login. When I ran the BPM conversion, it did not complain about that one.

So I feel like I should proceed as if the warning is true, and develop on the KineticErp BO for future-proofing?

1 Like

It’s a warning, so no, it will not stop you. When they mark it as an error, it will.

Right, but sometimes warnings are just warnings.

Like a classic customization that “warns” me that a textbox has a negative y-index. No kidding! It was the only way I could get it off the page. It’s not deprecated; just free advice.

So I thought maybe this was a “this is a stupid idea, but if you feel stupid, we won’t stop you” warning.

I guess it might be what you say, more of a “this is deprecated” warning.

It’s a we plan to disable this in the future statement.

On the off chance that I never get back to this, I found that a pre-processing method directive on KineticErp.GetUserSessionAndVersion does this

  1. Stops the user from logging in
  2. Still consumes that license anyway

So I had to invoke SessionMod.Logout before throwing the error message, in order to not use the license.

Ironically, SessionMod.Logout is OK, but SessionMod.Login is deprecated.

Or are they going to deprecate Logout, too?