From 8a2a9085be40f4530e080be25b0b51db4ba9d3f8 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Tue, 12 Mar 2024 18:58:27 +0100 Subject: [PATCH 01/10] (impv) add loader for create/delete availability slot --- .../src/javascript/controllers/admin/calendar.js | 14 +++++++++++++- .../src/javascript/controllers/events.js.erb | 5 +++++ .../templates/admin/calendar/deleteRecurrent.html | 2 +- .../templates/admin/calendar/eventModal.html | 2 +- app/frontend/templates/events/deleteRecurrent.html | 2 +- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/app/frontend/src/javascript/controllers/admin/calendar.js b/app/frontend/src/javascript/controllers/admin/calendar.js index 3e59d6b76..77b132488 100644 --- a/app/frontend/src/javascript/controllers/admin/calendar.js +++ b/app/frontend/src/javascript/controllers/admin/calendar.js @@ -789,6 +789,8 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui // number of slots for this availability $scope.slots_nb = slots; + $scope.saving = false; + /** * Adds or removes the provided machine from the current slot * @param machine {Object} @@ -867,9 +869,14 @@ Application.Controllers.controller('CreateEventModalController', ['$scope', '$ui if ($scope.isOnlySubscriptions && $scope.selectedPlans.length > 0) { $scope.availability.plan_ids = $scope.selectedPlans.map(function (p) { return p.id; }); } + $scope.saving = true; return Availability.save( { availability: $scope.availability }, - function (availability) { $uibModalInstance.close(availability); } + function (availability) { $uibModalInstance.close(availability); }, + function (error) { + console.error(error); + $scope.saving = false; + } ); }; @@ -1158,15 +1165,19 @@ Application.Controllers.controller('DeleteRecurrentAvailabilityController', ['$s // with recurrent slots: how many slots should we delete? $scope.deleteMode = 'single'; + $scope.deleting = false; + /** * Confirmation callback */ $scope.ok = function () { const { id, start_at, end_at } = availabilityPromise; + $scope.deleting = true; // the admin has confirmed, delete the slot Availability.delete( { id, mode: $scope.deleteMode }, function (res) { + $scope.deleting = false; // delete success if (res.deleted > 1) { growl.success(_t( @@ -1185,6 +1196,7 @@ Application.Controllers.controller('DeleteRecurrentAvailabilityController', ['$s }); }, function (res) { + $scope.deleting = false; // not everything was deleted const { data } = res; if (data.total > 1) { diff --git a/app/frontend/src/javascript/controllers/events.js.erb b/app/frontend/src/javascript/controllers/events.js.erb index 376a6378e..04aaead75 100644 --- a/app/frontend/src/javascript/controllers/events.js.erb +++ b/app/frontend/src/javascript/controllers/events.js.erb @@ -1096,15 +1096,19 @@ Application.Controllers.controller('DeleteRecurrentEventController', ['$scope', // with recurrent slots: how many slots should we delete? $scope.deleteMode = 'single'; + $scope.deleting = false; + /** * Confirmation callback */ $scope.ok = function () { + $scope.deleting = true; const { id, start_at, end_at } = eventPromise; // the admin has confirmed, delete the slot Event.delete( { id, mode: $scope.deleteMode }, function (res) { + $scope.deleting = false; // delete success if (res.deleted > 1) { growl.success(_t( @@ -1122,6 +1126,7 @@ Application.Controllers.controller('DeleteRecurrentEventController', ['$scope', }); }, function (res) { + $scope.deleting = false; // not everything was deleted const { data } = res; if (data.total > 1) { diff --git a/app/frontend/templates/admin/calendar/deleteRecurrent.html b/app/frontend/templates/admin/calendar/deleteRecurrent.html index 6d26fe67a..cce63be6e 100644 --- a/app/frontend/templates/admin/calendar/deleteRecurrent.html +++ b/app/frontend/templates/admin/calendar/deleteRecurrent.html @@ -21,6 +21,6 @@ diff --git a/app/frontend/templates/admin/calendar/eventModal.html b/app/frontend/templates/admin/calendar/eventModal.html index 0f7d3c551..077d3986c 100644 --- a/app/frontend/templates/admin/calendar/eventModal.html +++ b/app/frontend/templates/admin/calendar/eventModal.html @@ -252,6 +252,6 @@ diff --git a/app/frontend/templates/events/deleteRecurrent.html b/app/frontend/templates/events/deleteRecurrent.html index 90acecbf8..a6ae798b3 100644 --- a/app/frontend/templates/events/deleteRecurrent.html +++ b/app/frontend/templates/events/deleteRecurrent.html @@ -22,6 +22,6 @@ From 1b6f43361cd07460b2109c18bbfec340e06a6481 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Tue, 12 Mar 2024 18:58:46 +0100 Subject: [PATCH 02/10] update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3f5b7fca..df078dc9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Next release +- improvement: add loader for create/delete availability slot + ## v6.3.16 2024 March 11 - Fix a bug: set settlement by cash by default for local payment mean From 0b085104736feaee3ae5d0587eaeff7cac2c5dd5 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Mon, 18 Mar 2024 18:36:10 +0100 Subject: [PATCH 03/10] (bug) unable to update a space with a deleted machine --- CHANGELOG.md | 1 + app/frontend/src/javascript/lib/api.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index df078dc9d..cee1a7843 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Next release - improvement: add loader for create/delete availability slot +- Fix a bug: unable to update a space with a deleted machine ## v6.3.16 2024 March 11 diff --git a/app/frontend/src/javascript/lib/api.ts b/app/frontend/src/javascript/lib/api.ts index 76e99d6fc..1de9110df 100644 --- a/app/frontend/src/javascript/lib/api.ts +++ b/app/frontend/src/javascript/lib/api.ts @@ -18,7 +18,7 @@ export default class ApiLib { ...object, ...attachmentAttributes.reduce((a, name) => { return { ...a, [name]: null }; }, {}) } - }, { dateWithTimezone: true }); + }, { dateWithTimezone: true, allowEmptyArrays: true }); attachmentAttributes.forEach((attr) => { data.delete(`${name}[${attr}]`); if (Array.isArray(object[attr])) { From 6db25324d2ce9ea38977830662c12f1d8e6e2e22 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Wed, 20 Mar 2024 14:59:02 +0100 Subject: [PATCH 04/10] (bug) unable to get invoice payment details if the account code is same for card/transfer payment method --- CHANGELOG.md | 1 + app/views/open_api/v1/accounting/index.json.jbuilder | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cee1a7843..11277b0b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - improvement: add loader for create/delete availability slot - Fix a bug: unable to update a space with a deleted machine +- Fix a bug: unable to get invoice payment details if the account code is same for card/transfer payment method ## v6.3.16 2024 March 11 diff --git a/app/views/open_api/v1/accounting/index.json.jbuilder b/app/views/open_api/v1/accounting/index.json.jbuilder index 44b161f0b..fca21c588 100644 --- a/app/views/open_api/v1/accounting/index.json.jbuilder +++ b/app/views/open_api/v1/accounting/index.json.jbuilder @@ -11,7 +11,7 @@ json.lines @lines do |line| json.url download_open_api_v1_invoice_path(line.invoice) json.payment_method line.invoice_payment_method if @codes.values.include?(line.account_code) # if this is a 'payment' line - mean = @codes.select { |_key, value| value == line.account_code } + mean = @codes.select { |_key, value| value == line.account_code && _key == line.invoice_payment_method.to_sym } json.payment_details line.invoice.payment_details(mean.keys[0]) end end From e8b59bbdcd64f98d33d07c5814c4e394bfd782e8 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Thu, 21 Mar 2024 18:21:11 +0100 Subject: [PATCH 05/10] (feat) allow admin configure memeber's profile gender/birthday as required --- CHANGELOG.md | 1 + .../components/user/user-profile-form.tsx | 6 ++--- .../javascript/controllers/admin/members.js | 24 +++++++++++++++++ .../src/javascript/controllers/application.js | 6 +++++ app/frontend/src/javascript/models/setting.ts | 4 ++- app/frontend/src/javascript/router.js | 14 +++++----- .../templates/admin/settings/compte.html | 26 +++++++++++++++++++ .../templates/shared/_admin_form.html | 9 ++++--- .../templates/shared/_manager_form.html | 8 +++--- .../templates/shared/signupModal.html | 8 +++--- app/helpers/excel_helper.rb | 2 +- app/helpers/settings_helper.rb | 2 ++ app/models/statistic_profile.rb | 2 ++ app/models/user.rb | 6 +++-- app/policies/setting_policy.rb | 3 ++- app/views/exports/users_members.xlsx.axlsx | 2 +- config/locales/app.admin.en.yml | 6 +++++ db/seeds/settings.rb | 5 ++++ .../exports/statistics_export_test.rb | 3 ++- 19 files changed, 110 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 11277b0b4..8396dda38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## Next release - improvement: add loader for create/delete availability slot +- improvement: allow admin configure memeber's profile gender/birthday as required - Fix a bug: unable to update a space with a deleted machine - Fix a bug: unable to get invoice payment details if the account code is same for card/transfer payment method diff --git a/app/frontend/src/javascript/components/user/user-profile-form.tsx b/app/frontend/src/javascript/components/user/user-profile-form.tsx index eb7911b93..a2f5f2c9e 100644 --- a/app/frontend/src/javascript/components/user/user-profile-form.tsx +++ b/app/frontend/src/javascript/components/user/user-profile-form.tsx @@ -93,7 +93,7 @@ export const UserProfileForm: React.FC = ({ action, size, }); setValue('invoicing_profile_attributes.user_profile_custom_fields_attributes', userProfileCustomFields); }).catch(error => onError(error)); - SettingAPI.query(['phone_required', 'address_required', 'external_id']) + SettingAPI.query(['phone_required', 'address_required', 'external_id', 'gender_required', 'birthday_required']) .then(settings => setFieldsSettings(settings)) .catch(error => onError(error)); }, []); @@ -185,7 +185,7 @@ export const UserProfileForm: React.FC = ({ action, size,

