chore: update memo related settings

This commit is contained in:
Steven
2024-06-01 09:05:09 +08:00
parent 0657a1ef5b
commit 4e54ec38ff
5 changed files with 102 additions and 99 deletions

View File

@ -46,6 +46,17 @@ func (s *APIV1Service) GetWorkspaceSetting(ctx context.Context, request *v1pb.Ge
return nil, status.Errorf(codes.NotFound, "workspace setting not found")
}
// For storage setting, only host can get it.
if workspaceSetting.Key == storepb.WorkspaceSettingKey_STORAGE {
user, err := s.GetCurrentUser(ctx)
if err != nil {
return nil, status.Errorf(codes.Internal, "failed to get current user: %v", err)
}
if user == nil || user.Role != store.RoleHost {
return nil, status.Errorf(codes.PermissionDenied, "permission denied")
}
}
return convertWorkspaceSettingFromStore(workspaceSetting), nil
}