Skip to content

Func 'runCreateUser' of cli command needs to check the value of DEFAULT_USER_VISIBILITY #22523

Closed
@yp05327

Description

@yp05327

Description

I have post a issue at this project: gitea/helm-chart
Admin account's user visibility is public even ALLOWED_USER_VISIBILITY_MODES equals private
But i found that this maybe an issue of gitea cli.

Problem:
In the official helm chart, cli command is used to create the first admin user.

gitea admin user create --admin --username "${GITEA_ADMIN_USERNAME}" --password "${GITEA_ADMIN_PASSWORD}" --email {{ .Values.gitea.admin.email | quote }} --must-change-password=false

This command will call func runCreateUser which is defined in gitea/cmd/admin.go.
In this function, a new user will be create without checking the env variable DEFAULT_USER_VISIBILITY.
so this new user's visibility will always be public.

If you set the env as the following:

DEFAULT_USER_VISIBILITY = private
ALLOWED_USER_VISIBILITY_MODES = private

When you login with the first created admin user, You will get 500 server error page. Because this user's visibility is public
but ALLOWED_USER_VISIBILITY_MODES is private.

Gitea Version

1.18.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Using Official Helm Chart
Helm Chart Version: 7.0.0
Gitea version: 1.18.1

env setting:

gitea:
  config:
    service:
      DISABLE_REGISTRATION: true
      DEFAULT_USER_VISIBILITY: private
      ALLOWED_USER_VISIBILITY_MODES: private
      DEFAULT_ORG_VISIBILITY: private
    service.explore:
      REQUIRE_SIGNIN_VIEW: true
      DISABLE_USERS_PAGE: true

Database

MySQL

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions