openfoodfacts-server icon indicating copy to clipboard operation
openfoodfacts-server copied to clipboard

Being able to view the list of users attached to an organisation on the pro platform

Open manon-corneille opened this issue 2 years ago • 2 comments

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 avatar Jun 29 '22 14:06 manon-corneille

@manon-corneille I've removed the email

teolemon avatar Jun 29 '22 15:06 teolemon

Related issue :

  • #6720

alexgarel avatar Jul 06 '22 08:07 alexgarel

This issue is stale because it has been open 90 days with no activity.

github-actions[bot] avatar Oct 20 '22 00:10 github-actions[bot]

In fact it should be really easy to do as we have a "members" and "admins" field in the org sto file.

alexgarel avatar Jan 09 '23 17:01 alexgarel

Hey...wanted to resolve this issue..kindly assign it to me! Thanks!

MonalikaPatnaik avatar May 23 '23 21:05 MonalikaPatnaik

@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 !

alexgarel avatar Jun 01 '23 12:06 alexgarel

Okay...let me try i think I have to make changes in cgi/org.pl right?

MonalikaPatnaik avatar Jun 01 '23 12:06 MonalikaPatnaik

@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.

stephanegigandet avatar Jun 02 '23 13:06 stephanegigandet

Okay okay..Working on it<3 Thankyou so muchh!

MonalikaPatnaik avatar Jun 02 '23 16:06 MonalikaPatnaik