[GH-ISSUE #1294] Implement a way to get list of all user got added from the given active org id or slug #8681

Closed
opened 2026-04-13 03:50:34 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @swapnawebdev on GitHub (Jan 29, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/1294

Is this suited for github?

  • Yes, this is suited for github

currently have only getActiveMember() which return single member, but i have req to show all the users in the org, is this possible with better-auth or i can just crud over member collection ?

thank you

Describe the solution you'd like

i would like to have a getActiveMembers() , that return the users and roles given dlug or id of the org

Describe alternatives you've considered

im just making the crud operations now over member table or collection

Additional context

No response

Originally created by @swapnawebdev on GitHub (Jan 29, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/1294 ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. currently have only getActiveMember() which return single member, but i have req to show all the users in the org, is this possible with better-auth or i can just crud over member collection ? thank you ### Describe the solution you'd like i would like to have a getActiveMembers() , that return the users and roles given dlug or id of the org ### Describe alternatives you've considered im just making the crud operations now over member table or collection ### Additional context _No response_
GiteaMirror added the locked label 2026-04-13 03:50:34 -05:00
Author
Owner

@swapnawebdev commented on GitHub (Jan 29, 2025):

3bca303fa7/demo/nextjs/app/dashboard/page.tsx (L20C13-L20C32)

by using getFullOrganization we might get members object , but still having the getActiveMembers() is beneficial

this is the resp of that

{
    "id": "7SoYKjcfgjy8LjP1CGTzrWY8TEKpUxCy",
    "name": "huhu",
    "slug": "huhu",
    "logo": null,
    "createdAt": "2025-01-29T09:29:21.691Z",
    "metadata": null,
    "invitations": [
        {
            "id": "3hhfFZhQgAU4KqUXh5Ye0LyOv5fwXTXd",
            "organizationId": "7SoYKjcfgjy8LjP1CGTzrWY8TEKpUxCy",
            "email": "xxxxxxx@kuandika.com",
            "role": "admin",
            "status": "accepted",
            "expiresAt": "2025-01-31T11:50:02.484Z",
            "inviterId": "ftSoK7pr2RCtTV7RiSEHJ1JqXlHj1uBm"
        }
    ],
    "members": [
        {
            "id": "dp3X37zNg53NKergXYaGd5unm8QUvfK9",
            "organizationId": "7SoYKjcfgjy8LjP1CGTzrWY8TEKpUxCy",
            "userId": "ttftSoK7pr2RCtTV7RiSEHJ1JqXlHj1uBm",
            "role": "owner",
            "createdAt": "2025-01-29T09:29:21.741Z",
            "user": {
                "id": "ftSoK7pr2RCtTV7RiSEHJ1JqXlHj1uBm",
                "name": "yuyu yuyu",
                "email": "xxxxxxxx@rrr.com",
                "image": ""
            }
        },
        {
            "id": "AWF8kuqyGSxZ2SP6WIsoJdnNqXeQ0Cu4",
            "organizationId": "7SoYKjcfgjy8LjP1CGTzrWY8TEKpUxCy",
            "userId": "ttaqL0SRP1DlGSZhfaGvcnI9bJFqQdBVqV",
            "role": "admin",
            "createdAt": "2025-01-29T11:50:59.976Z",
            "user": {
                "id": "aqL0SRP1DlGSZhfaGvcnI9bJFqQdBVqV",
                "name": "dssd dfdf",
                "email": "yyyyyyyyyyyyy@rr.com",
                "image": ""
            }
        }
    ]
}


from this we can get the members

<!-- gh-comment-id:2621454183 --> @swapnawebdev commented on GitHub (Jan 29, 2025): https://github.com/better-auth/better-auth/blob/3bca303fa7fb75d9bffb82d90c1cb94d69154299/demo/nextjs/app/dashboard/page.tsx#L20C13-L20C32 by using `getFullOrganization` we might get members object , but still having the `getActiveMembers()` is beneficial this is the resp of that ``` { "id": "7SoYKjcfgjy8LjP1CGTzrWY8TEKpUxCy", "name": "huhu", "slug": "huhu", "logo": null, "createdAt": "2025-01-29T09:29:21.691Z", "metadata": null, "invitations": [ { "id": "3hhfFZhQgAU4KqUXh5Ye0LyOv5fwXTXd", "organizationId": "7SoYKjcfgjy8LjP1CGTzrWY8TEKpUxCy", "email": "xxxxxxx@kuandika.com", "role": "admin", "status": "accepted", "expiresAt": "2025-01-31T11:50:02.484Z", "inviterId": "ftSoK7pr2RCtTV7RiSEHJ1JqXlHj1uBm" } ], "members": [ { "id": "dp3X37zNg53NKergXYaGd5unm8QUvfK9", "organizationId": "7SoYKjcfgjy8LjP1CGTzrWY8TEKpUxCy", "userId": "ttftSoK7pr2RCtTV7RiSEHJ1JqXlHj1uBm", "role": "owner", "createdAt": "2025-01-29T09:29:21.741Z", "user": { "id": "ftSoK7pr2RCtTV7RiSEHJ1JqXlHj1uBm", "name": "yuyu yuyu", "email": "xxxxxxxx@rrr.com", "image": "" } }, { "id": "AWF8kuqyGSxZ2SP6WIsoJdnNqXeQ0Cu4", "organizationId": "7SoYKjcfgjy8LjP1CGTzrWY8TEKpUxCy", "userId": "ttaqL0SRP1DlGSZhfaGvcnI9bJFqQdBVqV", "role": "admin", "createdAt": "2025-01-29T11:50:59.976Z", "user": { "id": "aqL0SRP1DlGSZhfaGvcnI9bJFqQdBVqV", "name": "dssd dfdf", "email": "yyyyyyyyyyyyy@rr.com", "image": "" } } ] } ``` from this we can get the members
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#8681