How to restrict users to login who belongs to specific groups?


I set up nextcloud 13 with LDAP user and group backend enabled, successfully.
Next, I want to restrict users to login nextcloud who belongs to some specific group, e.g. “staff”.

I found the work arround using hook.
Yes, it works well on owncloud 9, but does not work on nextcloud 13.

Does anyone port this hook to nextcloud?

Thanks in advance.

Why not just adapt your LDAP query if you only want a specific group to access NC? There is a lot ways to do this in Nextcloud itself, have a look at where configure LDAP, you will see things such as user and group filters.

Thank you for your reply.

But my LDAP does not have “memberOf” attribute, so it seems the group setting does not work well.

Do you mean your LDAP implementation or your Nextcloud instance?

Sorry for confusing, I’m using the LDAP in our organization.
This LDAP manages group members by “memberUid”, not “memberOf”.
In this situation and for OC9, it seems that hook can restrict users to login who belongs to specific groups.
But it seems that hook does not work on NC13.