Skip to content

Extend the Login IP Filters functionality to regular users #5373

Description

@davidjrh

Description of problem

The current code base that implements the logic for the Login IP Filters only takes in consideration Superusers and users under the Administrator role. While this is not mentioned anywhere in the persona bar settings, I thought it was intended for all users.

The code below is on https://github.com/dnnsoftware/Dnn.Platform/blob/develop/DNN%20Platform/Website/DesktopModules/Admin/Authentication/Login.ascx.cs#L1298

  // Obtain the current client IP
  var userRequestIpAddressController = UserRequestIPAddressController.Instance;
  var ipAddress = userRequestIpAddressController.GetUserRequestIPAddress(new HttpRequestWrapper(this.Request));

  // check if the user is an admin/host and validate their IP
  if (Host.EnableIPChecking)
  {
      bool isAdminUser = objUser.IsSuperUser || objUser.IsInRole(this.PortalSettings.AdministratorRoleName);
      if (isAdminUser)
      {
          var clientIp = ipAddress;
          if (IPFilterController.Instance.IsIPBanned(clientIp))
          {
              PortalSecurity.Instance.SignOut();
              this.AddModuleMessage("IPAddressBanned", ModuleMessage.ModuleMessageType.RedError, true);
              okToShowPanel = false;
              break;
          }
      }
  }

I understand that I can restrict the access by IP using other mechanisms such as touching the web.config, adding rules at hosting level, etc. but extending this to regular users would allow Authenticatin Extensions like the Azure AD module to use this configuration for several purposes such as the one mentioned at davidjrh/dnn.azureadprovider#50

Is there any reason to restrict this to superusers and admins? Could be extended to regular users? If we agree, I'm happy to do a PR.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions