Delegated Admin, Sort by boolean field

Sorting the search list by boolean values does very little! The field is either TRUE, FALSE or NULL, but sorting by the field does not seem to take any of these values into account.
Below shows a field ‘Is Blocked’ (relabled ‘blocked’ field) sorted ascendingly and descendingly, showing no change in the order of users.


vs.

Hi @benjamin.moore ,

Thank you for posting this topic on the Auth0 Community!

I checked the Delegated Admin Extension and don’t see the “Admin” and the “Is Blocked” columns for some reason. Could you please provide additional context regarding how to bring those two columns to the tool?

Meantime, could you please provide more details regarding what you want to achieve? For example, if you want to find out all the blocked users and mark them as unblocked, you could try exporting the users and filtering the isBlocked = true and changing to False and importing them. This can be done in the Auth0 User Import/Export extension which lets you perform bulk actions and is more scalable.

Lastly there is an option to use Lucene search syntax to filter for blocked users: with the following syntax: blocked:true

Thank you and please let me know if any further queries.

These columns were added to the Search view in the following Settings Query (userFields 2 and 3 below)

function (ctx, callback) {
    var isAdmin = ctx.request.user.app_metadata && ctx.request.user.app_metadata.isAdmin;
    return callback(null, {
      connections: ["Username-Password-Authentication"],
      userFields: [{
        "property": "app_metadata.delegatedAdminRole",
        "label": "Is Admin",
        "display": true,
        "create": {
          "display": true,
          "type": "text",
          "placeholder": "This will be an admin role",
          "disabled": true
        }
      },
      {
        "property": "app_metadata.isAdmin",
        "label": "Admin",
        "display": true,
        "search": {
         "display": true,
         "listOrder": 10,
         "listSize": 150,
          "sort": true
        },
      },
      {
         "property": "blocked",
         "label": "Is Blocked",
         "display": true,
         "search": {
          "listOrder": 11,
          "listSize": 150,
          "sort": true,
          "display": true
        }
      },
      {
        "property": "blocked_for",
        "label": "Bruteforce Blocked",
        "display": true,
      },
      {
        "property": "connection",
        "search": { "display": "false"}
      }
    ],
		canCreateUser: true
  });
}

IsAdmin is a field exposed from appMetadata, so ignore this one for now. However, blocked is the actual property of a User, as to whether they are blocked or not. However, the "sort": true property in search activates the search chevron in the header, but seems to have no effect on the sort order.

Additionally, while the blocked: true Lucene search field does successfully filter, for the admin one it looks like app_metadata.isAdmin: true which is a bit hard for non-technical users to remember if they need to use it. (with the users we intend to have use this tool, not particularly convinced the first one is going to be particular useful for them either!) The idea is that using the Sort operators to group the records by these values will be a valid workaround.

(Unfortunately, adding the columns to the search dropdown isn’t exactly ideal either, as it prevents global search: you can now only search the column specified. Also, if you want to show say where isAdmin is either false or null, the search criteria is now NOT app_metadata.isAdmin: true; which when the field is a dropdown, you can’t actually enter. To make this work, I had to create a specific userField with the name “NOT app_metadata.isAdmin”, have it hidden across the board, but exposed as a search dropdown. You still had to enter “true” into the search box, however!)