FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    remove user from all groups

    Scheduled Pinned Locked Moved
    General Discussion
    2
    2
    444
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      lambert.torres
      last edited by

      Is there an api I can call that removes a user from all groups? I can see one that explicitly removes them from a particular group, but I'd like to remove them from all groups.

      danD 1 Reply Last reply Reply Quote 0
      • danD
        dan @lambert.torres
        last edited by

        @lambert-torres

        Hiya, there is no API I know of that will remove a user from all groups, but you can certainly chain APIs. The way I'd do it would be to retrieve the user using the User API, iterate all user.memberships and get the groupId from each one. Then I'd use the Group API to remove the user from each group, using DELETE against /api/group/member?groupId={groupId}&userId={userId}

        Hope that helps, thanks for using FusionAuth!

        --
        FusionAuth - Auth for devs, built by devs.
        https://fusionauth.io

        1 Reply Last reply Reply Quote 0
        • First post
          Last post