feat: expose owner_name in coder_workspace resource#11639
Conversation
|
|
||
| // UserRealNameValid returns whether the input string is a valid real user name. | ||
| func UserRealNameValid(str string) error { | ||
| if len(str) > 128 { |
There was a problem hiding this comment.
What's the motivation for this limit? Hubert will be sad: https://www.guinnessworldrecords.com/world-records/67285-longest-personal-name
I think it's unlikely we'll hit this, but arbitrary limits have a way of making people sad (think email regex). We should at least document this decision a bit better. Should length also be enforced in the DB side?
PS. If we're thinking about frontend, they could always use ellipse over there.
There was a problem hiding this comment.
I would expect we don't want to allow someone to fill up the database with a name that's gigabytes in size.
There was a problem hiding this comment.
Yeah, I understand that risk could be a concern, I was specifically thinking about this limit (128), though. Seems on the smaller to just be a safety-net. And if we're really worried about this case, I do think database limits would be a good idea, otherwise we'll always run the risk of introducing new holes. And I'd be surprised if we didn't have some gaps in this defense elsewhere currently as well 😄.
There was a problem hiding this comment.
The form Mr. Hubert used, HUBERT BLAINE WOLFESCHLEGELSTEINHAUSENBERGERDORFF SR, is within the limit!
The original use case for this feature is to populate all places where UI or CLI can render it, like Git commiter/message. I'm sure that Hubert Blain Wolf... will crash UIs in many different places, so I would stick to the artificial limit.
Anyway, we can always disable the limit. The other way round might be hard to do as we might need to chop some names...
I do think database limits would be a good idea, otherwise we'll always run the risk of introducing new holes. And I'd be surprised if we didn't have some gaps in this defense elsewhere currently as well 😄.
This is valid risk, and I wouldn't like to enable another gate to pump bytes into the database.
| {"Hector Ó hEochagáin", true}, | ||
| {"Małgorzata Kalinowska-Iszkowska", true}, | ||
| {"成龍", true}, | ||
| {". .", true}, |
There was a problem hiding this comment.
This looks like a smiley, I approve! 👀
| } | ||
|
|
||
| if strings.TrimSpace(str) != str { | ||
| return xerrors.New("must not have leading or trailing white spaces") |
There was a problem hiding this comment.
Happened to catch my eye, whitespace is uncountable, so we drop s. Alt: whitespace characterS.
| return xerrors.New("must not have leading or trailing white spaces") | |
| return xerrors.New("must not have leading or trailing whitespace") |
Not sure about having white space in whitespace, though. Both could be correct 😄.
Related: #9883
This PR modifies the
usersdatabase table to store the workspace owner's name (first name, last name).Follow-up: