openfoodfacts-server
openfoodfacts-server copied to clipboard
Being able to view the list of users attached to an organisation on the pro platform
What
- It would be helpful to know which users are behind an organisation so that I can contact them easily.
Solution
- I can imagine the solution as a button on the left panel : "View the organisation users".
It would be great to have :
- userid: kurzeja12
- name: kurzeja12
- email: kur****[email protected]
- langage (lc)
- country (cc)
- date of last activity
- In the future: CRM status?
- Any other field you might find relevant :)
Part of
- #5521
@manon-corneille I've removed the email
Related issue :
- #6720
This issue is stale because it has been open 90 days with no activity.
In fact it should be really easy to do as we have a "members" and "admins" field in the org sto file.
Hey...wanted to resolve this issue..kindly assign it to me! Thanks!
@Monalika Patnaik for this issue here is the structure of a typical org:
{
"admins" : {
"xxxxx" : 1,
"yyyyy" : 1,
"zzzzz" : 1
},
"created_t" : 1620718096,
"creator" : "zzzzz",
"members" : {
"xxxxx" : 1,
"yyyyy" : 1,
"zzzzz" : 1
},
"name" : "My Food Company",
"org_id" : "my-food-company"
}
The best would be if you are capable of writing an integration test, where you create an org create multiple users and assign them to org, then display org page. But it might be harder than I think !
Okay...let me try i think I have to make changes in cgi/org.pl right?
@MonalikaPatnaik: @manon-corneille suggested to put it on the org profile page. That's a page like this one: https://world.openfoodfacts.org/editor/org-unilever-france-gms
It is rendered using the template /templates/web/pages/org_profile/org_profile.tt.html
The template is called from this code in Display.pm:
` # Display the user or organization profile
my $user_template_data_ref = dclone($user_or_org_ref);
my $profile_html = "";
if ($tagid =~ /^org-/) {
# Display the organization profile
if (is_user_in_org_group($user_or_org_ref, $User_id, "admins") or $admin) {
$user_template_data_ref->{edit_profile} = 1;
$user_template_data_ref->{orgid} = $orgid;
}
process_template('web/pages/org_profile/org_profile.tt.html',
$user_template_data_ref, \$profile_html)
or $profile_html
= "<p>web/pages/org_profile/org_profile.tt.html template error: " . $tt->error() . "</p>";
}`
When the user is an admin, you can have the template show a table with the org members. You will first have to generate the list of users from the structure that is in $user_or_org_ref (the one @alexgarel pointed to above), and pass the list to the template through the $user_template_data_ref structure.
Okay okay..Working on it<3 Thankyou so muchh!