mirror of
https://github.com/requarks/wiki.git
synced 2026-03-02 22:57:36 -05:00
Sync groups and group membership through auth strategies #1460
Labels
No labels
BETA
BETA
accessibility
backlog
bug
can't replicate
contrib-easy
contrib-hard
contrib-medium
deferred
documentation
duplicate
duplicate
editors
enhancement
invalid
localization
migrate
ui
under review
v3
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/wiki#1460
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @signalkraft on GitHub (May 13, 2020).
Originally assigned to: @NGPixel on GitHub.
First off: It seems there is already a few feature requests on https://wiki.js.org/feedback/?search=group for this, so I added a ticket because I'm thinking about helping with the first implementation here.
Actual behavior
Currently authenticating with different strategies does not update group membership, even if the strategy supports that (i.e. roles in Keycloak, groups in LDAP). Manually adding users to groups is cumbersome and makes it difficult to use Wiki.js in larger teams where you want give some sub-teams their own private section.
Expected behavior
Signing in with a strategy that supports group / role memberships should create a group on Wiki.js, if it doesn't exist yet, and then add the user to the group during authentication. There should be settings in the admin UI of the different strategies that support groups, to control this behavior. My guess would be:
You could get infinitely more complex with custom group mappings, background sync of groups from LDAP, nested groups, permission mapping, etc, but as a first version the above seems useful.
--
I'd be happy to dig into the code and try to contribute a PR for LDAP and/or Keycloak, if you agree that this is a useful feature @NGPixel - it seems widely requested on Canny.
@NGPixel commented on GitHub (May 15, 2020):
Sounds good 👍
@baodrate commented on GitHub (Aug 17, 2020):
@signalkraft have you started on this? I'd like to give it a shot, but don't want to repeat any work you might've already done
@signalkraft commented on GitHub (Aug 25, 2020):
@qubidt I looked into the underlying auth lib (passport) but couldn't figure out a good way to get groups out of it. Its main purpose is authentication, so maybe I also went at this from the wrong angle.
I fixed my own issue with groups by building a small python service that syncs users and groups back and forth over the (excellent) GraphQL API. So go for it!
@baodrate commented on GitHub (Sep 2, 2020):
@signalkraft thanks, I looked into it a bit and also came to a similar conclusion. Not sure I'm familiar enough with the codebase to make the wide changes this would require. Your solution sounds like it could work well for me so I'll give it a shot, thanks!
@signalkraft commented on GitHub (Sep 2, 2020):
@qubidt Here's my two scripts as a starting point for anyone in a similar position.
get_ipa_clientis just a thin wrapper around FreeIPAs Python SDK.Bunch of ways to improve this still (nested loops, referencing nested dicts without null checks) but it runs reliably for me.
@drehelis commented on GitHub (Mar 27, 2021):
@NGPixel is this something that is being looked into for the upcoming major releases?
@NGPixel commented on GitHub (Mar 28, 2021):
It is planned for 3.x yes
@warthy commented on GitHub (May 20, 2021):
is it worth it to open an MR with a potential "quick" implementation or V3 we be release soon, so there wouldn't any point ?
@devksingh4 commented on GitHub (Feb 20, 2022):
Hello,
Has there been any progress on implementing this for v3.x? I am hoping to use it with Azure AD. I didn't see any posted updates here or on the feedback page within the last year.
@uberspot commented on GitHub (Apr 11, 2022):
+1 on this issue. Reviving this thread in the hope that someone would implement this.
It's a very useful feature.
@jtagcat commented on GitHub (Apr 11, 2022):
GitHub Etiquette
@fionera commented on GitHub (May 5, 2022):
I would love tho see this happen. In the best case with a mapping of provider role name => group. I sadly dont know how the wikijs Codebase works and how much work implementing this would be
@aelgasser commented on GitHub (Mar 27, 2023):
@NGPixel et al. I just submitted a PR to implement group sync with SAML: https://github.com/requarks/wiki/pull/6299
@fionera if you're still interested, this can be a starting point for you to implement it in another strategy.
@fionera commented on GitHub (Mar 27, 2023):
@aelgasser I already implemented assignment for it for oidc https://github.com/requarks/wiki/pull/5568
@ValentinKolb commented on GitHub (Jan 26, 2026):
Nested LDAP Groups via
memberOfFallbackHey, I ran into a related issue with nested LDAP groups in FreeIPA that might be worth addressing here.
The Problem
The current group search filter
(member=uid={{username}},...)only finds direct memberships. With nested groups like:WikiJS only sees
dev-frontend, notdevelopersorstaff.Simple Fix
LDAP servers already resolve this via the
memberOfattribute on users - it contains ALL groups (direct + inherited). We just need a fallback when group search returns empty:This is backwards compatible - existing setups keep working, nested group users get proper mappings.
Only requirement:
memberOfneeds to be in the user search attributes.Happy to submit a PR if there's interest!
@drumadrian commented on GitHub (Jan 26, 2026):
hi @ValentineKolb
it sounds like the limitation preventing visibility of all relationships,
specifically memberOf
is this correct?
would we also need to test these use cases?
Things to Consider
• Data Structure: The code snippet uses _.get(profile, '_groups'). You
would need to ensure your specific LDAP configuration is actually pulling
the memberOf attribute from the server during the initial bind/search.
• Regex Parsing: The snippet shows a regex to extract the group name from a
DN (e.g., turning cn=developers,ou=groups,dc=example into just developers).
You'll want to make sure this matches your naming convention.
thanks for your input and suggestion 🤓
On Mon, Jan 26, 2026 at 12:05 PM Valentin Kolb @.***>
wrote: