Check Restrictuserstoonlysharewithusersintheirgroups to confine
sharing within group memberships.

Note

This setting does not apply to the Federated Cloud sharing
feature. If Federated Cloud Sharing is
enabled, users can still share items with any users on any instances
(including the one they are on) via a remote share.

Check Allowuserstosendmailnotificationforsharedfiles enables
users to send an email notification to every ownCloud user that the file is
shared with.

Check Excludegroupsfromsharing 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

You may transfer files from one user to another with occ.
The command transfers either all or a limited set of files from one user to another.
It also transfers the shares and metadata info associated with those files (shares, tags, and comments, etc).
This is useful when you have to transfer a user’s files to another user before you delete them.

Important

Trashbin contents are not transferred.

Here is an example of how to transfer all files from one user to another.

occ files:transfer-ownership <source-user> <destination-user>

Here is an example of how to transfer a limited group a single folder from one user to another.
In it, folder/to/move, and any file and folder inside it will be moved to <destination-user>.

The directory provided to the --path switch must exist inside data/<source-user>/files.

The directory (and its contents) won’t be moved as is between the users. It’ll be moved inside the destination user’s files directory, and placed in a directory which follows the format: transferredfrom<source-user>on<timestamp>. Using the example above, it will be stored under: data/<destination-user>/files/transferredfrom<source-user>on20170426_124510/

When a user is deleted, their files are also deleted. As you can imagine, this
is a problem if they created file shares that need to be preserved, because
these disappear as well. In ownCloud files are tied to their owners, so
whatever happens to the file owner also happens to the files.

One solution is to create persistent shares for your users. You can retain
ownership of them, or you could create a special user for the purpose of
establishing permanent file shares. Simply create a shared folder in the usual
way, and share it with the users or groups who need to use it. Set the
appropriate permissions on it, and then no matter which users come and go, the
file shares will remain. Because all files added to the share, or edited in it,
automatically become owned by the owner of the share regardless of who adds or
edits them.