groupfolders icon indicating copy to clipboard operation
groupfolders copied to clipboard

`files:transfer-ownership` of files/folders in group folders

Open t3easy opened this issue 6 years ago โ€ข 9 comments

Steps to reproduce

  1. user1 moved the shared folder to a group folder that can be changed by user 1 and user 2
  2. user2 should get the ownership of all shares of user1 to change them
  3. ./occ files:transfer-ownership user1 user2

Expected behaviour

The shares are now owned by user2

Actual behaviour

The shares are still owned by user1 and the command throws errors for each share with file/folder in the group folder:

Could not restore share with id 3276:#0 /var/www/html/lib/private/Share20/Manager.php(938): OC\Share20\Manager->generalCreateChecks(Object(OC\Share20\Share))
nextcloud/server#1 /var/www/html/apps/files/lib/Service/OwnershipTransferService.php(292): OC\Share20\Manager->updateShare(Object(OC\Share20\Share))
nextcloud/server#2 /var/www/html/apps/files/lib/Service/OwnershipTransferService.php(148): OCA\Files\Service\OwnershipTransferService->restoreShares('user1', 'user2', Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
nextcloud/server#3 /var/www/html/apps/files/lib/Command/TransferOwnership.php(108): OCA\Files\Service\OwnershipTransferService->transfer(Object(OC\User\User), Object(OC\User\User), '', Object(Symfony\Component\Console\Output\ConsoleOutput), false)
nextcloud/server#4 /var/www/html/3rdparty/symfony/console/Command/Command.php(255): OCA\Files\Command\TransferOwnership->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
nextcloud/server#5 /var/www/html/3rdparty/symfony/console/Application.php(915): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
nextcloud/server#6 /var/www/html/3rdparty/symfony/console/Application.php(272): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\TransferOwnership), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
nextcloud/server#7 /var/www/html/3rdparty/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
nextcloud/server#8 /var/www/html/lib/private/Console/Application.php(214): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
nextcloud/server#9 /var/www/html/console.php(99): OC\Console\Application->run()
nextcloud/server#10 /var/www/html/occ(11): require_once('/var/www/html/c...')
nextcloud/server#11 {main}

Server configuration

Operating system: The official docker image Web server: The nginx with the config from the example https://github.com/nextcloud/docker/blob/master/.examples/docker-compose/with-nginx-proxy/mariadb-cron-redis/fpm/web/nginx.conf Database: MariaDB 10.4 PHP version: 7.3.15

Nextcloud version: (see Nextcloud admin page) 18.0.1 Updated from an older Nextcloud/ownCloud or fresh install: Updated Where did you install Nextcloud from:

Signing status:

Signing status
No errors have been found.

List of activated apps:

App list
Enabled:
  - accessibility: 1.4.0
  - activity: 2.11.0
  - admin_audit: 1.8.0
  - announcementcenter: 3.7.0
  - bruteforcesettings: 1.5.0
  - cloud_federation_api: 1.1.0
  - comments: 1.8.0
  - dav: 1.14.0
  - external: 3.5.0
  - federatedfilesharing: 1.8.0
  - federation: 1.8.0
  - files: 1.13.1
  - files_accesscontrol: 1.8.1
  - files_automatedtagging: 1.8.0
  - files_pdfviewer: 1.7.0
  - files_retention: 1.7.0
  - files_rightclick: 0.15.2
  - files_sharing: 1.10.1
  - files_trashbin: 1.8.0
  - files_videoplayer: 1.7.0
  - firstrunwizard: 2.7.0
  - groupfolders: 6.0.1
  - logreader: 2.3.0
  - lookup_server_connector: 1.6.0
  - nextcloud_announcements: 1.7.0
  - notifications: 2.6.0
  - oauth2: 1.6.0
  - password_policy: 1.8.0
  - photos: 1.0.0
  - privacy: 1.2.0
  - provisioning_api: 1.8.0
  - recommendations: 0.6.0
  - serverinfo: 1.8.0
  - settings: 1.0.0
  - sharebymail: 1.8.0
  - spreed: 8.0.5
  - systemtags: 1.8.0
  - text: 2.0.0
  - theming: 1.9.0
  - twofactor_backupcodes: 1.7.0
  - user_ldap: 1.8.0
  - viewer: 1.2.0
  - workflowengine: 2.0.0
Disabled:
  - encryption
  - files_external
  - files_versions
  - support
  - survey_client
  - updatenotification

Nextcloud configuration:

Config report
{
    "system": {
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "domain.tld"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/domain.tld",
        "overwriteprotocol": "https",
        "dbtype": "mysql",
        "version": "18.0.1.3",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "logtimezone": "UTC",
        "installed": true,
        "ldapIgnoreNamingRules": false,
        "ldapProviderFactory": "\\OCA\\User_LDAP\\LDAPProviderFactory",
        "ldapUserCleanupInterval": 20,
        "versions": "false",
        "mail_smtpmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "knowledgebaseenabled": false,
        "default_language": "de",
        "maintenance": false,
        "enable_previews": true,
        "preview_max_x": 256,
        "preview_max_y": 256,
        "loglevel": 2,
        "share_folder": "\/Shared",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mysql.utf8mb4": true
    }
}

Are you using external storage, if yes which one: local/smb/sftp/... no Are you using encryption: yes/no no Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/... LDAP

LDAP configuration (delete this part if not used)

LDAP config
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Configuration                 |                                                                                                                                                                                                                                                                                                                                                                                   |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| hasMemberOfFilterSupport      | 1                                                                                                                                                                                                                                                                                                                                                                                 |
| homeFolderNamingRule          |                                                                                                                                                                                                                                                                                                                                                                                   |
| lastJpegPhotoLookup           | 0                                                                                                                                                                                                                                                                                                                                                                                 |
| ldapAgentName                 | CN=bind,CN=Users,DC=some,DC=domain                                                                                                                                                                                                                                                                                                                                              |
| ldapAgentPassword             | ***                                                                                                                                                                                                                                                                                                                                                                               |
| ldapAttributesForGroupSearch  |                                                                                                                                                                                                                                                                                                                                                                                   |
| ldapAttributesForUserSearch   |                                                                                                                                                                                                                                                                                                                                                                                   |
| ldapBackupHost                | ldaps://dc2.some.domain                                                                                                                                                                                                                                                                                                                                                      |
| ldapBackupPort                | 636                                                                                                                                                                                                                                                                                                                                                                               |
| ldapBase                      | DC=some,DC=domain                                                                                                                                                                                                                                                                                                                                                                   |
| ldapBaseGroups                | DC=some,DC=domain                                                                                                                                                                                                                                                                                                                                                                   |
| ldapBaseUsers                 | DC=some,DC=domain                                                                                                                                                                                                                                                                                                                                                                   |
| ldapCacheTTL                  | 600                                                                                                                                                                                                                                                                                                                                                                               |
| ldapConfigurationActive       | 1                                                                                                                                                                                                                                                                                                                                                                                 |
| ldapDefaultPPolicyDN          |                                                                                                                                                                                                                                                                                                                                                                                   |
| ldapDynamicGroupMemberURL     |                                                                                                                                                                                                                                                                                                                                                                                   |
| ldapEmailAttribute            | mail                                                                                                                                                                                                                                                                                                                                                                              |
| ldapExperiencedAdmin          | 0                                                                                                                                                                                                                                                                                                                                                                                 |
| ldapExpertUUIDGroupAttr       |                                                                                                                                                                                                                                                                                                                                                                                   |
| ldapExpertUUIDUserAttr        |                                                                                                                                                                                                                                                                                                                                                                                   |
| ldapExpertUsernameAttr        |                                                                                                                                                                                                                                                                                                                                                                                   |
| ldapExtStorageHomeAttribute   |                                                                                                                                                                                                                                                                                                                                                                                   |
| ldapGidNumber                 | gidNumber                                                                                                                                                                                                                                                                                                                                                                         |
| ldapGroupDisplayName          | cn                                                                                                                                                                                                                                                                                                                                                                                |
| ldapGroupFilter               | (&(objectCategory=group)(cn=CLD*))                                                                                                                                                                                                                                                                                                                                                |
| ldapGroupFilterGroups         |                                                                                                                                                                                                                                                                                                                                                                                   |
| ldapGroupFilterMode           | 1                                                                                                                                                                                                                                                                                                                                                                                 |
| ldapGroupFilterObjectclass    |                                                                                                                                                                                                                                                                                                                                                                                   |
| ldapGroupMemberAssocAttr      | member                                                                                                                                                                                                                                                                                                                                                                            |
| ldapHost                      | ldaps://dc1.some.domain                                                                                                                                                                                                                                                                                                                                                      |
| ldapIgnoreNamingRules         |                                                                                                                                                                                                                                                                                                                                                                                   |
| ldapLoginFilter               | (&(&(objectCategory=person)(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(memberOf:1.2.840.113556.1.4.1941:=CN=CLD User,DC=some,DC=domain))(|(samaccountname=%uid)(|(mailPrimaryAddress=%uid)(mail=%uid)))) |
| ldapLoginFilterAttributes     |                                                                                                                                                                                                                                                                                                                                                                                   |
| ldapLoginFilterEmail          | 1                                                                                                                                                                                                                                                                                                                                                                                 |
| ldapLoginFilterMode           | 1                                                                                                                                                                                                                                                                                                                                                                                 |
| ldapLoginFilterUsername       | 1                                                                                                                                                                                                                                                                                                                                                                                 |
| ldapNestedGroups              | 0                                                                                                                                                                                                                                                                                                                                                                                 |
| ldapOverrideMainServer        | 0                                                                                                                                                                                                                                                                                                                                                                                 |
| ldapPagingSize                | 500                                                                                                                                                                                                                                                                                                                                                                               |
| ldapPort                      | 636                                                                                                                                                                                                                                                                                                                                                                               |
| ldapQuotaAttribute            |                                                                                                                                                                                                                                                                                                                                                                                   |
| ldapQuotaDefault              |                                                                                                                                                                                                                                                                                                                                                                                   |
| ldapTLS                       | 0                                                                                                                                                                                                                                                                                                                                                                                 |
| ldapUserAvatarRule            | default                                                                                                                                                                                                                                                                                                                                                                           |
| ldapUserDisplayName           | cn                                                                                                                                                                                                                                                                                                                                                                                |
| ldapUserDisplayName2          |                                                                                                                                                                                                                                                                                                                                                                                   |
| ldapUserFilter                | (&(objectCategory=person)(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(memberOf:1.2.840.113556.1.4.1941:=CN=CLD User,DC=some,DC=domain))                                                                   |
| ldapUserFilterGroups          | CLD User                                                                                                                                                                                                                                                                                                                                                                       |
| ldapUserFilterMode            | 1                                                                                                                                                                                                                                                                                                                                                                                 |
| ldapUserFilterObjectclass     | user                                                                                                                                                                                                                                                                                                                                                                              |
| ldapUuidGroupAttribute        | auto                                                                                                                                                                                                                                                                                                                                                                              |
| ldapUuidUserAttribute         | auto                                                                                                                                                                                                                                                                                                                                                                              |
| turnOffCertCheck              | 0                                                                                                                                                                                                                                                                                                                                                                                 |
| turnOnPasswordChange          | 0                                                                                                                                                                                                                                                                                                                                                                                 |
| useMemberOfToDetectMembership | 1                                                                                                                                                                                                                                                                                                                                                                                 |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Client configuration

Browser:

Operating system:

Logs

Web server error log

Web server error log
Insert your webserver log here

Nextcloud log (data/nextcloud.log)

Nextcloud log
Insert your Nextcloud log here

Browser log

Browser log
Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log
c) ...

t3easy avatar Mar 10 '20 10:03 t3easy

Same error here. Using PHP 7.4, PostgreSQL 12.4 and Nextcloud 20.

My guess is that it's related to user2 not being in the same groups as user1. And as the share is shared with groupA (user1), then share is not transferred and error is displayed.

vahem2lu avatar Oct 22 '20 12:10 vahem2lu

In my case, user 1 and user 2 are not in the same groups, but one group, which is used for the group folder, is the same.

t3easy avatar Oct 22 '20 15:10 t3easy

Do I understand you correctly?

  • user1 is member of groupA

  • user1 is member of groupB

  • user2 is member of groupB

  • user2 is member of groupC

  • user2 is member of groupD

folderX has been shared with groupB.

Now you transfer ownership from user1->user2 and get this error?

My guess is that maybe this process tries to create new share (because groupB is a match) and fails because of some UNIQUE key constraint or so...?

vahem2lu avatar Oct 22 '20 17:10 vahem2lu

The folder is not shared with groupB, it was moved in a group folder of groupB.

t3easy avatar Oct 23 '20 15:10 t3easy

After done this "so-called" Nextcloud user migration process for ~70 users (due to AD/LDAP change and new usernames) my guess is that this is NOT (entirely) related to user being in the same group or not.

For example, I've transferred from userA to userB, but mos of the shares stayed with userA and caused this error. Some of the shares were transferred to userB (as this was their new username). If userA was not in the same group as userB (because groups changed and I rely on AD/LDAP groups), then the share was not transferred at all. Funny thing is that I've just found one (but my guess is that it's not the only one) which share transfer has not caused an error, but it has not moved also.

As I've deleted old LDAP/AD config, I've got ~70 users with leftovers. Now I am about to update oc_share table and edit share_with, uid_owner and uid_initiator columns accordingly to reflect their new username. This seems to work for some test-cases.

vahem2lu avatar Nov 05 '20 23:11 vahem2lu

Probably related: https://github.com/nextcloud/groupfolders/issues/458

fschrempf avatar Apr 09 '21 09:04 fschrempf

Then I'd keep the issue in group folder.

pierreozoux avatar Apr 09 '21 14:04 pierreozoux

Then I'd keep the issue in group folder.

But that are different issues. I try to change the owner of the public share links from one user to another for files within a group folder.

t3easy avatar Apr 09 '21 18:04 t3easy

But that are different issues. I try to change the owner of the public share links from one user to another for files within a group folder.

Yes, that's why I wrote "related" and not "duplicate". So we should reopen this and as this looks to be an issue with the groupfolders app move the issue over there.

fschrempf avatar Apr 09 '21 19:04 fschrempf

This is very old and I can't reproduce it.

provokateurin avatar Nov 19 '25 14:11 provokateurin