Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

fix(api): use correct instance setting method in user registration

Steven32d47abef236
diff --git a/server/router/api/v1/user_service.go b/server/router/api/v1/user_service.go
index e5de08db3..b5e452fc3 100644
--- a/server/router/api/v1/user_service.go
+++ b/server/router/api/v1/user_service.go
@@ -172,11 +172,11 @@ func (s *APIV1Service) CreateUser(ctx context.Context, request *v1pb.CreateUserR
// Only allow user registration if it is enabled in the settings, or if the user is a superuser
if currentUser == nil || !isSuperUser(currentUser) {
- workspaceGeneralSetting, err := s.Store.GetWorkspaceGeneralSetting(ctx)
+ instanceGeneralSetting, err := s.Store.GetInstanceGeneralSetting(ctx)
if err != nil {
- return nil, status.Errorf(codes.Internal, "failed to get workspace general setting, error: %v", err)
+ return nil, status.Errorf(codes.Internal, "failed to get instance general setting, error: %v", err)
}
- if workspaceGeneralSetting.DisallowUserRegistration {
+ if instanceGeneralSetting.DisallowUserRegistration {
return nil, status.Errorf(codes.PermissionDenied, "user registration is not allowed")
}
}