-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add PublicViewerConfig utils #377
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Francesco Ilario <[email protected]>
Signed-off-by: Francesco Ilario <[email protected]>
Signed-off-by: Francesco Ilario <[email protected]>
func (c PublicViewerConfig) IsPublicViewer(username string) bool { | ||
if !c.Enabled() { | ||
return false | ||
} | ||
|
||
return c.Config.Username == username | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we check that c.Config.Username is not empty ? I mean could it happen that we enable the config without setting a username? WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the RegEx validation should prevent this from happening
// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, you're right, this can happen. Let me look into that more, great catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think this approach could help also here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As pointed out in the comment codeready-toolchain/host-operator#998 (comment) , I would remove the field.
Signed-off-by: Francesco Ilario <[email protected]>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #377 +/- ##
==========================================
- Coverage 77.74% 77.42% -0.32%
==========================================
Files 46 47 +1
Lines 1959 1967 +8
==========================================
Hits 1523 1523
- Misses 376 384 +8
Partials 60 60
|
Quality Gate passedIssues Measures |
linked to codeready-toolchain/api#410