Disable "leave this share" for user or groups


I found this old issue :arrow_down:, which is a bit old and a bit different

What I would like is to share 2 folders with a single user (and repeat for many users, no share with multiple users)

├── user10_share
│   ├── data_readonly
│   └── data_readwrite
├── user1_share
│   ├── data_readonly
│   └── data_readwrite
├── user2_share
│   ├── data_readonly
│   └── data_readwrite
├── user3_share
│   ├── data_readonly
│   └── data_readwrite
├── user4_share
│   ├── data_readonly
│   └── data_readwrite
├── user5_share
│   ├── data_readonly
│   └── data_readwrite
├── user6_share
│   ├── data_readonly
│   └── data_readwrite
├── user7_share
│   ├── data_readonly
│   └── data_readwrite
├── user8_share
│   ├── data_readonly
│   └── data_readwrite
└── user9_share
    ├── data_readonly
    └── data_readwrite

The purpose is to have deposit folder for a single user, and consulting data folder too for him. Users are not related to each other. They just share the same nextcloud hosted service. Managers can see all data for all users.

Nextcloud version: AIO
Operating system: Debian GNU/Linux 12 (bookworm)
Apache: Apache/2.4.59
PHP version: running PHP 8.2.18.

The issue you are facing:

I don’t want the user to be able to leave the share. It should be done by admin only.

I programmed the user creation process, and automated the share, it’s working fine.

How can I disable the ability to leave the share for all those users?

Steps to replicate Leaving a share:

  1. Admin shares a folder with user1
  2. log as user1
  3. go to Files > shares
  4. right click on a share > “leave this share”
  5. you’re gone…

What I tested:

  • external storage app, I added a single local storage for one of the folder for the user as readonly
  • groupfolders app, setup 2 groups for individual John.Doe17 John.Doe17-write and shared 2 groupfolders with distinct permissions and also share with manager upper group which will see all shared groups.

I did both manually I may test it with a bunch of users and groups. :thinking:

I also made a re-share folder script.

May be css or js could hide “leave this share”, or manual hack somewhere in php code…

Or did I miss something?

What would you advise here?