According to the Google Directory API you can create custom fields for users and then search users by those fields.
https://developers.google.com/admin-sdk/directory/v1/guides/search-users
You can search for users matching certain attributes with the users.list method of the Directory API. This method accepts the query parameter which is a search query combining one or more search clauses. Each search clause is made up of three parts:
Field
User attribute that is searched. For example, givenName. Custom fields can be searched by schemaName.fieldName.
Operator
Test that is performed on the data to provide a match. For example, the : operator tests if a text attribute contains a value.
Value
The content of the attribute that is tested. For example, Jane.
Searching for a boolean value appears to only show users that have been explicitly set true or false. Is it possible to search for users that do not have a set value or search for all values not true or not false?
It appears to have changed. When I search on Google APIs Explorer using
GET https:// www.googleapis.com/admin/directory/v1/users?customer=my_customer&projection=full&key={YOUR_API_KEY}
It returns about 70 results but using
GET https:// www.googleapis.com/admin/directory/v1/users?customer=my_customer&projection=full&query=userData.enabled%3Dfalse&key={YOUR_API_KEY} returns 1 result and
GET https:// www.googleapis.com/admin/directory/v1/users?customer=my_customer&projection=full&query=userData.enabled%3Dtrue&key={YOUR_API_KEY} returns no results.
I have about a dozen set to true and the rest set to false. There are only a few that I have not explicitly set to true or false.