Exclude groups from sharing and multiple groups

Hello,

If the user is a member of several groups, then all groups must be specified to disable sharing for this user.
I want to prevent students from sharing. For example all students are in the group are “students”. However, each student is also in a class (group), i.e. 1, 2, 3a etc.
To prevent students from sharing, it is not enough to enter the group “students” in “Settings - Sharing - Exclude groups from sharing”, I must also enter all classes.
I think it should be that as soon as a user is member of a single group, sharing should be deactivated for that user.

The users and groups are read from the LDAP directory and change every year. So I would always have to check if the groups are still up to date.

Is this a bug or a feature?

Thanks
Klaus

Edit: Changed subject to fit better
Additional comment:
If it is really not a bug, please make an option to select that one matching group is enough to prevent from sharing.

I bring this up again and think that this is definitely a bug.
From the Nextlcoud documentation:

https://docs.nextcloud.com/server/19/admin_manual/configuration_files/file_sharing_configuration.html

Check Exclude groups from sharing to prevent members of specific groups from creating any file shares in those groups. When you check this, you’ll get a dropdown list of all your groups to choose from. Members of excluded groups can still receive shares, but not create any.

I read that if a user is a member of even one of the groups, sharing should be disabled.

Students can copy and then share. You can not really deny it.

Of course they can share over other platforms. But it is a liability issue for the school.
So I have to deny it in Nextcloud.

Yes. But Nextcloud is a sharing platform. Like internet filter. They also does not really work.