Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not try to load avatar for users that never logged in #25802

Closed
wants to merge 1 commit into from

Conversation

butonic
Copy link
Member

@butonic butonic commented Aug 15, 2016

alternative approach to not initialize the fs for every user, see #25286 (comment)

supersedes #25286

ref #25790

cc @PVince81 @DeepDiver1975 My mind keeps telling me that the user backend should provide the avatar. In case of ldap that means some jpg from the ldap server. Which is theoretically possible even if the user never logged in before.

@mention-bot
Copy link

@butonic, thanks for your PR! By analyzing the annotation information on this pull request, we identified @rullzer, @blizzz and @icewind1991 to be potential reviewers

@@ -81,6 +81,8 @@ public function getAvatar($userId) {
$user = $this->userManager->get($userId);
if (is_null($user)) {
throw new \Exception('user does not exist');
} else if ($user->getLastLogin() === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clever!

@PVince81
Copy link
Contributor

@butonic indeed, you're right. Unfortunately this doesn't work with LDAP avatars for users who just logged in.

To reproduce:

  1. Setup LDAP from docker using https://github.com/owncloud/administration/tree/master/ldap-testing
  2. Run "batchCreateUsers.php", it also sets avatars
  3. Setup LDAP in OC
  4. Login as "zombie1"
  5. Check avatar => none
  6. Log out, then log in again as "zombie1"
  7. Check avatar => it's there now

@PVince81
Copy link
Contributor

I suppose this could be extended to have a check for "is this the user's first login ?" and if yes, proceed to sync the whole LDAP profile. I think the LDAP profile sync already happens but too early at a time where last login is still 0.

@PVince81
Copy link
Contributor

👎 as it doesn't work with LDAP

@PVince81
Copy link
Contributor

The original issue was about carddav sync. How about skipping users who never logged in in the carddav sync job ?

Unfortunately still a quick fix but might do the job for this specific case.

@butonic @DeepDiver1975

@PVince81
Copy link
Contributor

@butonic looks like there's a bug on stable9.1, it turns out that even without your PR the LDAP avatar is only loaded during the second login. So either it's a regression or not... either way your PR might be valid and useful after all...

@PVince81
Copy link
Contributor

Seems it's an older issue that avatar only loaded at second login: #25894

@PVince81
Copy link
Contributor

I suggest to close this since we have another solution: #26124

But I'd also like to explore having a "first login" flag and "first login hook" as @DeepDiver1975 mentionned, and then use it to copy skeleton files, etc. It would be useful to have a function "hasThisUserEverLoggedInBefore()" in various parts of the code so we could skip those quickly.

@DeepDiver1975
Copy link
Member

For the first login event there is a pr open

@DeepDiver1975 DeepDiver1975 deleted the noavatarforjuvenileuser branch September 27, 2016 22:17
@lock
Copy link

lock bot commented Aug 4, 2019

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.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants