add PublicViewerConfig utils#377
add PublicViewerConfig utils#377filariow wants to merge 5 commits intocodeready-toolchain:masterfrom
Conversation
Signed-off-by: Francesco Ilario <filario@redhat.com>
Signed-off-by: Francesco Ilario <filario@redhat.com>
Signed-off-by: Francesco Ilario <filario@redhat.com>
| func (c PublicViewerConfig) IsPublicViewer(username string) bool { | ||
| if !c.Enabled() { | ||
| return false | ||
| } | ||
|
|
||
| return c.Config.Username == username | ||
| } |
There was a problem hiding this comment.
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.
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.
no, you're right, this can happen. Let me look into that more, great catch!
There was a problem hiding this comment.
Do you think this approach could help also here?
There was a problem hiding this comment.
As pointed out in the comment codeready-toolchain/host-operator#998 (comment) , I would remove the field.
Signed-off-by: Francesco Ilario <filario@redhat.com>
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
|
|




linked to codeready-toolchain/api#410