Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(producers): add link to admin manual on session success #6267

Merged
merged 1 commit into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ProductOpener/Display.pm
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ sub init()

# %admin is defined in Config.pm
# admins can change permissions for all users
if ((%admins) and (defined $User_id) and (exists $admins{$User_id})) {
if (is_admin_user($User_id)) {
$admin = 1;
}

Expand Down
14 changes: 14 additions & 0 deletions lib/ProductOpener/Users.pm
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ BEGIN

&userpath
&create_user
&is_admin_user
&create_password_hash
&check_password_hash

Expand Down Expand Up @@ -197,6 +198,19 @@ sub delete_user($) {
find_and_replace_user_id_in_products($userid, $new_userid);
}

=head2 is_admin_user($user_id)
alexgarel marked this conversation as resolved.
Show resolved Hide resolved

Simply tells if a user is an admin of the platform

=cut
sub is_admin_user($) {
my $user_id = shift;

# %admin is defined in Config.pm
# admins can change permissions for all users
return (%admins) and (defined $user_id) and (exists $admins{$user_id});
}


sub display_user_form($$$) {

Expand Down
4 changes: 4 additions & 0 deletions po/common/common.pot
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ msgctxt "you_can_also_help_us"
msgid "You can also help to fund the Open Food Facts project"
msgstr ""

msgctxt "producers_administration_manual"
msgid "Producers Admin manual"
msgstr "Producers Admin manual"

msgctxt "bottom_content"
msgid ""
"<a href=\"https://world.openfoodfacts.org/donate-to-open-food-facts\"><img src=\"https://static.openfoodfacts.org/images/"
Expand Down
4 changes: 4 additions & 0 deletions po/common/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ msgctxt "you_can_also_help_us"
msgid "You can also help to fund the Open Food Facts project"
msgstr "You can also help to fund the Open Food Facts project"

msgctxt "producers_administration_manual"
alexgarel marked this conversation as resolved.
Show resolved Hide resolved
msgid "Producers Admin manual"
msgstr "Producers Admin manual"

msgctxt "bottom_content"
msgid "<a href=\"https://world.openfoodfacts.org/donate-to-open-food-facts\"><img src=\"https://static.openfoodfacts.org/images/svg/donate-icon.svg\" alt=\"Donate to Open Food Facts\" /></a><p><<site_name>> is made by a non-profit association, independent from the industry. It is made for all, by all, and it is funded by all. You can support our work by <a href=\"https://world.openfoodfacts.org/donate-to-open-food-facts\">donating to Open Food Facts</a> and also by <a href=\"https://www.lilo.org/fr/open-food-facts/?utm_source=open-food-facts\">using the Lilo search engine</a>.<br/><b>Thank you!</b></p>"
msgstr "<a href=\"https://world.openfoodfacts.org/donate-to-open-food-facts\"><img src=\"https://static.openfoodfacts.org/images/svg/donate-icon.svg\" alt=\"Donate to Open Food Facts\" /></a><p><<site_name>> is made by a non-profit association, independent from the industry. It is made for all, by all, and it is funded by all. You can support our work by <a href=\"https://world.openfoodfacts.org/donate-to-open-food-facts\">donating to Open Food Facts</a> and also by <a href=\"https://www.lilo.org/fr/open-food-facts/?utm_source=open-food-facts\">using the Lilo search engine</a>.<br/><b>Thank you!</b></p>"
Expand Down
4 changes: 4 additions & 0 deletions po/common/fr.po
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,10 @@ msgctxt "you_can_also_help_us"
msgid "You can also help to fund the Open Food Facts project"
msgstr "Vous pouvez aussi nous aider à financer le projet Open Food Facts"

msgctxt "producers_administration_manual"
msgid "Producers Admin manual"
msgstr "Manuel d'administration de la plateforme producteurs"

msgctxt "bottom_content"
msgid "<a href=\"https://world.openfoodfacts.org/donate-to-open-food-facts\"><img src=\"https://static.openfoodfacts.org/images/svg/donate-icon.svg\" alt=\"Donate to Open Food Facts\" /></a><p><<site_name>> is made by a non-profit association, independent from the industry. It is made for all, by all, and it is funded by all. You can support our work by <a href=\"https://world.openfoodfacts.org/donate-to-open-food-facts\">donating to Open Food Facts</a> and also by <a href=\"https://www.lilo.org/fr/open-food-facts/?utm_source=open-food-facts\">using the Lilo search engine</a>.<br/><b>Thank you!</b></p>"
msgstr "<a href=\"https://fr.openfoodfacts.org/faire-un-don-a-open-food-facts\"><img src=\"https://static.openfoodfacts.org/images/svg/donate-icon.svg\" alt=\"Donate to Open Food Facts\" /></a><p><<site_name>> est développé par une association à but non lucratif indépendante de l'industrie. Open Food Facts est fait pour tous, par tous, et est financé par tous. Vous pouvez soutenir notre travail en <a href=\"https://fr.openfoodfacts.org/faire-un-don-a-open-food-facts\">donnant à Open Food Facts</a> et aussi en utilisant le <a href=\"https://www.lilo.org/fr/open-food-facts/?utm_source=open-food-facts\">moteur de recherche Lilo</a>.<br/><b>Merci beaucoup !</b></p>"
Expand Down
8 changes: 8 additions & 0 deletions templates/web/pages/session/session.tt.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ <h3>[% lang('you_can_also_help_us') %]</h3>
<p>[% lang('bottom_content') %]</p>
[% END %]

[% IF admin and server_options_producers %]
<p>
<a href="https://docs.google.com/document/d/106LAPvseRcMA_6mBj0uNXZcEDiiCKWH9SKzg0JMeg0w/edit">
[% lang('producers_administration_manual') %]
</a>
</p>
[% END %]

[% ELSE %]

<p>[% lang('goodbye') %]</p>
Expand Down