diff --git a/auth/handlers/handle_profile.go b/auth/handlers/handle_profile.go index 3b01cf895..4ce968ac2 100644 --- a/auth/handlers/handle_profile.go +++ b/auth/handlers/handle_profile.go @@ -60,6 +60,10 @@ func (h *AuthHandlers) profileProc(req *request.AuthReq) error { // this way user service will pass us through. user, err := h.UserService.Update(req.Context(), u) + if err == nil { + err = h.AuthService.LoadRoleMemberships(req.Context(), user) + } + if err == nil { req.AuthUser.User = user req.AuthUser.Save(req.Session) diff --git a/auth/handlers/handle_profile_test.go b/auth/handlers/handle_profile_test.go index 660961780..97e58bf79 100644 --- a/auth/handlers/handle_profile_test.go +++ b/auth/handlers/handle_profile_test.go @@ -77,6 +77,8 @@ func Test_profileFormProc(t *testing.T) { req.PostForm.Add("handle", "handle") req.PostForm.Add("name", "name") + authService = &authServiceMocked{} + userService = &userServiceMocked{ update: func(c context.Context, u *types.User) (*types.User, error) { u = makeMockUser() diff --git a/auth/handlers/handler.go b/auth/handlers/handler.go index e99865bbe..cf902e113 100644 --- a/auth/handlers/handler.go +++ b/auth/handlers/handler.go @@ -43,6 +43,7 @@ type ( ValidateTOTP(ctx context.Context, code string) (err error) ConfigureTOTP(ctx context.Context, secret string, code string) (u *types.User, err error) RemoveTOTP(ctx context.Context, userID uint64, code string) (u *types.User, err error) + LoadRoleMemberships(ctx context.Context, u *types.User) error SendEmailOTP(ctx context.Context) (err error) ConfigureEmailOTP(ctx context.Context, userID uint64, enable bool) (u *types.User, err error) diff --git a/auth/handlers/mock_test.go b/auth/handlers/mock_test.go index e269748e2..0ab59b11e 100644 --- a/auth/handlers/mock_test.go +++ b/auth/handlers/mock_test.go @@ -180,6 +180,11 @@ func (s authServiceMocked) ValidateEmailOTP(ctx context.Context, code string) (e return s.validateEmailOTP(ctx, code) } +func (s authServiceMocked) LoadRoleMemberships(ctx context.Context, u *types.User) error { + // no-op for now + return nil +} + // // Mocking oauth2Service //