{t('app.shared.user_profile_form.personal_data')}

- +
= ({ action, size, register={register} label={t('app.shared.user_profile_form.date_of_birth')} disabled={isDisabled} - rules={{ required: true }} + rules={{ required: fieldsSettings.get('birthday_required') === 'true' }} formState={formState} type="date" nullable /> diff --git a/app/frontend/src/javascript/controllers/admin/members.js b/app/frontend/src/javascript/controllers/admin/members.js index 860cb71aa..cf72738f8 100644 --- a/app/frontend/src/javascript/controllers/admin/members.js +++ b/app/frontend/src/javascript/controllers/admin/members.js @@ -720,6 +720,12 @@ Application.Controllers.controller('EditMemberController', ['$scope', '$state', // is the address required in _member_form? $scope.addressRequired = (settingsPromise.address_required === 'true'); + // is the gender number required in _member_form? + $scope.genderRequired = (settingsPromise.gender_required === 'true'); + + // is the birthday required in _member_form? + $scope.birthdayRequired = (settingsPromise.birthday_required === 'true'); + // is user validation required $scope.enableUserValidationRequired = (settingsPromise.user_validation_required === 'true'); @@ -1060,6 +1066,12 @@ Application.Controllers.controller('NewMemberController', ['$scope', '$state', ' // is the address required to sign-up? $scope.addressRequired = (settingsPromise.address_required === 'true'); + // is the gender number required in _member_form? + $scope.genderRequired = (settingsPromise.gender_required === 'true'); + + // is the birthday required in _member_form? + $scope.birthdayRequired = (settingsPromise.birthday_required === 'true'); + // Default member's profile parameters $scope.user = { plan_interval: '', @@ -1205,6 +1217,12 @@ Application.Controllers.controller('NewAdminController', ['$state', '$scope', 'A // is the address required in _admin_form? $scope.addressRequired = (settingsPromise.address_required === 'true'); + // is the gender number required in _admin_form? + $scope.genderRequired = (settingsPromise.gender_required === 'true'); + + // is the birthday required in _admin_form? + $scope.birthdayRequired = (settingsPromise.birthday_required === 'true'); + // all available groups $scope.groups = groupsPromise; @@ -1276,6 +1294,12 @@ Application.Controllers.controller('NewManagerController', ['$state', '$scope', // is the address required in _admin_form? $scope.addressRequired = (settingsPromise.address_required === 'true'); + // is the gender number required in _admin_form? + $scope.genderRequired = (settingsPromise.gender_required === 'true'); + + // is the birthday required in _admin_form? + $scope.birthdayRequired = (settingsPromise.birthday_required === 'true'); + // list of all groups $scope.groups = groupsPromise.filter(function (g) { return !g.disabled; }); diff --git a/app/frontend/src/javascript/controllers/application.js b/app/frontend/src/javascript/controllers/application.js index 846c5eb40..c081a7bd3 100644 --- a/app/frontend/src/javascript/controllers/application.js +++ b/app/frontend/src/javascript/controllers/application.js @@ -103,6 +103,12 @@ Application.Controllers.controller('ApplicationController', ['$rootScope', '$sco // is the address required to sign-up? $scope.addressRequired = (settingsPromise.address_required === 'true'); + // is the gender required to sign-up? + $scope.genderRequired = (settingsPromise.gender_required === 'true'); + + // is the birthday required to sign-up? + $scope.birthdayRequired = (settingsPromise.birthday_required === 'true'); + // reCaptcha v2 site key (or undefined) $scope.recaptchaSiteKey = settingsPromise.recaptcha_site_key; diff --git a/app/frontend/src/javascript/models/setting.ts b/app/frontend/src/javascript/models/setting.ts index 604a58a28..315e74d2e 100644 --- a/app/frontend/src/javascript/models/setting.ts +++ b/app/frontend/src/javascript/models/setting.ts @@ -186,7 +186,9 @@ export const accountSettings = [ 'user_change_group', 'user_validation_required', 'user_validation_required_list', - 'family_account' + 'family_account', + 'gender_required', + 'birthday_required' ] as const; export const analyticsSettings = [ diff --git a/app/frontend/src/javascript/router.js b/app/frontend/src/javascript/router.js index 74d83f59e..610758d88 100644 --- a/app/frontend/src/javascript/router.js +++ b/app/frontend/src/javascript/router.js @@ -127,7 +127,7 @@ angular.module('application.router', ['ui.router']) } }, resolve: { - settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['fablab_name', 'name_genre', 'phone_required', 'address_required']" }).$promise; }], + settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['fablab_name', 'name_genre', 'phone_required', 'address_required', 'gender_required', 'birthday_required']" }).$promise; }], activeProviderPromise: ['AuthProvider', function (AuthProvider) { return AuthProvider.active().$promise; }], groupsPromise: ['Group', function (Group) { return Group.query().$promise; }], cguFile: ['CustomAsset', function (CustomAsset) { return CustomAsset.get({ name: 'cgu-file' }).$promise; }], @@ -174,7 +174,7 @@ angular.module('application.router', ['ui.router']) resolve: { groups: ['Group', function (Group) { return Group.query().$promise; }], activeProviderPromise: ['AuthProvider', function (AuthProvider) { return AuthProvider.active().$promise; }], - settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['phone_required', 'address_required']" }).$promise; }] + settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['phone_required', 'address_required', 'gender_required', 'birthday_required']" }).$promise; }] } }) .state('app.logged.dashboard.supporting_document_files', { @@ -1049,7 +1049,7 @@ angular.module('application.router', ['ui.router']) } }, resolve: { - settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['phone_required', 'address_required']" }).$promise; }] + settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['phone_required', 'address_required', 'gender_required', 'birthday_required']" }).$promise; }] } }) .state('app.admin.members_import', { @@ -1090,7 +1090,7 @@ angular.module('application.router', ['ui.router']) walletPromise: ['Wallet', '$transition$', function (Wallet, $transition$) { return Wallet.getWalletByUser({ user_id: $transition$.params().id }).$promise; }], transactionsPromise: ['Wallet', 'walletPromise', function (Wallet, walletPromise) { return Wallet.transactions({ id: walletPromise.id }).$promise; }], tagsPromise: ['Tag', function (Tag) { return Tag.query().$promise; }], - settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['phone_required', 'address_required', 'user_validation_required']" }).$promise; }] + settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['phone_required', 'address_required', 'gender_required', 'birthday_required', 'user_validation_required']" }).$promise; }] } }) .state('app.admin.admins_new', { @@ -1102,7 +1102,7 @@ angular.module('application.router', ['ui.router']) } }, resolve: { - settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['phone_required', 'address_required']" }).$promise; }], + settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['phone_required', 'address_required', 'gender_required', 'birthday_required']" }).$promise; }], groupsPromise: ['Group', function (Group) { return Group.query({ disabled: false }).$promise; }] } }) @@ -1117,7 +1117,7 @@ angular.module('application.router', ['ui.router']) resolve: { groupsPromise: ['Group', function (Group) { return Group.query().$promise; }], tagsPromise: ['Tag', function (Tag) { return Tag.query().$promise; }], - settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['phone_required', 'address_required']" }).$promise; }] + settingsPromise: ['Setting', function (Setting) { return Setting.query({ names: "['phone_required', 'address_required', 'gender_required', 'birthday_required']" }).$promise; }] } }) @@ -1200,7 +1200,7 @@ angular.module('application.router', ['ui.router']) "'extended_prices_in_same_day', 'recaptcha_site_key', 'recaptcha_secret_key', 'user_validation_required', " + "'user_validation_required_list', 'machines_module', 'user_change_group', " + "'store_module', 'machine_reservation_deadline', 'training_reservation_deadline', 'event_reservation_deadline', " + - "'space_reservation_deadline', 'reservation_context_feature']" + "'space_reservation_deadline', 'reservation_context_feature', 'gender_required', 'birthday_required']" }).$promise; }], privacyDraftsPromise: ['Setting', function (Setting) { return Setting.get({ name: 'privacy_draft', history: true }).$promise; }], diff --git a/app/frontend/templates/admin/settings/compte.html b/app/frontend/templates/admin/settings/compte.html index 44f0f14a9..536d5a627 100644 --- a/app/frontend/templates/admin/settings/compte.html +++ b/app/frontend/templates/admin/settings/compte.html @@ -110,6 +110,32 @@ {{ 'app.admin.settings.account.customize_account_settings' }}
+
+

{{ 'app.admin.settings.gender' }}

+

+ {{ 'app.admin.settings.gender_required_info' }} +

+
+ + +
+
+
+

{{ 'app.admin.settings.birthday' }}

+

+ {{ 'app.admin.settings.birthday_required_info' }} +

+
+ + +
+

{{ 'app.admin.settings.phone' }}

diff --git a/app/frontend/templates/shared/_admin_form.html b/app/frontend/templates/shared/_admin_form.html index 5f90dc4c6..2b33f38c7 100644 --- a/app/frontend/templates/shared/_admin_form.html +++ b/app/frontend/templates/shared/_admin_form.html @@ -6,7 +6,7 @@ name="admin[statistic_profile_attributes][gender]" ng-model="admin.statistic_profile_attributes.gender" ng-value="true" - required/> + ng-required="genderRequired"/> {{ 'app.admin.admins_new.man' | translate }} - +

@@ -76,7 +76,9 @@
- + + + + ng-required="genderRequired"/> {{ 'app.admin.manager_new.man' | translate }} - +
@@ -76,7 +76,9 @@
- + + + {{ 'app.public.common.man' | translate }} + ng-required="genderRequired"/> {{ 'app.public.common.man' | translate }}
- + {{ 'app.public.common.gender_is_required'}}
@@ -222,9 +222,9 @@ is-open="datePicker.opened" placeholder="{{ 'app.public.common.birth_date' | translate }}" ng-click="openDatePicker($event)" - required/> + ng-required="birthdayRequired"/>
- + {{ 'app.public.common.birth_date_is_required' }}
diff --git a/app/helpers/excel_helper.rb b/app/helpers/excel_helper.rb index 9693c9262..391dc8113 100644 --- a/app/helpers/excel_helper.rb +++ b/app/helpers/excel_helper.rb @@ -31,7 +31,7 @@ module ExcelHelper user&.profile&.full_name || t('export.deleted_user'), user&.email || '', user&.profile&.phone || '', - t("export.#{hit['_source']['gender']}"), + hit['_source']['gender'].present? ? t("export.#{hit['_source']['gender']}") : '', hit['_source']['age'], subtype.nil? ? '' : subtype.label ] diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb index 79885b5b1..ec52ec881 100644 --- a/app/helpers/settings_helper.rb +++ b/app/helpers/settings_helper.rb @@ -208,6 +208,8 @@ module SettingsHelper project_categories_filter_placeholder project_categories_wording reservation_context_feature + gender_required + birthday_required ].freeze end # rubocop:enable Metrics/ModuleLength diff --git a/app/models/statistic_profile.rb b/app/models/statistic_profile.rb index e0120c65e..4bd910163 100644 --- a/app/models/statistic_profile.rb +++ b/app/models/statistic_profile.rb @@ -31,6 +31,8 @@ class StatisticProfile < ApplicationRecord validate :check_birthday_in_past def str_gender + return '' if gender.blank? + gender ? 'male' : 'female' end diff --git a/app/models/user.rb b/app/models/user.rb index e714b15d7..11edbf2f3 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -115,8 +115,10 @@ class User < ApplicationRecord end def need_completion? - statistic_profile.gender.nil? || profile.first_name.blank? || profile.last_name.blank? || username.blank? || - email.blank? || encrypted_password.blank? || group_id.nil? || statistic_profile.birthday.blank? || + (Setting.get('gender_required') && statistic_profile.gender.blank?) || + profile.first_name.blank? || profile.last_name.blank? || username.blank? || + email.blank? || encrypted_password.blank? || group_id.nil? || + (Setting.get('birthday_required') && statistic_profile.birthday.blank?) || (Setting.get('phone_required') && profile.phone.blank?) || (Setting.get('address_required') && invoicing_profile&.address&.address&.blank?) end diff --git a/app/policies/setting_policy.rb b/app/policies/setting_policy.rb index 5e3a620b6..be9fb64dd 100644 --- a/app/policies/setting_policy.rb +++ b/app/policies/setting_policy.rb @@ -47,7 +47,8 @@ class SettingPolicy < ApplicationPolicy machines_banner_cta_url trainings_banner_active trainings_banner_text trainings_banner_cta_active trainings_banner_cta_label trainings_banner_cta_url events_banner_active events_banner_text events_banner_cta_active events_banner_cta_label events_banner_cta_url projects_list_member_filter_presence projects_list_date_filters_presence advanced_accounting - project_categories_filter_placeholder project_categories_wording reservation_context_feature family_account child_validation_required] + project_categories_filter_placeholder project_categories_wording reservation_context_feature family_account child_validation_required + gender_required birthday_required] end ## diff --git a/app/views/exports/users_members.xlsx.axlsx b/app/views/exports/users_members.xlsx.axlsx index f4866e267..e05916abe 100644 --- a/app/views/exports/users_members.xlsx.axlsx +++ b/app/views/exports/users_members.xlsx.axlsx @@ -49,7 +49,7 @@ wb.add_worksheet(name: ExcelService.name_safe(t('export_members.members'))) do | member.email, member.is_allow_newsletter, member.last_sign_in_at&.to_date, - member.statistic_profile.gender ? t('export_members.man') : t('export_members.woman'), + member.statistic_profile.gender.present? ? (member.statistic_profile.gender ? t('export_members.man') : t('export_members.woman')) : '', member.statistic_profile.age, member.invoicing_profile&.address&.address || '', member.profile.phone, diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml index ed86a193e..9bf556b83 100644 --- a/config/locales/app.admin.en.yml +++ b/config/locales/app.admin.en.yml @@ -1839,6 +1839,12 @@ en: address: "Address" address_required_info_html: "You can define if the address should be required to register a new user on Fab-manager.
Please note that, depending on your country, the regulations may requires addresses for the invoices to be valid." address_is_required: "Address is required" + gender: "Gender" + gender_is_required: "Gender required" + gender_required_info: "You can define if the gender should be required to register a new user on Fab-manager." + birthday: "Date of birth" + birthday_is_required: "Date of birth required" + birthday_required_info: "You can define if the date of birth number should be required to register a new user on Fab-manager." external_id: "External identifier" external_id_info_html: "You can set up an external identifier for your users, which cannot be modified by the user himself." enable_external_id: "Enable the external ID" diff --git a/db/seeds/settings.rb b/db/seeds/settings.rb index 2b62e06a9..574f6ae57 100644 --- a/db/seeds/settings.rb +++ b/db/seeds/settings.rb @@ -742,3 +742,8 @@ Setting.set('reservation_context_feature', false) unless Setting.find_by(name: ' Setting.set('family_account', false) unless Setting.find_by(name: 'family_account').try(:value) Setting.set('child_validation_required', false) unless Setting.find_by(name: 'child_validation_required').try(:value) + +Setting.set('phone_required', false) unless Setting.find_by(name: 'phone_required').try(:value) +Setting.set('address_required', false) unless Setting.find_by(name: 'address_required').try(:value) +Setting.set('gender_required', true) unless Setting.find_by(name: 'gender_required').try(:value) +Setting.set('birthday_required', true) unless Setting.find_by(name: 'birthday_required').try(:value) diff --git a/test/integration/exports/statistics_export_test.rb b/test/integration/exports/statistics_export_test.rb index 0169aec0c..3ed494cb2 100644 --- a/test/integration/exports/statistics_export_test.rb +++ b/test/integration/exports/statistics_export_test.rb @@ -59,7 +59,8 @@ class Exports::StatisticsExportTest < ActionDispatch::IntegrationTest assert_equal reservation.user.profile.full_name, wb.sheet_data[5][1].value assert_equal reservation.user.email, wb.sheet_data[5][2].value assert_equal reservation.user.profile.phone, wb.sheet_data[5][3].value - assert_equal I18n.t("export.#{reservation.user.statistic_profile.str_gender}"), wb.sheet_data[5][4].value + assert_equal reservation.user.statistic_profile.str_gender.present? ? I18n.t("export.#{reservation.user.statistic_profile.str_gender}") : '', + wb.sheet_data[5][4].value assert_equal reservation.user.statistic_profile.age.to_i, wb.sheet_data[5][5].value assert_equal reservation.reservable.name, wb.sheet_data[5][6].value assert_equal reservation.invoice_items.first.invoice.total / 100.0, wb.sheet_data[5][7].value From 584f3bc4a86def06d708fc43916e10d5fe8595ca Mon Sep 17 00:00:00 2001 From: Du Peng Date: Thu, 21 Mar 2024 18:56:24 +0100 Subject: [PATCH 06/10] update translations --- CHANGELOG.md | 1 + config/locales/app.admin.de.yml | 8 ++++++++ config/locales/app.admin.en.yml | 2 ++ config/locales/app.admin.es-MX.yml | 8 ++++++++ config/locales/app.admin.es.yml | 8 ++++++++ config/locales/app.admin.fr.yml | 10 +++++++++- config/locales/app.admin.it.yml | 8 ++++++++ config/locales/app.admin.no.yml | 8 ++++++++ config/locales/app.admin.pt.yml | 8 ++++++++ config/locales/app.admin.sv.yml | 8 ++++++++ config/locales/app.admin.zu.yml | 8 ++++++++ 11 files changed, 76 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8396dda38..d08c05844 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - improvement: allow admin configure memeber's profile gender/birthday as required - Fix a bug: unable to update a space with a deleted machine - Fix a bug: unable to get invoice payment details if the account code is same for card/transfer payment method +- updates translations ## v6.3.16 2024 March 11 diff --git a/config/locales/app.admin.de.yml b/config/locales/app.admin.de.yml index 01e52ee4e..4dbe34465 100644 --- a/config/locales/app.admin.de.yml +++ b/config/locales/app.admin.de.yml @@ -1787,6 +1787,8 @@ de: fab_analytics: "Fab-Analytics" phone_required: "Telefonummer erforderlich" address_required: "Adresse erforderlich" + gender_required: "gender required" + birthday_required: "date of birth required" tracking_id: "Tracking-ID" facebook_app_id: "Facebook App-ID" twitter_analytics: "Twitter Analytics-Konto" @@ -1839,6 +1841,12 @@ de: address: "Adresse" address_required_info_html: "Sie können festlegen, ob eine Adresse für die Neuregistrierung eines Benutzers erforderlich sein soll.
Bitte beachten Sie dass in Abhängigkeit von Landesvorschriften Adressen für die Gültigkeit der Rechnungen erforderlich sein können." address_is_required: "Adresse ist erforderlich" + gender: "Gender" + gender_is_required: "Gender required" + gender_required_info: "You can define if the gender should be required to register a new user on Fab-manager." + birthday: "Date of birth" + birthday_is_required: "Date of birth required" + birthday_required_info: "You can define if the date of birth number should be required to register a new user on Fab-manager." external_id: "External identifier" external_id_info_html: "You can set up an external identifier for your users, which cannot be modified by the user himself." enable_external_id: "Enable the external ID" diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml index 9bf556b83..f9b091480 100644 --- a/config/locales/app.admin.en.yml +++ b/config/locales/app.admin.en.yml @@ -1787,6 +1787,8 @@ en: fab_analytics: "Fab Analytics" phone_required: "phone required" address_required: "address required" + gender_required: "gender required" + birthday_required: "date of birth required" tracking_id: "tracking ID" facebook_app_id: "Facebook App ID" twitter_analytics: "Twitter analytics account" diff --git a/config/locales/app.admin.es-MX.yml b/config/locales/app.admin.es-MX.yml index 9c236e8ca..2e772a303 100644 --- a/config/locales/app.admin.es-MX.yml +++ b/config/locales/app.admin.es-MX.yml @@ -1787,6 +1787,8 @@ es-MX: fab_analytics: "Fab Analytics" phone_required: "teléfono requerido" address_required: "dirección requerida" + gender_required: "gender required" + birthday_required: "date of birth required" tracking_id: "ID de seguimiento" facebook_app_id: "ID de aplicación de Facebook" twitter_analytics: "Cuenta analítica de Twitter" @@ -1839,6 +1841,12 @@ es-MX: address: "Dirección" address_required_info_html: "Puede definir si la dirección debe ser necesaria para registrar un nuevo usuario en Fab-manager.
Tenga en cuenta que, dependiendo de su país, la normativa puede exigir direcciones para que los recibos sean válidos." address_is_required: "Dirección requerida" + gender: "Gender" + gender_is_required: "Gender required" + gender_required_info: "You can define if the gender should be required to register a new user on Fab-manager." + birthday: "Date of birth" + birthday_is_required: "Date of birth required" + birthday_required_info: "You can define if the date of birth number should be required to register a new user on Fab-manager." external_id: "Identificador externo" external_id_info_html: "Puede establecer un identificador externo para sus usuarios, que no podrá ser modificado por el propio usuario." enable_external_id: "Activar el ID externo" diff --git a/config/locales/app.admin.es.yml b/config/locales/app.admin.es.yml index c0367f6fa..d0cd55b50 100644 --- a/config/locales/app.admin.es.yml +++ b/config/locales/app.admin.es.yml @@ -1787,6 +1787,8 @@ es: fab_analytics: "Fab Analytics" phone_required: "teléfono requerido" address_required: "dirección requerida" + gender_required: "gender required" + birthday_required: "date of birth required" tracking_id: "ID de seguimiento" facebook_app_id: "ID de aplicación de Facebook" twitter_analytics: "Cuenta analítica de Twitter" @@ -1839,6 +1841,12 @@ es: address: "Dirección" address_required_info_html: "Puede definir si la dirección debe ser necesaria para registrar un nuevo usuario en Fab-manager.
Tenga en cuenta que, dependiendo de su país, la normativa puede exigir direcciones para que las facturas sean válidas." address_is_required: "Dirección requerida" + gender: "Gender" + gender_is_required: "Gender required" + gender_required_info: "You can define if the gender should be required to register a new user on Fab-manager." + birthday: "Date of birth" + birthday_is_required: "Date of birth required" + birthday_required_info: "You can define if the date of birth number should be required to register a new user on Fab-manager." external_id: "Identificador externo" external_id_info_html: "Puede establecer un identificador externo para sus usuarios, que no podrá ser modificado por el propio usuario." enable_external_id: "Activar el ID externo" diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml index 1bf7f9d40..e0a1f6f4e 100644 --- a/config/locales/app.admin.fr.yml +++ b/config/locales/app.admin.fr.yml @@ -1383,7 +1383,7 @@ fr: to_credit: 'Créditer' cannot_credit_own_wallet: "Vous ne pouvez pas créditer votre propre porte-monnaie. Veuillez demander à un autre gestionnaire ou à un administrateur de créditer votre porte-monnaie." cannot_extend_own_subscription: "Vous ne pouvez pas prolonger votre propre abonnement. Veuillez demander à un autre gestionnaire ou à un administrateur de prolonger votre abonnement." - update_success: "Le profile du membre a bien été mis à jour" + update_success: "Le profil du membre a bien été mis à jour" my_documents: "Mes documents" save: "Enregistrer" confirm: "Valider" @@ -1787,6 +1787,8 @@ fr: fab_analytics: "Fab Analytics" phone_required: "téléphone requis" address_required: "adresse requise" + gender_required: "genre requis" + birthday_required: "date de naissance requise" tracking_id: "l'ID de suivi" facebook_app_id: "l'App ID Facebook" twitter_analytics: "compte Twitter analytics" @@ -1839,6 +1841,12 @@ fr: address: "Adresse" address_required_info_html: "Vous pouvez définir si l'adresse doit être requise, lors de l'enregistrement d'un nouvel utilisateur sur Fab-manager.
Veuillez noter que, selon votre pays, la réglementation peut exiger des adresses pour que les factures soient valides." address_is_required: "Adresse requise" + gender: "Genre" + gender_is_required: "Genre requis" + gender_required_info: "Vous pouvez définir si le genre doit être requis, lors de l'enregistrement d'un nouvel utilisateur sur Fab-manager." + birthday: "Date de naissance" + birthday_is_required: "Date de naissance requise" + birthday_required_info: "Vous pouvez définir si la date de naissance doit être requis, lors de l'enregistrement d'un nouvel utilisateur sur Fab-manager." external_id: "Identifiant externe" external_id_info_html: "Vous pouvez configurer un identifiant externe pour vos utilisateurs, qui ne pourra pas être modifié par l'utilisateur lui-même." enable_external_id: "Activer l'identifiant externe" diff --git a/config/locales/app.admin.it.yml b/config/locales/app.admin.it.yml index 51406d6a2..76b9d7feb 100644 --- a/config/locales/app.admin.it.yml +++ b/config/locales/app.admin.it.yml @@ -1787,6 +1787,8 @@ it: fab_analytics: "Fab Analytics" phone_required: "telefono richiesto" address_required: "indirizzo richiesto" + gender_required: "gender required" + birthday_required: "date of birth required" tracking_id: "tracking ID" facebook_app_id: "Facebook App ID" twitter_analytics: "Account analytics Twitter" @@ -1839,6 +1841,12 @@ it: address: "Indirizzo" address_required_info_html: "È possibile definire se l'indirizzo deve essere richiesto per registrare un nuovo utente su Fab-manager.
Si prega di notare che, a seconda del tuo paese, la normativa potrebbe richiedere indirizzi per la validità delle fatture." address_is_required: "L'indirizzo è obbligatorio" + gender: "Gender" + gender_is_required: "Gender required" + gender_required_info: "You can define if the gender should be required to register a new user on Fab-manager." + birthday: "Date of birth" + birthday_is_required: "Date of birth required" + birthday_required_info: "You can define if the date of birth number should be required to register a new user on Fab-manager." external_id: "Identificatore esterno" external_id_info_html: "È possibile impostare un identificatore esterno per i propri utenti, che non può essere modificato dall'utente stesso." enable_external_id: "Abilita l'ID esterno" diff --git a/config/locales/app.admin.no.yml b/config/locales/app.admin.no.yml index 126778db2..dab311ed5 100644 --- a/config/locales/app.admin.no.yml +++ b/config/locales/app.admin.no.yml @@ -1787,6 +1787,8 @@ fab_analytics: "Fab Analytics" phone_required: "phone required" address_required: "address required" + gender_required: "gender required" + birthday_required: "date of birth required" tracking_id: "tracking ID" facebook_app_id: "Facebook App ID" twitter_analytics: "Twitter analytics account" @@ -1839,6 +1841,12 @@ address: "Address" address_required_info_html: "You can define if the address should be required to register a new user on Fab-manager.
Please note that, depending on your country, the regulations may requires addresses for the invoices to be valid." address_is_required: "Adresse er påkrevd" + gender: "Gender" + gender_is_required: "Gender required" + gender_required_info: "You can define if the gender should be required to register a new user on Fab-manager." + birthday: "Date of birth" + birthday_is_required: "Date of birth required" + birthday_required_info: "You can define if the date of birth number should be required to register a new user on Fab-manager." external_id: "External identifier" external_id_info_html: "You can set up an external identifier for your users, which cannot be modified by the user himself." enable_external_id: "Enable the external ID" diff --git a/config/locales/app.admin.pt.yml b/config/locales/app.admin.pt.yml index f14aa3805..390135ae7 100644 --- a/config/locales/app.admin.pt.yml +++ b/config/locales/app.admin.pt.yml @@ -1787,6 +1787,8 @@ pt: fab_analytics: "Fab Analytics" phone_required: "telefone é obrigatório" address_required: "o endereço é obrigatório" + gender_required: "gender required" + birthday_required: "date of birth required" tracking_id: "tracking ID" facebook_app_id: "ID de Utilizador do Facebook" twitter_analytics: "Analisador de conta Twitter" @@ -1839,6 +1841,12 @@ pt: address: "Endereço" address_required_info_html: "Você pode definir se o endereço deve ser necessário para registrar um novo usuário no Fab-manager.
Por favor, note que, dependendo do seu país, as regulamentações podem exigir endereços para que as faturas sejam válidas." address_is_required: "Endereço é obrigatório" + gender: "Gender" + gender_is_required: "Gender required" + gender_required_info: "You can define if the gender should be required to register a new user on Fab-manager." + birthday: "Date of birth" + birthday_is_required: "Date of birth required" + birthday_required_info: "You can define if the date of birth number should be required to register a new user on Fab-manager." external_id: "External identifier" external_id_info_html: "You can set up an external identifier for your users, which cannot be modified by the user himself." enable_external_id: "Enable the external ID" diff --git a/config/locales/app.admin.sv.yml b/config/locales/app.admin.sv.yml index 2c2af9633..9e906aedc 100644 --- a/config/locales/app.admin.sv.yml +++ b/config/locales/app.admin.sv.yml @@ -1787,6 +1787,8 @@ sv: fab_analytics: "Fab Analys" phone_required: "telefon krävs" address_required: "adress krävs" + gender_required: "gender required" + birthday_required: "date of birth required" tracking_id: "spårnings-ID" facebook_app_id: "ID för Facebook-app" twitter_analytics: "Twitter analytics-konto" @@ -1839,6 +1841,12 @@ sv: address: "Adress" address_required_info_html: "Du kan definiera om adress krävs för att registrera en ny användare.
OBS: beroende på landstillhörighet kan lagen kräva att giltiga fakturor har en faktureringsadress." address_is_required: "Adress måste fyllas i" + gender: "Gender" + gender_is_required: "Gender required" + gender_required_info: "You can define if the gender should be required to register a new user on Fab-manager." + birthday: "Date of birth" + birthday_is_required: "Date of birth required" + birthday_required_info: "You can define if the date of birth number should be required to register a new user on Fab-manager." external_id: "Extern identifierare" external_id_info_html: "Du kan ställa in en extern identifierare för dina användare, som inte kan ändras av användaren själv." enable_external_id: "Aktivera externt ID" diff --git a/config/locales/app.admin.zu.yml b/config/locales/app.admin.zu.yml index 771983579..54b7b2132 100644 --- a/config/locales/app.admin.zu.yml +++ b/config/locales/app.admin.zu.yml @@ -1787,6 +1787,8 @@ zu: fab_analytics: "crwdns26580:0crwdne26580:0" phone_required: "crwdns26582:0crwdne26582:0" address_required: "crwdns26584:0crwdne26584:0" + gender_required: "crwdns38196:0crwdne38196:0" + birthday_required: "crwdns38198:0crwdne38198:0" tracking_id: "crwdns26586:0crwdne26586:0" facebook_app_id: "crwdns26588:0crwdne26588:0" twitter_analytics: "crwdns26590:0crwdne26590:0" @@ -1839,6 +1841,12 @@ zu: address: "crwdns26676:0crwdne26676:0" address_required_info_html: "crwdns26678:0crwdne26678:0" address_is_required: "crwdns26680:0crwdne26680:0" + gender: "crwdns38184:0crwdne38184:0" + gender_is_required: "crwdns38186:0crwdne38186:0" + gender_required_info: "crwdns38188:0crwdne38188:0" + birthday: "crwdns38190:0crwdne38190:0" + birthday_is_required: "crwdns38192:0crwdne38192:0" + birthday_required_info: "crwdns38194:0crwdne38194:0" external_id: "crwdns32051:0crwdne32051:0" external_id_info_html: "crwdns36043:0crwdne36043:0" enable_external_id: "crwdns32055:0crwdne32055:0" From 407c0173aba63732038fc0d5d1f53a1555f4adb1 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Wed, 27 Mar 2024 14:41:30 +0100 Subject: [PATCH 07/10] (feat) add sp certificate for saml provider --- CHANGELOG.md | 1 + .../api/auth_providers_controller.rb | 3 +- .../authentication-provider/provider-form.tsx | 2 +- .../authentication-provider/saml-form.tsx | 30 ++++++++++++++----- .../models/authentication-provider.ts | 4 +++ .../api/auth_providers/show.json.jbuilder | 6 ++-- .../auth_provider/provider.json.jbuilder | 3 +- config/initializers/devise.rb | 6 ++++ config/locales/app.admin.de.yml | 4 +++ config/locales/app.admin.en.yml | 4 +++ config/locales/app.admin.es-MX.yml | 4 +++ config/locales/app.admin.es.yml | 4 +++ config/locales/app.admin.fr.yml | 4 +++ config/locales/app.admin.it.yml | 4 +++ config/locales/app.admin.no.yml | 4 +++ config/locales/app.admin.pt.yml | 4 +++ config/locales/app.admin.sv.yml | 4 +++ config/locales/app.admin.zu.yml | 4 +++ ...614_add_sp_certificate_to_saml_provider.rb | 10 +++++++ db/structure.sql | 9 ++++-- 20 files changed, 100 insertions(+), 14 deletions(-) create mode 100644 db/migrate/20240327095614_add_sp_certificate_to_saml_provider.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index d08c05844..79d13df4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - improvement: add loader for create/delete availability slot - improvement: allow admin configure memeber's profile gender/birthday as required +- improvement: add sp certificate for saml provider - Fix a bug: unable to update a space with a deleted machine - Fix a bug: unable to get invoice payment details if the account code is same for card/transfer payment method - updates translations diff --git a/app/controllers/api/auth_providers_controller.rb b/app/controllers/api/auth_providers_controller.rb index 642236355..907e41e8b 100644 --- a/app/controllers/api/auth_providers_controller.rb +++ b/app/controllers/api/auth_providers_controller.rb @@ -108,7 +108,8 @@ class API::AuthProvidersController < API::APIController elsif params['auth_provider']['providable_type'] == SamlProvider.name params.require(:auth_provider) .permit(:id, :name, :providable_type, - providable_attributes: [:id, :sp_entity_id, :idp_sso_service_url, :profile_url, :idp_cert_fingerprint, :idp_cert, :idp_slo_service_url], + providable_attributes: %i[id sp_entity_id idp_sso_service_url profile_url idp_cert_fingerprint idp_cert + idp_slo_service_url authn_requests_signed want_assertions_signed sp_certificate sp_private_key], auth_provider_mappings_attributes: [:id, :local_model, :local_field, :api_field, :api_endpoint, :api_data_type, :_destroy, { transformation: [:type, :format, :true_value, :false_value, { mapping: %i[from to] }] }]) diff --git a/app/frontend/src/javascript/components/authentication-provider/provider-form.tsx b/app/frontend/src/javascript/components/authentication-provider/provider-form.tsx index 5eb8227b6..8ae761d6f 100644 --- a/app/frontend/src/javascript/components/authentication-provider/provider-form.tsx +++ b/app/frontend/src/javascript/components/authentication-provider/provider-form.tsx @@ -118,7 +118,7 @@ export const ProviderForm: React.FC = ({ action, provider, on currentFormValues={output.providable_attributes as OpenIdConnectProvider} formState={formState} setValue={setValue} />} - {providableType === 'SamlProvider' && } + {providableType === 'SamlProvider' && } {providableType && providableType !== 'DatabaseProvider' && { +interface SamlFormProps { register: UseFormRegister, + control: Control, formState: FormState, strategyName?: string, } @@ -14,7 +15,7 @@ interface SamlFormProps { /** * Partial form to fill the OAuth2 settings for a new/existing authentication provider. */ -export const SamlForm = ({ register, strategyName, formState }: SamlFormProps) => { +export const SamlForm = ({ register, strategyName, formState, control }: SamlFormProps) => { const { t } = useTranslation('admin'); /** @@ -39,7 +40,7 @@ export const SamlForm = ({ register, strategyN placeholder="https://sso.example.net..." label={t('app.admin.authentication.saml_form.idp_sso_service_url')} tooltip={t('app.admin.authentication.saml_form.idp_sso_service_url_help')} - rules={{ required: true, pattern: ValidationLib.urlRegex }} + rules={{ required: true }} formState={formState} /> ({ register, strategyN placeholder="https://exemple.net/user..." label={t('app.admin.authentication.saml_form.profile_edition_url')} tooltip={t('app.admin.authentication.saml_form.profile_edition_url_help')} - rules={{ required: true, pattern: ValidationLib.urlRegex }} + rules={{ required: true }} formState={formState} /> + + + +
); diff --git a/app/frontend/src/javascript/models/authentication-provider.ts b/app/frontend/src/javascript/models/authentication-provider.ts index f56c94bf8..3e406185c 100644 --- a/app/frontend/src/javascript/models/authentication-provider.ts +++ b/app/frontend/src/javascript/models/authentication-provider.ts @@ -73,6 +73,10 @@ export interface SamlProvider { idp_cert: string, profile_url: string, idp_slo_service_url: string, + sp_certificate: string, + sp_private_key: string, + authn_requests_signed: boolean, + want_assertions_signed: boolean } export interface MappingFields { diff --git a/app/views/api/auth_providers/show.json.jbuilder b/app/views/api/auth_providers/show.json.jbuilder index 18a2ab3e0..9a5f48295 100644 --- a/app/views/api/auth_providers/show.json.jbuilder +++ b/app/views/api/auth_providers/show.json.jbuilder @@ -6,7 +6,8 @@ json.partial! 'api/auth_providers/auth_provider', auth_provider: @provider if @provider.providable_type == OAuth2Provider.name json.providable_attributes do - json.extract! @provider.providable, :id, :base_url, :token_endpoint, :authorization_endpoint, :profile_url, :client_id, :client_secret, :scopes + json.extract! @provider.providable, :id, :base_url, :token_endpoint, :authorization_endpoint, :profile_url, :client_id, :client_secret, + :scopes end end @@ -22,6 +23,7 @@ end if @provider.providable_type == SamlProvider.name json.providable_attributes do - json.extract! @provider.providable, :id, :sp_entity_id, :idp_sso_service_url, :profile_url, :idp_cert_fingerprint, :idp_cert, :idp_slo_service_url + json.extract! @provider.providable, :id, :sp_entity_id, :idp_sso_service_url, :profile_url, :idp_cert_fingerprint, :idp_cert, :idp_slo_service_url, + :authn_requests_signed, :want_assertions_signed, :sp_certificate, :sp_private_key end end diff --git a/app/views/auth_provider/provider.json.jbuilder b/app/views/auth_provider/provider.json.jbuilder index dda5a9a72..149f91f89 100644 --- a/app/views/auth_provider/provider.json.jbuilder +++ b/app/views/auth_provider/provider.json.jbuilder @@ -23,6 +23,7 @@ end if provider.providable_type == 'SamlProvider' json.providable_attributes do - json.extract! provider.providable, :id, :sp_entity_id, :idp_sso_service_url, :profile_url, :idp_cert_fingerprint, :idp_cert, :idp_slo_service_url + json.extract! provider.providable, :id, :sp_entity_id, :idp_sso_service_url, :profile_url, :idp_cert_fingerprint, :idp_cert, :idp_slo_service_url, + :authn_requests_signed, :want_assertions_signed, :sp_certificate, :sp_private_key end end diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index 716ff45ca..4b334e06c 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -253,6 +253,12 @@ Devise.setup do |config| idp_slo_service_url: active_provider.providable.idp_slo_service_url, idp_cert: active_provider.providable.idp_cert, idp_cert_fingerprint: active_provider.providable.idp_cert_fingerprint, + certificate: active_provider.providable.sp_certificate, + private_key: active_provider.providable.sp_private_key, + security: OneLogin::RubySaml::Settings::DEFAULTS[:security].merge({ + authn_requests_signed: active_provider.providable.authn_requests_signed, + want_assertions_signed: active_provider.providable.want_assertions_signed + }), strategy_class: OmniAuth::Strategies::SsoSamlProvider end end diff --git a/config/locales/app.admin.de.yml b/config/locales/app.admin.de.yml index 4dbe34465..1ff86dfe4 100644 --- a/config/locales/app.admin.de.yml +++ b/config/locales/app.admin.de.yml @@ -1571,6 +1571,10 @@ de: profile_edition_url_help: "The URL of the page where the user can edit his profile." idp_slo_service_url: "Single logout request URL" idp_slo_service_url_help: "The URL to which the single logout request and response should be sent. This would be on the identity provider." + authn_requests_signed: "Authentification requests signed" + want_assertions_signed: "Want assertions signed" + sp_certificate: "Service provider certificate" + sp_private_key: "Service provider private key" provider_form: name: "Name" authentication_type: "Authentifizierungsart" diff --git a/config/locales/app.admin.en.yml b/config/locales/app.admin.en.yml index f9b091480..638870a94 100644 --- a/config/locales/app.admin.en.yml +++ b/config/locales/app.admin.en.yml @@ -1571,6 +1571,10 @@ en: profile_edition_url_help: "The URL of the page where the user can edit his profile." idp_slo_service_url: "Single logout request URL" idp_slo_service_url_help: "The URL to which the single logout request and response should be sent. This would be on the identity provider." + authn_requests_signed: "Authentification requests signed" + want_assertions_signed: "Want assertions signed" + sp_certificate: "Service provider certificate" + sp_private_key: "Service provider private key" provider_form: name: "Name" authentication_type: "Authentication type" diff --git a/config/locales/app.admin.es-MX.yml b/config/locales/app.admin.es-MX.yml index 2e772a303..c65a77ac8 100644 --- a/config/locales/app.admin.es-MX.yml +++ b/config/locales/app.admin.es-MX.yml @@ -1571,6 +1571,10 @@ es-MX: profile_edition_url_help: "The URL of the page where the user can edit his profile." idp_slo_service_url: "Single logout request URL" idp_slo_service_url_help: "The URL to which the single logout request and response should be sent. This would be on the identity provider." + authn_requests_signed: "Authentification requests signed" + want_assertions_signed: "Want assertions signed" + sp_certificate: "Service provider certificate" + sp_private_key: "Service provider private key" provider_form: name: "Nombre" authentication_type: "Tipo de autenticación" diff --git a/config/locales/app.admin.es.yml b/config/locales/app.admin.es.yml index d0cd55b50..e92699ac9 100644 --- a/config/locales/app.admin.es.yml +++ b/config/locales/app.admin.es.yml @@ -1571,6 +1571,10 @@ es: profile_edition_url_help: "The URL of the page where the user can edit his profile." idp_slo_service_url: "Single logout request URL" idp_slo_service_url_help: "The URL to which the single logout request and response should be sent. This would be on the identity provider." + authn_requests_signed: "Authentification requests signed" + want_assertions_signed: "Want assertions signed" + sp_certificate: "Service provider certificate" + sp_private_key: "Service provider private key" provider_form: name: "Nombre" authentication_type: "Tipo de autenticación" diff --git a/config/locales/app.admin.fr.yml b/config/locales/app.admin.fr.yml index e0a1f6f4e..a702c40f9 100644 --- a/config/locales/app.admin.fr.yml +++ b/config/locales/app.admin.fr.yml @@ -1571,6 +1571,10 @@ fr: profile_edition_url_help: "L'URL de la page où l'utilisateur peut modifier son profil." idp_slo_service_url: "URL de demande de déconnexion" idp_slo_service_url_help: "L'URL à laquelle la requête d'authentification doit être envoyée. Cela serait sur le fournisseur d'identité." + authn_requests_signed: "Demandes d'authentification signées" + want_assertions_signed: "Exiger des Assertions signées" + sp_certificate: "Certificat du SP" + sp_private_key: "Clé privée du SP" provider_form: name: "Nom" authentication_type: "Type d'authentification" diff --git a/config/locales/app.admin.it.yml b/config/locales/app.admin.it.yml index 76b9d7feb..3ed8cb14b 100644 --- a/config/locales/app.admin.it.yml +++ b/config/locales/app.admin.it.yml @@ -1571,6 +1571,10 @@ it: profile_edition_url_help: "The URL of the page where the user can edit his profile." idp_slo_service_url: "Single logout request URL" idp_slo_service_url_help: "The URL to which the single logout request and response should be sent. This would be on the identity provider." + authn_requests_signed: "Authentification requests signed" + want_assertions_signed: "Want assertions signed" + sp_certificate: "Service provider certificate" + sp_private_key: "Service provider private key" provider_form: name: "Nome" authentication_type: "Tipo di autenticazione" diff --git a/config/locales/app.admin.no.yml b/config/locales/app.admin.no.yml index dab311ed5..82b568749 100644 --- a/config/locales/app.admin.no.yml +++ b/config/locales/app.admin.no.yml @@ -1571,6 +1571,10 @@ profile_edition_url_help: "The URL of the page where the user can edit his profile." idp_slo_service_url: "Single logout request URL" idp_slo_service_url_help: "The URL to which the single logout request and response should be sent. This would be on the identity provider." + authn_requests_signed: "Authentification requests signed" + want_assertions_signed: "Want assertions signed" + sp_certificate: "Service provider certificate" + sp_private_key: "Service provider private key" provider_form: name: "Name" authentication_type: "Authentication type" diff --git a/config/locales/app.admin.pt.yml b/config/locales/app.admin.pt.yml index 390135ae7..815fa3f8c 100644 --- a/config/locales/app.admin.pt.yml +++ b/config/locales/app.admin.pt.yml @@ -1571,6 +1571,10 @@ pt: profile_edition_url_help: "The URL of the page where the user can edit his profile." idp_slo_service_url: "Single logout request URL" idp_slo_service_url_help: "The URL to which the single logout request and response should be sent. This would be on the identity provider." + authn_requests_signed: "Authentification requests signed" + want_assertions_signed: "Want assertions signed" + sp_certificate: "Service provider certificate" + sp_private_key: "Service provider private key" provider_form: name: "Nome" authentication_type: "Tipo de autenticação" diff --git a/config/locales/app.admin.sv.yml b/config/locales/app.admin.sv.yml index 9e906aedc..5387a3d0d 100644 --- a/config/locales/app.admin.sv.yml +++ b/config/locales/app.admin.sv.yml @@ -1571,6 +1571,10 @@ sv: profile_edition_url_help: "URL till sidan där användaren kan redigera sin profil." idp_slo_service_url: "Single logout request URL" idp_slo_service_url_help: "The URL to which the single logout request and response should be sent. This would be on the identity provider." + authn_requests_signed: "Authentification requests signed" + want_assertions_signed: "Want assertions signed" + sp_certificate: "Service provider certificate" + sp_private_key: "Service provider private key" provider_form: name: "Namn" authentication_type: "Autentiseringstyp" diff --git a/config/locales/app.admin.zu.yml b/config/locales/app.admin.zu.yml index 54b7b2132..bd8568d13 100644 --- a/config/locales/app.admin.zu.yml +++ b/config/locales/app.admin.zu.yml @@ -1571,6 +1571,10 @@ zu: profile_edition_url_help: "crwdns38162:0crwdne38162:0" idp_slo_service_url: "crwdns38176:0crwdne38176:0" idp_slo_service_url_help: "crwdns38178:0crwdne38178:0" + authn_requests_signed: "crwdns38200:0crwdne38200:0" + want_assertions_signed: "crwdns38202:0crwdne38202:0" + sp_certificate: "crwdns38204:0crwdne38204:0" + sp_private_key: "crwdns38206:0crwdne38206:0" provider_form: name: "crwdns26204:0crwdne26204:0" authentication_type: "crwdns26206:0crwdne26206:0" diff --git a/db/migrate/20240327095614_add_sp_certificate_to_saml_provider.rb b/db/migrate/20240327095614_add_sp_certificate_to_saml_provider.rb new file mode 100644 index 000000000..a77330de5 --- /dev/null +++ b/db/migrate/20240327095614_add_sp_certificate_to_saml_provider.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddSpCertificateToSamlProvider < ActiveRecord::Migration[7.0] + def change + add_column :saml_providers, :sp_certificate, :string + add_column :saml_providers, :sp_private_key, :string + add_column :saml_providers, :authn_requests_signed, :boolean, default: false + add_column :saml_providers, :want_assertions_signed, :boolean, default: false + end +end diff --git a/db/structure.sql b/db/structure.sql index edf633649..0caddd176 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -3279,7 +3279,11 @@ CREATE TABLE public.saml_providers ( profile_url character varying, idp_cert character varying, idp_cert_fingerprint character varying, - idp_slo_service_url character varying + idp_slo_service_url character varying, + sp_certificate character varying, + sp_private_key character varying, + authn_requests_signed boolean DEFAULT false, + want_assertions_signed boolean DEFAULT false ); @@ -9326,6 +9330,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20240116163703'), ('20240126145351'), ('20240126192110'), -('20240220140225'); +('20240220140225'), +('20240327095614'); From 61dfa141cc69325b2e0d0e025579948f69aa8570 Mon Sep 17 00:00:00 2001 From: Du Peng Date: Fri, 29 Mar 2024 18:28:42 +0100 Subject: [PATCH 08/10] (bug) unable to show machine/training picture --- CHANGELOG.md | 1 + .../src/javascript/components/machines/machine-card.tsx | 3 ++- app/frontend/templates/home/projects.html | 2 +- app/frontend/templates/spaces/index.html | 2 +- app/frontend/templates/trainings/index.html | 2 +- 5 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79d13df4e..e7087140b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - improvement: add sp certificate for saml provider - Fix a bug: unable to update a space with a deleted machine - Fix a bug: unable to get invoice payment details if the account code is same for card/transfer payment method +- Fix a bug: unable to show machine/training picture - updates translations ## v6.3.16 2024 March 11 diff --git a/app/frontend/src/javascript/components/machines/machine-card.tsx b/app/frontend/src/javascript/components/machines/machine-card.tsx index 7c0a2770a..108190c4b 100644 --- a/app/frontend/src/javascript/components/machines/machine-card.tsx +++ b/app/frontend/src/javascript/components/machines/machine-card.tsx @@ -49,9 +49,10 @@ const MachineCard: React.FC = ({ user, machine, onShowMachine, if (!machine.machine_image_attributes?.attachment_url) { return
; } + console.log(machine.machine_image_attributes.attachment_url); return ( -
+
); }; diff --git a/app/frontend/templates/home/projects.html b/app/frontend/templates/home/projects.html index 1dce03281..e215c7377 100644 --- a/app/frontend/templates/home/projects.html +++ b/app/frontend/templates/home/projects.html @@ -2,7 +2,7 @@

