In the interest of proposing a solution for Restrict exposure of full name to certain groups, I would like to define a (server-side) permssions predicate that answers the question
Based on the current user-scope/context, is it ok to reveal (other) users’ full names?
(The scope could be set by a client request, or by some internal processing step, like generating digest email messages.)
What is the right construct for such a predicate? Where in the codebase should it live? I’m thinking that perhaps this belongs in a guardian — am I on the right track? Any opinions on which one?
I imagine this new predicate would subsume many (but not all) instances of SiteSettings.enable_names?
currently in the codebase. (Hitting the Serializers that yield user.name
plugs most of the data leaks, but not quite all of them.) A nice benefit of this is that it would introduce an extension point by which a future plugin could change the behavior (not currently possible, as far as I know, or I would just do that!). So, if I get this working, this would become a pull-request to the discourse core — and I would like to submit a PR that has a hope of getting accepted.