Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Admin API cannot create deactivated users #12057

Open
tadzik opened this issue Feb 22, 2022 · 3 comments
Open

Admin API cannot create deactivated users #12057

tadzik opened this issue Feb 22, 2022 · 3 comments
Labels
A-Account-Deactivation "Deleting"/"Removing" a user, GDPR erasure (erased) A-Admin-API A-Docs things relating to the documentation T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

Comments

@tadzik
Copy link
Contributor

tadzik commented Feb 22, 2022

Description

When using Admin API to create new users, the deactivated body attribute is ignored. According to the docs, "If unspecified, deactivation state will be left unchanged on existing accounts and set to false for new accounts". It seems like it's set to false for new accounts regardless of what the attribute is set to.

Steps to reproduce

  • Create a new user with the admin API:
    PUT /_synapse/admin/v2/users/@jsmith:server {
        displayname: 'Jacob Smith',
        password: 'hello.code.reviewer',
        deactivated: true
    }
  • The response indicates that the user is not deactivated, contrary to what was requested:
{
  name: '@jsmith:server',
  is_guest: 0,
  admin: 0,
  consent_version: null,
  consent_server_notice_sent: null,
  appservice_id: null,
  creation_ts: 1645530918,
  user_type: null,
  deactivated: 0,
  shadow_banned: 0,
  displayname: 'Jacob Smith',
  avatar_url: null,
  threepids: [],
  external_ids: []
}

  • The user can login, even though they shouldn't be able to.

It'd be fair if that option was unsupported during user creation, but the docs don't indicate that it is. It should either work as expected, or be documented (and preferably return a 400 when used) not to.

Version information

Synapse 1.51.0 running under docker with homerunner.

@erikjohnston erikjohnston added A-Docs things relating to the documentation T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. labels Feb 23, 2022
@erikjohnston
Copy link
Member

Updating the docs is probably the easiest here.

Is there a use case for creating users that are deactivated?

@tadzik
Copy link
Contributor Author

tadzik commented Feb 23, 2022

SCIM allows it, so a SCIM->Synapse gateway needs to support it. It can do it in two steps though, it's not a big deal :)

@anoadragon453 anoadragon453 changed the title Admin API does cannot create deactivated users Admin API cannot create deactivated users Mar 6, 2022
@hex-m
Copy link

hex-m commented Jan 30, 2023

I just read the news that GitLab supports SCIM now and came here because we have exactly those problems with our Synapse instances.

@MadLittleMods MadLittleMods added the A-Account-Deactivation "Deleting"/"Removing" a user, GDPR erasure (erased) label Apr 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Account-Deactivation "Deleting"/"Removing" a user, GDPR erasure (erased) A-Admin-API A-Docs things relating to the documentation T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.
Projects
None yet
Development

No branches or pull requests

4 participants