Skip to content

Introduce `blocked_pending_approval` user state

What does this MR do?

For #257878 (closed)

This MR introduces a new state for user named blocked_pending_approval. This is supposed to be the starting state of a user

  • who registers via the registration form AND
  • the toggle introduced in !43827 (merged) is turned on.

This MR introduces only

  • the new state.
  • its behaviour (ie, across the app, these users behave the same as a normal blocked user)
  • specs checking its permissions.

This MR does not introduce any way for a user to register in this state, or for an admin to convert a user to this state via the API or the UI and hence, there are no user-facing changes here (and hence no changelog). These will be added in a subsequent MR.

Note: Even though these users behave like a normal blocked user, at some places (like in error messages, flash notices etc), it is necessary to be explicit about "your account is blocked pending approval" rather than the usual "your account is blocked" message. Hence in these places, we do a user.blocked_pending_approval? check before the user.blocked? check.

Screenshots

When a user blocked_pending_approval tries to login. (Since there is no way currently to turn a user into this state via the UI/API, I took this screenshot after changing the state of an existing user to blocked_pending_approval via Rails console.)

Screenshot_2020-10-05_at_10.24.03_AM

A user blocked_pending_approval also appears in the "Blocked" tab under /admin/users page. I will make further required modifications in this page in a new MR.

Screenshot_2020-10-05_at_10.24.31_AM

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Manoj M J

Merge request reports