Repair job to fix permissions for avatars#24898
Conversation
|
By analyzing the blame information on this pull request, we identified @DeepDiver1975, @PVince81 and @nickvergessen to be potential reviewers |
d6da6a7 to
dbdaf56
Compare
|
Great fix. Makes sense to backport 👍 |
There was a problem hiding this comment.
Column not found: 1054 Unknown column 'home::%' in 'where clause'
Needs to be a parameter in qb2
There was a problem hiding this comment.
Or see
core/lib/private/SystemTag/SystemTagManager.php
Lines 143 to 146 in 8fbb63d
|
All fixed. Review time! |
|
Looks good, but lets wait for tests |
|
Guess which one failed ? |
|
of course... man... oracle... will take care... |
|
Ah right the platform stuff... yeah lets fix that indeed... |
|
Ok now using platform... |
|
looks like pgsql had a hiccup 😦 |
|
Rebased... |
|
Postgres is still having trouble... but is unrelated to this PR from my POV... final review time |
| ->where($path) | ||
| ->andWhere($qb2->expr()->in('storage', $qb2->createFunction($qb->getSQL()))) | ||
| ->andWhere($qb2->expr()->neq('permissions', $qb2->createNamedParameter(23))) | ||
| ->setParameter('like', 'home::%'); |
There was a problem hiding this comment.
ew, this will not work with LDAP and long storage IDs 😢
There was a problem hiding this comment.
you will need to use the Storage/Cache API to find the matching storage and adjust permissions
There was a problem hiding this comment.
why? ldap also has home::.... right?
There was a problem hiding this comment.
there is some twisted logic in the storage id code: if the actual storage id string is bigger than the column width (64?) then it will convert it to the md5 of the storage id instead. With LDAP user ids it is more likely to happen.
See https://github.com/owncloud/core/wiki/Storage-IDs#random-numberstring
It has and is still a nightmare...
There was a problem hiding this comment.
hmpf, should have the same as with share:: that is keeping the prefix outside of the md5.
There was a problem hiding this comment.
O that is nasty... I still propose to merge this and have a separate job that does the query magic...
There was a problem hiding this comment.
second job could search for "not starting with home::, local:: and shared::" and then only analyze those, but I agree, lets get this in and continue in a second PR
There was a problem hiding this comment.
A second job to fill in the gaps ? Ideally there should be only one job that does the work to its full extent. Because else later if a dev fixes a bug in one, they might forget the second one...
The sad part is that it requires iterating over users https://github.com/owncloud/core/blob/v9.0.2/lib/private/repair/repairlegacystorages.php#L214
There was a problem hiding this comment.
Okay, the piece that iterates over user should be added in this same job, not in a separate one.
In this case this PR is acceptable as a start.
|
@rullzer how to test ? I guess manually set the permissions wrong in the database ? |
|
@PVince81 yes... the only way indeed... look at the test so see. |
Fixes #22978 On some older installations the permissions for the userRoot and the avatars are not correct. This breaks since we now use the Node API in the avatar code. This repair job makes sure that the permissions are set correctly. * Unit tests added
|
Rebased so solve conflict |
|
Tested, works 👍 I set the permissions to 0 on the user's storage root and also on the avatar files. The UI would not show them any more. Then I ran the upgrade (had to increase version.php) with this PR and the avatars were back. |
|
@rullzer please prepare the backport PR for 9.0 |
|
Stable9 in #25068 |
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Fixes #22978
On some older installations the permissions for the userRoot and the
avatars are not correct. This breaks since we now use the Node API in
the avatar code.
This repair job makes sure that the permissions are set correctly.
CC: @PVince81 @nickvergessen @icewind1991 @blizzz
@karlitschek should be backported to 9.0 since that is where the issue originally happend.