Have you looked at the feature/if-feature standard YANG-statements? Once you have tagged identities, in this case, with if-feature statements you can enable/disable support with the --feature option to confdc.
The if-feature statement is a compile time way to trim certain nodes in the tree.
It can also be used for identities.
But if you want this to be decided during runtime (Example: Based on some other configuration elements), I suggest you implement a completion callback to control what values should be displayed to the CLI user.
You can find more details and an example of how to implement this in the user guide:
16.12.1. Customizing CLI completion