mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-22 23:51:27 +01:00
Fix all issues related to the noise in the logs
Change log level to debug when required Signed-off-by: stonezdj <stonezdj@gmail.com>
This commit is contained in:
parent
fc1db450b2
commit
a00a83df38
@ -180,7 +180,7 @@ func getHelper(ctx context.Context) (AuthenticateHelper, error) {
|
||||
// OnBoardUser will check if a user exists in user table, if not insert the user and
|
||||
// put the id in the pointer of user model, if it does exist, return the user's profile.
|
||||
func OnBoardUser(ctx context.Context, user *models.User) error {
|
||||
log.Debugf("OnBoardUser, user %+v", user)
|
||||
log.Debugf("OnBoardUser, user: %v", user.Username)
|
||||
helper, err := getHelper(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -259,7 +259,8 @@ func PostAuthenticate(ctx context.Context, u *models.User) error {
|
||||
func IsSuperUser(ctx context.Context, username string) bool {
|
||||
u, err := user.Mgr.GetByName(ctx, username)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to get user from DB, username: %s, error: %v", username, err)
|
||||
// LDAP user can't be found before onboard to Harbor
|
||||
log.Debugf("Failed to get user from DB, username: %s, error: %v", username, err)
|
||||
return false
|
||||
}
|
||||
return u.UserID == 1
|
||||
|
@ -75,7 +75,7 @@ func (l *Auth) Authenticate(ctx context.Context, m models.AuthModel) (*models.Us
|
||||
log.Warningf("Found more than one entry.")
|
||||
return nil, auth.NewErrAuth("Multiple entries found")
|
||||
}
|
||||
log.Debugf("Found ldap user %+v", ldapUsers[0])
|
||||
log.Debugf("Found ldap user: %v", ldapUsers[0].Username)
|
||||
|
||||
dn := ldapUsers[0].DN
|
||||
if err = ldapSession.Bind(dn, m.Password); err != nil {
|
||||
@ -259,7 +259,7 @@ func (l *Auth) PostAuthenticate(ctx context.Context, u *models.User) error {
|
||||
if n > 0 {
|
||||
dbUser, err := l.userMgr.GetByName(ctx, u.Username)
|
||||
if errors.IsNotFoundErr(err) {
|
||||
fmt.Printf("User not found in DB %+v", u)
|
||||
log.Debugf("User not found in DB:%v", u.Username)
|
||||
return nil
|
||||
} else if err != nil {
|
||||
return err
|
||||
|
@ -67,7 +67,7 @@ func redirectForOIDC(ctx context.Context, username string) bool {
|
||||
}
|
||||
us, err := user.Ctl.Get(ctx, u.UserID, &user.Option{WithOIDCInfo: true})
|
||||
if err != nil {
|
||||
log.Warningf("Failed to get OIDC user info for user, id: %d, error: %v", u.UserID, err)
|
||||
log.Debugf("Failed to get OIDC user info for user, id: %d, error: %v", u.UserID, err)
|
||||
}
|
||||
if us != nil && us.OIDCUserMeta != nil {
|
||||
return true
|
||||
|
@ -190,7 +190,7 @@ func userOnboard(ctx context.Context, oc *OIDCController, info *oidc.UserInfo, u
|
||||
}
|
||||
oidc.InjectGroupsToUser(info, user)
|
||||
|
||||
log.Debugf("User created: %+v\n", *user)
|
||||
log.Debugf("User created: %v\n", user.Username)
|
||||
|
||||
err = ctluser.Ctl.OnboardOIDCUser(ctx, user)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user