nextcloud / nextcloud/groupfolders

Lack ways to ensure idempotence when adding users/groups entitled to manage advanced permissions using OCC commands

Open
#4,236 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage bug
Dominant language
PHP
Stars
343
Forks
106
Avg merge
2d 3h
Merged PRs (30d)
34

Description

How to use GitHub
  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.
Steps to reproduce
  1. Create team folder
  2. Run sudo -u apache php /var/www/html/nextcloud/occ groupfolders:permissions --manage-add --user admin -- 1
  3. Run the same command again.
Expected behaviour

This command shouldn't arbitrarily fail even when the entitled user is already added.

Another expected behavior would be I can query whether the user/group is already added with another OCC command, and skip this command when it is the case. However as far as I can tell such command isn't implemented yet.

Actual behaviour

The following error occurred:

In DbalException.php line 56:
                                                                                                  
  An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation  
  : 1062 Duplicate entry '1-user-admin' for key 'PRIMARY'                                         
                                                                                                  

In ExceptionConverter.php line 64:
                                                                                                  
  An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation  
  : 1062 Duplicate entry '1-user-admin' for key 'PRIMARY'                                         
                                                                                                  

In Exception.php line 24:
                                                                                                  
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-user-admin' for key '  
  PRIMARY'                                                                                        
                                                                                                  

In Statement.php line 130:
                                                                                                  
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1-user-admin' for key '  
  PRIMARY'                                                                                        
                                                                                                  
Known workaround

Force remove the entitled user/group before running the command works.

Server configuration

Operating system: Rocky Linux 9

Web server: Apache httpd 2.4.62-7.el9.x86_64

Database: MariaDB 10.5.27-1.el9_5.0.2.x86_64

PHP version: 8.2.30

Nextcloud version: 31.0.12

Team folders version: 19.1.12

Updated from an older Nextcloud/ownCloud or fresh install: false

Where did you install Nextcloud from: Server archive

Are you using external storage, if yes which one: local

Are you using encryption: no

Are you using an external user-backend, if yes which one: false

Client configuration

Browser: Firefox 146.0.1

Operating system: Ubuntu 25.10

Logs

No related logs found for this issue.

Web server error log

N/A

Nextcloud log (data/nextcloud.log)

No related logs found for this issue.

Browser log

N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the groupfolders:permissions OCC command and reproduce the two commands from the issue against a team folder. Trace how --manage-add handles an already-entitled user, then verify that repeating the command no longer fails and that any supported way to check existing users or groups matches the requested behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authorization, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.