Skip to content

UserInfo.blocked is not checked anywhere #746

Closed

Description

@lukehutch

UserInfo has a field blocked with the comment True if the user is blocked from signing in.

However, this field is not read anywhere in serverpod, as far as I can tell.

In particular, I can't see any code that checks whether a user is blocked if an endpoint specifies

  @override
  bool get requireLogin => true;

Activity

  1. lukehutch commented on Mar 16, 2023

    @lukehutch
    ContributorAuthor

    Sorry, the code suggestion won't work because session.signedInUser doesn't exist. How can canUserAccessEndpoint get access to the UserInfo for the logged-in user?

  2. vlidholt commented on Mar 20, 2023

    @vlidholt
    Collaborator

    It can be useful when used together with the auth module, which has a callback for approving a log in. But you are right, perhaps this should be an automatic check.

  3. added
    enhancement
    on Mar 20, 2023
  4. lukehutch commented on Mar 20, 2023

    @lukehutch
    ContributorAuthor

    I assume the UserInfo is not looked up for the logged-in user on every API call, only the auth key is checked in the session.

    So in order to be able to immediately revoke a user's rights using blocked (rather than only on login), not only should blocked be looked up for the user on login, but there probably needs to be methods Users.blockById and Users.blockByEmail that look up a user, set the UserId.blocked to true, then invalidate the auth key for the user.

    How should that last step be performed, i.e. invalidating the session of a logged-in user who has active connections to the server?

  5. lukehutch commented on Jun 2, 2023

    @lukehutch
    ContributorAuthor

    See the PR linked above this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions