Federation: add a member from another server to a circle is not working from Admin panel
I tried to had https://api.test-paris.happy-dev.fr/users/samia/ to http://api.test-nantes.happy-dev.fr/circles/1/, but it is not working.
I might not use the interface properly. Here is how I tried it:
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Ghost User changed milestone to %Circles
changed milestone to %Circles
By Alexandre on 2019-10-27T12:56:09 (imported from GitLab project)
- Owner
You can, but the field on which you have to add the user urlid is the user field himself.
Django admin really does not like this for users, so you'd better create this membership with sib-forms or any rest client.
Something like this should be ok to test, but you'll miss authentication:
curl -X POST -H "Content-Type: application/ld+json" -d '{"user": {"@id":"https://api.test-paris.happy-dev.fr/users/samia/","@context":"https://cdn.happy-dev.fr/owl/hdcontext.jsonld"}' http://api.test-nantes.happy-dev.fr/circles/1/members/
With a sib-form, it will be something like this:
<sib-form data-src="http://api.test-nantes.happy-dev.fr/circles/1/members/" fields="user" range-user="https://api.test-paris.happy-dev.fr/users/" widget-user='sib-form-auto-completion'></sib-form>
If you want to get users from Nantes & Paris on the range-user, you'll face this issue: https://git.happy-dev.fr/startinblox/framework/sib-core/issues/511
- Author Contributor
@jbpasquier: OK. What I hear is that DjangoLDP is missing the right interfaces to have the federation working, right?
If that's the case, I'll create a dedicated issue for that.
By Alexandre on 2019-10-28T12:00:21 (imported from GitLab project)
- Owner
We have to rewrite the behavior of django's admin if you want this on.
- Maintainer
Why do we have to change the behavior of the admin?
- Owner
Two solutions:
- Cleanest: We don't want dropdown on foreignkeys, we want simple input on which you can put webids.
- Dirty: We want to show the urlid field of the user model. But this leads to two problems: Non federated user model will miss it and for federated user model, you will have to create a user with fake name/password before changing his urlid to the distant one.
- Maintainer
Django admin already supports lookup popups for foreign keys: https://docs.djangoproject.com/en/1.11/ref/contrib/admin/#django.contrib.admin.ModelAdmin.raw_id_fields
We might want to cusomize it to look for remote resources
- Owner
Cool, sounds perfect for this.
- Owner
Not that perfect. @sylvain Can we call about this?
- Maintainer
sure, I think there are several topics we want to discuss, although I haven't made a list of them.
- Author Contributor
Keep me posted
By Alexandre on 2019-10-28T14:40:28 (imported from GitLab project)
- Maintainer
Waiting for a spec here: https://git.happy-dev.fr/startinblox/djangoldp-packages/djangoldp/issues/189
- Author Contributor
Am I wrong to say that https://git.happy-dev.fr/startinblox/djangoldp-packages/djangoldp/issues/189 is actually another problem and shouldn't block this issue?
By Alexandre on 2019-11-12T16:04:10 (imported from GitLab project)
- Owner
The current workaround - create a middle model that handle the link reference - works. By the way, @christophehenry is looking for a solid solution to handle it without messing the database.
- Author Contributor
@jbpasquier, @balessan: Are we going into production on this workaround?
If yes, @jbpasquier: is it, or when will it be, available on staging?
By Alexandre on 2019-11-12T17:24:52 (imported from GitLab project)
- Owner
It's already on. You just can't create distant user from django admin interface. You have to do it from frontend/curl/anything else.
Nothings change, it's on test-paris/nantes from the beginning, it was the way we already had project members.
Maybe @sylvain could give you better details on.
- Maintainer
You can't create a remote user, or you can't add it to a circle?
- Owner
@sylvain You can't easily create a remote user directly from the Circle interface. You have to click on the "plus" button near the select, then put something on "username/password" then edit it to change his urlid to the distant webid. By the way, just saw User does not have a field to edit his urlid on administration.
As I saw on the Alex screencam or also on Calum screenshot, they always want to put the user on the urlid field of the relation.
The only working way is this one: https://git.happy-dev.fr/startinblox/applications/sib-app/issues/272#note_52817
- Author Contributor
Get it. I test some more using CURL and I let you know
By Alexandre on 2019-11-12T19:09:46 (imported from GitLab project)