Skip to content

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

Closed
butonic wants to merge 1 commit into
stable9from
noavatarforjuvenileuser
Closed

butonic wants to merge 1 commit into
stable9from
noavatarforjuvenileuser

Conversation

@butonic

@butonic butonic commented Aug 15, 2016

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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

$user = $this->userManager->get($userId);
if (is_null($user)) {
throw new \Exception('user does not exist');
} else if ($user->getLastLogin() === 0) {

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

👎 as it doesn't work with LDAP

@PVince81

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

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

@PVince81

Copy link
Copy Markdown
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
Copy Markdown
Contributor

For the first login event there is a pr open

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

lock Bot commented Aug 4, 2019

Copy link
Copy Markdown

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