nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.37k stars 4.07k forks source link

[Bug]: Admin shares hide user default folders if user hasn't logged in at least once #47282

Open mickenordin opened 2 months ago

mickenordin commented 2 months ago

⚠️ This issue respects the following points: ⚠️

Bug description

At least in 29.0.4.1 this is possible:

Admin has a directory called X User B has a directory called X Admin shares directory X with User B. User B's directory X is now subject to any rules set up by the share by Admin. I.e. Admin can make any directory read only, or disappear completly if User B can not access User Admin's directory X due to file_accesscontrol rules.

Steps to reproduce

  docker run --rm --detach -p 8080:80 --name nextcloud nextcloud:latest; \
    sleep 10s; \
    docker exec -u www-data nextcloud /bin/bash -c "/var/www/html/occ maintenance:install --admin-user='admin' --admin-pass='adminpassword'"; \
    docker exec -u www-data nextcloud /bin/bash -c "env OC_PASS=validuserpassword /var/www/html/occ user:add --password-from-env --display-name='User' user"  

Now log in as admin, and share the Documents directory with 'user' and notice that it is now a share instead of the users default Document directory

Expected behavior

User receives a share called "Documents 2"

Installation method

Community Docker image

Nextcloud Server version

29

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

SQlite

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

nfebe commented 1 month ago

Not a able to reproduce this. Is this a thing only with the ACL's??? The expected behavior of having a second directory with (2) for example is what I get on master and stable29

joshtrichards commented 1 month ago

Not a able to reproduce this.

Same.

User receives a share called "Documents 2"

This is what I see.

I don't see an obvious PR that changed this behavior recently one way or another. Are you still able to reproduce this, @mickenordin?

mickenordin commented 1 month ago

Yes, I am able to reproduce this with the latest docker image 2024-09-26T09:15:11,533099151+02:00

mickenordin commented 1 month ago

I just ran the exact docker command in the description, after a docker pull on nextcloud:latest and got the exact same behaviour. I am sure you must have used some other means of reproducing it, outside of the docker image then? So maybe we can figure out what the difference is?

nextcloud-command commented 6 days ago

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

mickenordin commented 3 days ago

Like I said, I can still reproduce this, it worked today with the latest docker image. Have you tried this @nfebe ?

  docker run --rm --detach -p 8080:80 --name nextcloud nextcloud:latest; \
    sleep 10s; \
    docker exec -u www-data nextcloud /bin/bash -c "/var/www/html/occ maintenance:install --admin-user='admin' --admin-pass='adminpassword'"; \
    docker exec -u www-data nextcloud /bin/bash -c "env OC_PASS=validuserpassword /var/www/html/occ user:add --password-from-env --display-name='User' user" 
nfebe commented 3 days ago

Like I said, I can still reproduce this, it worked today with the latest docker image. Have you tried this @nfebe ?

I would have to conduct some tests using the docker image eventually. However, that is already seeming like an "environment" thingy and not an actual bug?

joshtrichards commented 2 days ago

Now log in as admin, and share the Documents directory with 'user' and notice that it is now a share instead of the users default Document directory

I see what's happening. Since this share, in your reproduction steps, happens before User has logged in for the first time, they don't even have a Documents folder yet (default folders/files get generated upon first login).

Since their own Documents folder doesn't exist, the shared one is the first one. So, based on implementation, this is expected behavior.

As long as the share is with a user that has logged in at least once, this doesn't happen. And it only applies to default/skeleton files/folders.

joshtrichards commented 2 days ago

Somewhat related (because this only happens since we create initial folders at first login): #21119