{{ 'app.public.home.latest_documented_projects' }}

- + diff --git a/app/frontend/templates/spaces/index.html b/app/frontend/templates/spaces/index.html index 79c4414c1..09c5dec9f 100644 --- a/app/frontend/templates/spaces/index.html +++ b/app/frontend/templates/spaces/index.html @@ -52,7 +52,7 @@
-
+

{{space.name}}

diff --git a/app/frontend/templates/trainings/index.html b/app/frontend/templates/trainings/index.html index 06203604c..c370ac126 100644 --- a/app/frontend/templates/trainings/index.html +++ b/app/frontend/templates/trainings/index.html @@ -25,7 +25,7 @@
-
+

{{training.name}}

From b4c535149e87063fc673bbd5cc6c29f30279f98e Mon Sep 17 00:00:00 2001 From: Du Peng Date: Mon, 8 Apr 2024 09:26:17 +0200 Subject: [PATCH 09/10] (fix) remove unused table in structure.sal --- db/structure.sql | 78 ++++++------------------------------------------ 1 file changed, 9 insertions(+), 69 deletions(-) diff --git a/db/structure.sql b/db/structure.sql index 0caddd176..d29e99787 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -2242,41 +2242,6 @@ CREATE SEQUENCE public.payment_gateway_objects_id_seq ALTER SEQUENCE public.payment_gateway_objects_id_seq OWNED BY public.payment_gateway_objects.id; --- --- Name: payment_infos; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.payment_infos ( - id bigint NOT NULL, - data jsonb, - state character varying, - payment_for character varying, - service character varying, - statistic_profile_id bigint, - created_at timestamp(6) without time zone NOT NULL, - updated_at timestamp(6) without time zone NOT NULL -); - - --- --- Name: payment_infos_id_seq; Type: SEQUENCE; Schema: public; Owner: - --- - -CREATE SEQUENCE public.payment_infos_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - --- --- Name: payment_infos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: - --- - -ALTER SEQUENCE public.payment_infos_id_seq OWNED BY public.payment_infos.id; - - -- -- Name: payment_schedule_items; Type: TABLE; Schema: public; Owner: - -- @@ -4398,8 +4363,8 @@ CREATE TABLE public.users ( is_allow_newsletter boolean, current_sign_in_ip inet, last_sign_in_ip inet, - validated_at timestamp without time zone, mapped_from_sso character varying, + validated_at timestamp without time zone, supporting_documents_reminder_sent_at timestamp(6) without time zone ); @@ -4952,13 +4917,6 @@ ALTER TABLE ONLY public.organizations ALTER COLUMN id SET DEFAULT nextval('publi ALTER TABLE ONLY public.payment_gateway_objects ALTER COLUMN id SET DEFAULT nextval('public.payment_gateway_objects_id_seq'::regclass); --- --- Name: payment_infos id; Type: DEFAULT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.payment_infos ALTER COLUMN id SET DEFAULT nextval('public.payment_infos_id_seq'::regclass); - - -- -- Name: payment_schedule_items id; Type: DEFAULT; Schema: public; Owner: - -- @@ -5895,14 +5853,6 @@ ALTER TABLE ONLY public.payment_gateway_objects ADD CONSTRAINT payment_gateway_objects_pkey PRIMARY KEY (id); --- --- Name: payment_infos payment_infos_pkey; Type: CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.payment_infos - ADD CONSTRAINT payment_infos_pkey PRIMARY KEY (id); - - -- -- Name: payment_schedule_items payment_schedule_items_pkey; Type: CONSTRAINT; Schema: public; Owner: - -- @@ -7116,13 +7066,6 @@ CREATE INDEX index_payment_gateway_objects_on_item_type_and_item_id ON public.pa CREATE INDEX index_payment_gateway_objects_on_payment_gateway_object_id ON public.payment_gateway_objects USING btree (payment_gateway_object_id); --- --- Name: index_payment_infos_on_statistic_profile_id; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX index_payment_infos_on_statistic_profile_id ON public.payment_infos USING btree (statistic_profile_id); - - -- -- Name: index_payment_schedule_items_on_invoice_id; Type: INDEX; Schema: public; Owner: - -- @@ -7914,6 +7857,14 @@ CREATE INDEX proof_of_identity_type_id_and_proof_of_identity_refusal_id ON publi CREATE UNIQUE INDEX unique_not_null_external_id ON public.invoicing_profiles USING btree (external_id) WHERE (external_id IS NOT NULL); +-- +-- Name: accounting_periods accounting_periods_del_protect; Type: RULE; Schema: public; Owner: - +-- + +CREATE RULE accounting_periods_del_protect AS + ON DELETE TO public.accounting_periods DO INSTEAD NOTHING; + + -- -- Name: accounting_periods accounting_periods_upd_protect; Type: RULE; Schema: public; Owner: - -- @@ -7947,14 +7898,6 @@ ALTER TABLE ONLY public.payment_schedules ADD CONSTRAINT fk_rails_00308dc223 FOREIGN KEY (wallet_transaction_id) REFERENCES public.wallet_transactions(id); --- --- Name: payment_infos fk_rails_0308366a58; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.payment_infos - ADD CONSTRAINT fk_rails_0308366a58 FOREIGN KEY (statistic_profile_id) REFERENCES public.statistic_profiles(id); - - -- -- Name: cart_item_event_reservation_booking_users fk_rails_0964335a37; Type: FK CONSTRAINT; Schema: public; Owner: - -- @@ -9301,10 +9244,8 @@ INSERT INTO "schema_migrations" (version) VALUES ('20230328094808'), ('20230328094809'), ('20230331132506'), -('20230509121907'), ('20230509161557'), ('20230510141305'), -('20230511080650'), ('20230511081018'), ('20230524080448'), ('20230524083558'), @@ -9320,7 +9261,6 @@ INSERT INTO "schema_migrations" (version) VALUES ('20230720085857'), ('20230728072726'), ('20230728090257'), -('20230825101952'), ('20230828073428'), ('20230831103208'), ('20230901090637'), From 930670312d443bcd0461ce3b4f130cb370462b9d Mon Sep 17 00:00:00 2001 From: Du Peng Date: Mon, 8 Apr 2024 09:36:33 +0200 Subject: [PATCH 10/10] Version 6.3.17 --- CHANGELOG.md | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7087140b..1c09fadb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Next release +## v6.3.17 2024 Avril 8 + - improvement: add loader for create/delete availability slot - improvement: allow admin configure memeber's profile gender/birthday as required - improvement: add sp certificate for saml provider diff --git a/package.json b/package.json index 8b7ea0300..6794e6fac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fab-manager", - "version": "6.3.16", + "version": "6.3.17", "description": "Fab-manager is the FabLab management solution. It provides a comprehensive, web-based, open-source tool to simplify your administrative tasks and your marker's projects.", "keywords": [ "fablab",