2 ms·
If possible, I would prefer deriving the "userType" from UserAttributes. I see various methods for doing so are covered in the follow-up post linked at the top
by thdc 4y ago
If possible, I would prefer deriving the "userType" from UserAttributes.
I see various methods for doing so are covered in the follow-up post linked at the top of tfa.
This is also avoidable if you have proper class/interface hierarchies, where the type "field/key" is the type itself.
In the case it's not possible and there really is only 1 type that is fully applicable to both admins and normal users then I would probably be fine with either approach (although I'd consider updating the return type to get type safety between admin and normal users!)