This was discussed on irc. Lets create a new avatar plugin that query's phab's conduit under the ldap section looking for the users profile image.
Note if the users wants there avatar on gerrit, they will have to link there account with ldap.
| Paladox | |
| Oct 27 2017, 10:20 PM |
| F10506940: Screen Shot 2017-10-29 at 22.30.00.png | |
| Oct 29 2017, 10:30 PM |
| F10506923: Screen Shot 2017-10-29 at 22.27.20.png | |
| Oct 29 2017, 10:28 PM |
| F10506926: Screen Shot 2017-10-29 at 22.27.30.png | |
| Oct 29 2017, 10:28 PM |
This was discussed on irc. Lets create a new avatar plugin that query's phab's conduit under the ldap section looking for the users profile image.
Note if the users wants there avatar on gerrit, they will have to link there account with ldap.
Though the only problem would be, gerrit needs to make the image smaller or bigger in some cases. Is that supported in phab?
Nothing to be done in Phabricator code if I understand it correctly, hence removing tag.
@Aklapper it depends though. We may need a new conduit call for this as gerrit side chooses the size of images, whereas phab's side, it dosen't support that looking at the code.
I've created the plugin now. I am currently having an issue when it fetches the users image, but using the default image i provide is fine :).
Does anyone have any suggestions for a default image? I've picked one for my testing. But i presume you may want a different one?
Also we may want to create a repo to fetch images from. Using json in java is very slow.
Using a repo will be easier too and faster :).
I think i will move the repo to under wmf namespace as it uses custom wmf specific conduit.
Who discussed this? When? What if a Gerrit user doesn't have a Phab profile (or if it's not connected. or has multiple)? What if they don't want the same avatar?
We discussed this on irc on friday. But it's up to you weather to reject it :).
My code is published at https://github.com/paladox/phabricator-avatar/ under WIP status as it still has some bugs i need to fix first.
Also it fallback to a default image but that has to be chosen.
But anyways, using a repo would possibly be fast then java decoding json.
This is what it looks like
I think to solve "the what if they want a different profile image on gerrit" problem, we can use a repo.
It would not require any backend changes phab side. Just a repo created and we can then do something like
https://phabricator.wikimedia.org/diffusion/WDQG/browse/master/${username}.png?view=raw (this will also reduce someone uploading a virus as the change would need approval :))
in the plugin. That url should redirect to the safe one anyways
To summarize the discussion on Friday, Gerrit has a plugin for Gravatar. That looks up the email address from a third party site which we can't do due to privacy.
The idea is thus to:
Using a repo would make things faster, and less likly to break phab's side with all that query's.
It would also allow users to opt in.
We need to request a repo to be created which i can do.
Creating a repository full of binary images is just going to grow unmanageably large.
I'm not a fan of this task generally, I don't think it's a good use of effort plus it's extra code for Gerrit we're on the hook for maintaining.
@demon Yep, i was thinking about the repo being large would be bad (after i published the comment above). So now i've moved onto developing a phab extension that acts like the gerrit one we have but will query the ldap table on phab and use the profile image link it gets. Or fallback to a default one. This wont need a repo and will be fast as it wont need to parse json gerrit side. This will allow us to use an existing plugin from upstream called avatars-external. I've checked the source code and looks safe to me. It dosen't have hidden links or anything.
Have we talked to those maintaining LDAP to see if putting profile images into the records is something we want? I'm pretty sure there's no user-facing frontend for that right now either.
@demon it's already available phabs side with https://phabricator.wikimedia.org/conduit/method/user.ldapquery/ :)
I just need to copy that so we doint need to use conduit to get the users image.
What on earth does that have to do with it? We don't store the images in LDAP, they're stored in Phab's DB.
Yes users would need to link there ldap account with phab to be able to use there avatar. And yes that's what i mean, the image is stored in the db. We can find the image and use it for the user.
https://phabricator.wikimedia.org/api/user.ldapquery is a good find, I gave it a try with ldapnames: ["Hashar"] which yields:
{
"0": {
...
"image": "https://phab.wmfusercontent.org/file/data/k54aqkz5kdxlgzzsq6m4/PHID-FILE-qt4pww65fyhg3eg6qmcm/profile",
...
}https://phab.wmfusercontent.org/file/data/k54aqkz5kdxlgzzsq6m4/PHID-FILE-qt4pww65fyhg3eg6qmcm/profile that is me ! :] So I guess we can get Gerrit to use that directly?
I have no clue what the IRC discussion was, but adding avatars in our Gerrit seems resurrected with T191183