Skip to content

Feature Request: Add ability to disable anonymous user signupΒ #16305

@ColourfulField

Description

@ColourfulField

Scope & Context

I am looking to create a setup with multiple workspaces, each assigned to a person I know personally.

I want to give access to the CRM manually and disable signup for anonymous users.

Current behavior

Currently when setting IS_MULTIWORKSPACE_ENABLED, all anonymous users can freely create new accounts and new workspaces.

Also, when setting an env variable IS_WORKSPACE_CREATION_LIMITED_TO_WORKSPACE_ADMINS=true, non-admin users who are already registered can no longer create workspaces. However, it does not prevent new account signups and workspace creation for those accounts.

More info here: #13460

Expected behavior

Option 1

IS_WORKSPACE_CREATION_LIMITED_TO_WORKSPACE_ADMINS=true disables workspace creation for both registered and anonymous users.

For me this is a preferrable option due to how the variable is named. Since it was only introduced 2 months ago and wasn't added to the documentation or environment variable list inside admin panel, I assume that the impact of changing this behavior is low.

Option 2

reintroduce IS_SIGN_UP_DISABLED variable. Setting this varialbe to true disables signup for anonymous users when IS_MULTIWORKSPACE_ENABLED=true.

Technical inputs

The following code could be relevant in sign-in-up.service.ts. What I'm looking for is a way to disable signup when this.isFirstWorkspaceForUser(currentUser.id) === true

 async checkWorkspaceCreationIsAllowedOrThrow(
    currentUser: UserEntity,
  ): Promise<void> {
    if (!this.isWorkspaceCreationLimitedToServerAdmins()) return;

    if (await this.isFirstWorkspaceForUser(currentUser.id)) return;

    if (!currentUser.canAccessFullAdminPanel) {
      throw new AuthException(
        'Workspace creation is restricted to admins',
        AuthExceptionCode.FORBIDDEN_EXCEPTION,
        {
          userFriendlyMessage: msg`Workspace creation is restricted to admins`,
        },
      );
    }
  }

Extra info

It might make sense to add the existing env variable IS_WORKSPACE_CREATION_LIMITED_TO_WORKSPACE_ADMINS to the list of config variables visible in the admin panel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    βœ… Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions