1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-19 13:54:25 +01:00

use SHA-3 (256 bits) to compute checksums + simplify accounting period integrity check UI

This commit is contained in:
Sylvain 2019-03-21 17:15:41 +01:00
parent 4a73798d99
commit fd55c8d315
9 changed files with 141 additions and 111 deletions

View File

@ -151,3 +151,5 @@ gem 'rack-protection', '1.5.5'
# get free disk space
gem 'sys-filesystem'
gem 'sha3'

View File

@ -403,6 +403,7 @@ GEM
seed_dump (3.2.2)
activerecord (~> 4)
activesupport (~> 4)
sha3 (1.0.1)
sidekiq (3.3.4)
celluloid (>= 0.16.0)
connection_pool (>= 2.1.1)
@ -577,6 +578,7 @@ DEPENDENCIES
sass-rails (= 5.0.1)
sdoc (~> 0.4.0)
seed_dump
sha3
sidekiq
sidekiq-cron
sinatra

View File

@ -5,14 +5,7 @@
<li><span class="period-info-title" translate>{{ 'invoices.perpetual_total' }}</span> : <span>{{period.perpetual_total | currency}}</span></li>
<li>
<span class="period-info-title" translate>{{ 'invoices.integrity' }}</span> :
<span>
<div class="input-group">
<span class="input-group-addon">
<i class="fa fa-link chained" ng-show="period.chained_footprint"></i>
<i class="fa fa-chain-broken broken" ng-hide="period.chained_footprint"></i>
</span>
<input type="text" class="form-control" ng-value="period.footprint" readonly="readonly" />
</div>
</span>
<i class="fa fa-link chained" ng-show="period.chained_footprint"></i>
<i class="fa fa-chain-broken broken" ng-hide="period.chained_footprint"></i>
</li>
</ul>

View File

@ -44,14 +44,14 @@ ActiveRecord::Schema.define(version: 20190320091148) do
end
create_table "addresses", force: :cascade do |t|
t.string "address", limit: 255
t.string "street_number", limit: 255
t.string "route", limit: 255
t.string "locality", limit: 255
t.string "country", limit: 255
t.string "postal_code", limit: 255
t.string "address"
t.string "street_number"
t.string "route"
t.string "locality"
t.string "country"
t.string "postal_code"
t.integer "placeable_id"
t.string "placeable_type", limit: 255
t.string "placeable_type"
t.datetime "created_at"
t.datetime "updated_at"
end
@ -67,9 +67,9 @@ ActiveRecord::Schema.define(version: 20190320091148) do
create_table "assets", force: :cascade do |t|
t.integer "viewable_id"
t.string "viewable_type", limit: 255
t.string "attachment", limit: 255
t.string "type", limit: 255
t.string "viewable_type"
t.string "attachment"
t.string "type"
t.datetime "created_at"
t.datetime "updated_at"
end
@ -86,12 +86,12 @@ ActiveRecord::Schema.define(version: 20190320091148) do
create_table "availabilities", force: :cascade do |t|
t.datetime "start_at"
t.datetime "end_at"
t.string "available_type", limit: 255
t.string "available_type"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "nb_total_places"
t.boolean "destroying", default: false
t.boolean "lock", default: false
t.boolean "destroying", default: false
t.boolean "lock", default: false
end
create_table "availability_tags", force: :cascade do |t|
@ -105,7 +105,7 @@ ActiveRecord::Schema.define(version: 20190320091148) do
add_index "availability_tags", ["tag_id"], name: "index_availability_tags_on_tag_id", using: :btree
create_table "categories", force: :cascade do |t|
t.string "name", limit: 255
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
t.string "slug"
@ -114,7 +114,7 @@ ActiveRecord::Schema.define(version: 20190320091148) do
add_index "categories", ["slug"], name: "index_categories_on_slug", unique: true, using: :btree
create_table "components", force: :cascade do |t|
t.string "name", limit: 255, null: false
t.string "name", null: false
end
create_table "coupons", force: :cascade do |t|
@ -132,7 +132,7 @@ ActiveRecord::Schema.define(version: 20190320091148) do
create_table "credits", force: :cascade do |t|
t.integer "creditable_id"
t.string "creditable_type", limit: 255
t.string "creditable_type"
t.integer "plan_id"
t.integer "hours"
t.datetime "created_at"
@ -173,7 +173,7 @@ ActiveRecord::Schema.define(version: 20190320091148) do
add_index "event_themes", ["slug"], name: "index_event_themes_on_slug", unique: true, using: :btree
create_table "events", force: :cascade do |t|
t.string "title", limit: 255
t.string "title"
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
@ -211,10 +211,10 @@ ActiveRecord::Schema.define(version: 20190320091148) do
add_index "exports", ["user_id"], name: "index_exports_on_user_id", using: :btree
create_table "friendly_id_slugs", force: :cascade do |t|
t.string "slug", limit: 255, null: false
t.integer "sluggable_id", null: false
t.string "slug", null: false
t.integer "sluggable_id", null: false
t.string "sluggable_type", limit: 50
t.string "scope", limit: 255
t.string "scope"
t.datetime "created_at"
end
@ -224,10 +224,10 @@ ActiveRecord::Schema.define(version: 20190320091148) do
add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type", using: :btree
create_table "groups", force: :cascade do |t|
t.string "name", limit: 255
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
t.string "slug", limit: 255
t.string "slug"
t.boolean "disabled"
end
@ -247,7 +247,7 @@ ActiveRecord::Schema.define(version: 20190320091148) do
create_table "invoice_items", force: :cascade do |t|
t.integer "invoice_id"
t.string "stp_invoice_item_id", limit: 255
t.string "stp_invoice_item_id"
t.integer "amount"
t.datetime "created_at"
t.datetime "updated_at"
@ -261,17 +261,17 @@ ActiveRecord::Schema.define(version: 20190320091148) do
create_table "invoices", force: :cascade do |t|
t.integer "invoiced_id"
t.string "invoiced_type", limit: 255
t.string "stp_invoice_id", limit: 255
t.string "invoiced_type"
t.string "stp_invoice_id"
t.integer "total"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "user_id"
t.string "reference", limit: 255
t.string "avoir_mode", limit: 255
t.string "reference"
t.string "avoir_mode"
t.datetime "avoir_date"
t.integer "invoice_id"
t.string "type", limit: 255
t.string "type"
t.boolean "subscription_to_expire"
t.text "description"
t.integer "wallet_amount"
@ -288,17 +288,17 @@ ActiveRecord::Schema.define(version: 20190320091148) do
add_index "invoices", ["wallet_transaction_id"], name: "index_invoices_on_wallet_transaction_id", using: :btree
create_table "licences", force: :cascade do |t|
t.string "name", limit: 255, null: false
t.string "name", null: false
t.text "description"
end
create_table "machines", force: :cascade do |t|
t.string "name", limit: 255, null: false
t.string "name", null: false
t.text "description"
t.text "spec"
t.datetime "created_at"
t.datetime "updated_at"
t.string "slug", limit: 255
t.string "slug"
t.boolean "disabled"
end
@ -315,14 +315,14 @@ ActiveRecord::Schema.define(version: 20190320091148) do
create_table "notifications", force: :cascade do |t|
t.integer "receiver_id"
t.integer "attached_object_id"
t.string "attached_object_type", limit: 255
t.string "attached_object_type"
t.integer "notification_type_id"
t.boolean "is_read", default: false
t.boolean "is_read", default: false
t.datetime "created_at"
t.datetime "updated_at"
t.string "receiver_type"
t.boolean "is_send", default: false
t.jsonb "meta_data", default: {}
t.boolean "is_send", default: false
t.jsonb "meta_data", default: {}
end
add_index "notifications", ["notification_type_id"], name: "index_notifications_on_notification_type_id", using: :btree
@ -391,20 +391,20 @@ ActiveRecord::Schema.define(version: 20190320091148) do
add_index "organizations", ["profile_id"], name: "index_organizations_on_profile_id", using: :btree
create_table "plans", force: :cascade do |t|
t.string "name", limit: 255
t.string "name"
t.integer "amount"
t.string "interval", limit: 255
t.string "interval"
t.integer "group_id"
t.string "stp_plan_id", limit: 255
t.string "stp_plan_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "training_credit_nb", default: 0
t.boolean "is_rolling", default: true
t.integer "training_credit_nb", default: 0
t.boolean "is_rolling", default: true
t.text "description"
t.string "type"
t.string "base_name"
t.integer "ui_weight", default: 0
t.integer "interval_count", default: 1
t.integer "ui_weight", default: 0
t.integer "interval_count", default: 1
t.string "slug"
t.boolean "disabled"
end
@ -434,11 +434,11 @@ ActiveRecord::Schema.define(version: 20190320091148) do
create_table "profiles", force: :cascade do |t|
t.integer "user_id"
t.string "first_name", limit: 255
t.string "last_name", limit: 255
t.string "first_name"
t.string "last_name"
t.boolean "gender"
t.date "birthday"
t.string "phone", limit: 255
t.string "phone"
t.text "interest"
t.text "software_mastered"
t.datetime "created_at"
@ -468,7 +468,7 @@ ActiveRecord::Schema.define(version: 20190320091148) do
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "title", limit: 255
t.string "title"
t.integer "step_nb"
end
@ -479,27 +479,27 @@ ActiveRecord::Schema.define(version: 20190320091148) do
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "is_valid", default: false
t.string "valid_token", limit: 255
t.boolean "is_valid", default: false
t.string "valid_token"
end
add_index "project_users", ["project_id"], name: "index_project_users_on_project_id", using: :btree
add_index "project_users", ["user_id"], name: "index_project_users_on_user_id", using: :btree
create_table "projects", force: :cascade do |t|
t.string "name", limit: 255
t.string "name"
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "author_id"
t.text "tags"
t.integer "licence_id"
t.string "state", limit: 255
t.string "slug", limit: 255
t.string "state"
t.string "slug"
t.datetime "published_at"
end
add_index "projects", ["slug"], name: "index_projects_on_slug", using: :btree
add_index "projects", ["slug"], name: "index_projects_on_slug", unique: true, using: :btree
create_table "projects_components", force: :cascade do |t|
t.integer "project_id"
@ -539,19 +539,19 @@ ActiveRecord::Schema.define(version: 20190320091148) do
t.datetime "created_at"
t.datetime "updated_at"
t.integer "reservable_id"
t.string "reservable_type", limit: 255
t.string "stp_invoice_id", limit: 255
t.string "reservable_type"
t.string "stp_invoice_id"
t.integer "nb_reserve_places"
end
add_index "reservations", ["reservable_id", "reservable_type"], name: "index_reservations_on_reservable_id_and_reservable_type", using: :btree
add_index "reservations", ["reservable_type", "reservable_id"], name: "index_reservations_on_reservable_type_and_reservable_id", using: :btree
add_index "reservations", ["stp_invoice_id"], name: "index_reservations_on_stp_invoice_id", using: :btree
add_index "reservations", ["user_id"], name: "index_reservations_on_user_id", using: :btree
create_table "roles", force: :cascade do |t|
t.string "name", limit: 255
t.string "name"
t.integer "resource_id"
t.string "resource_type", limit: 255
t.string "resource_type"
t.datetime "created_at"
t.datetime "updated_at"
end
@ -625,18 +625,18 @@ ActiveRecord::Schema.define(version: 20190320091148) do
create_table "statistic_fields", force: :cascade do |t|
t.integer "statistic_index_id"
t.string "key", limit: 255
t.string "label", limit: 255
t.string "key"
t.string "label"
t.datetime "created_at"
t.datetime "updated_at"
t.string "data_type", limit: 255
t.string "data_type"
end
add_index "statistic_fields", ["statistic_index_id"], name: "index_statistic_fields_on_statistic_index_id", using: :btree
create_table "statistic_graphs", force: :cascade do |t|
t.integer "statistic_index_id"
t.string "chart_type", limit: 255
t.string "chart_type"
t.integer "limit"
t.datetime "created_at"
t.datetime "updated_at"
@ -645,17 +645,17 @@ ActiveRecord::Schema.define(version: 20190320091148) do
add_index "statistic_graphs", ["statistic_index_id"], name: "index_statistic_graphs_on_statistic_index_id", using: :btree
create_table "statistic_indices", force: :cascade do |t|
t.string "es_type_key", limit: 255
t.string "label", limit: 255
t.string "es_type_key"
t.string "label"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "table", default: true
t.boolean "ca", default: true
t.boolean "table", default: true
t.boolean "ca", default: true
end
create_table "statistic_sub_types", force: :cascade do |t|
t.string "key", limit: 255
t.string "label", limit: 255
t.string "key"
t.string "label"
t.datetime "created_at"
t.datetime "updated_at"
end
@ -672,8 +672,8 @@ ActiveRecord::Schema.define(version: 20190320091148) do
create_table "statistic_types", force: :cascade do |t|
t.integer "statistic_index_id"
t.string "key", limit: 255
t.string "label", limit: 255
t.string "key"
t.string "label"
t.boolean "graph"
t.datetime "created_at"
t.datetime "updated_at"
@ -691,7 +691,7 @@ ActiveRecord::Schema.define(version: 20190320091148) do
create_table "subscriptions", force: :cascade do |t|
t.integer "plan_id"
t.integer "user_id"
t.string "stp_subscription_id", limit: 255
t.string "stp_subscription_id"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "expiration_date"
@ -710,7 +710,7 @@ ActiveRecord::Schema.define(version: 20190320091148) do
add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree
create_table "themes", force: :cascade do |t|
t.string "name", limit: 255, null: false
t.string "name", null: false
end
create_table "tickets", force: :cascade do |t|
@ -725,13 +725,13 @@ ActiveRecord::Schema.define(version: 20190320091148) do
add_index "tickets", ["reservation_id"], name: "index_tickets_on_reservation_id", using: :btree
create_table "trainings", force: :cascade do |t|
t.string "name", limit: 255
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "nb_total_places"
t.string "slug", limit: 255
t.string "slug"
t.text "description"
t.boolean "public_page", default: true
t.boolean "public_page", default: true
t.boolean "disabled"
end
@ -787,31 +787,31 @@ ActiveRecord::Schema.define(version: 20190320091148) do
add_index "user_trainings", ["user_id"], name: "index_user_trainings_on_user_id", using: :btree
create_table "users", force: :cascade do |t|
t.string "email", limit: 255, default: "", null: false
t.string "encrypted_password", limit: 255, default: "", null: false
t.string "reset_password_token", limit: 255
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip", limit: 255
t.string "last_sign_in_ip", limit: 255
t.string "confirmation_token", limit: 255
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email", limit: 255
t.integer "failed_attempts", default: 0, null: false
t.string "unlock_token", limit: 255
t.string "unconfirmed_email"
t.integer "failed_attempts", default: 0, null: false
t.string "unlock_token"
t.datetime "locked_at"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "is_allow_contact", default: true
t.boolean "is_allow_contact", default: true
t.integer "group_id"
t.string "stp_customer_id", limit: 255
t.string "username", limit: 255
t.string "slug", limit: 255
t.boolean "is_active", default: true
t.string "stp_customer_id"
t.string "username"
t.string "slug"
t.boolean "is_active", default: true
t.string "provider"
t.string "uid"
t.string "auth_token"

View File

@ -35,8 +35,9 @@ class Checksum
end
def text(data)
sha256 = Digest::SHA256.new
sha256.hexdigest data
require 'sha3'
SHA3::Digest.hexdigest(:sha256, data)
end
private

View File

@ -5,4 +5,4 @@ period2015:
closed_by: 1
period_total: 1500
perpetual_total: 4500
footprint: 6ee52479fd210a13abb80d8c186991b504d2376a8d9fc7d35658ca05770eb10c
footprint: 38afdbe83dd1289a56575e72b23045c5414cfca57d52a05912ad0668bb2e2308

File diff suppressed because one or more lines are too long

View File

@ -9,7 +9,7 @@ invoice_item_1:
description: Sleede - standard, association - month
subscription_id: 1
invoice_item_id:
footprint: 772e9d8a55abb37b18b16385c4a46bd34c1fe0f795975c5da88316fc0fb5ffc4
footprint: 931e8b6f5579f2e7eda625bdf5962da89892957abb25480603ae985e6e108059
invoice_item_2:
id: 2
@ -22,7 +22,7 @@ invoice_item_2:
d'emploi - month
subscription_id: 2
invoice_item_id:
footprint: 5326142307e047379b7cc2aff143bc12529ff4469fb3253171d04f16dd4ec601
footprint: abbf95b8d506ed6207343edbf8ee63893cd02508de6d25347999d7dbc755c6fb
invoice_item_3:
id: 3
@ -34,7 +34,7 @@ invoice_item_3:
description: Mensuel - standard, association - month
subscription_id: 3
invoice_item_id:
footprint: 32089152aa3cf6b6059598a570202b9b710d233602521d8167fe03cef79a05ea
footprint: caf3b7e54e0191d8f262e01acc4e66f29f9d27abe52e595fb3b71724a32cfe90
invoice_item_4:
id: 4
@ -46,7 +46,7 @@ invoice_item_4:
description: Formation Laser / Vinyle April 11, 2012 08:00 - 12:00 PM
subscription_id:
invoice_item_id:
footprint: 2762d4ec03451e1da0abfe3622dabffd1c9183c5a58f5626a36c0a5936f99e95
footprint: 71d095aa4d49ebac39f7efdc5c9de2354ea8efeec7c35a6708143fb66dd66b0b
invoice_item_5:
id: 5
@ -58,5 +58,5 @@ invoice_item_5:
description: Imprimante 3D June 15, 2015 12:00 - 01:00 PM
subscription_id:
invoice_item_id:
footprint: 640e915fb30da68f30976f93486d158b5ac01b4caf8f1335c4376d6b36c12ead
footprint: d4d856ee04f27b5e35f43056b46f139df73ffdfaad1716636f569164c52c5e5b

View File

@ -15,7 +15,7 @@ invoice_1:
type:
subscription_to_expire:
description:
footprint: b4bff0b6176a706f745710ef12014917ceefc557ce60e26ec638394ffaad8236
footprint: 9b1d216a49a65f5428c92af10e284d6dfe4070f6e65e5eacd735ef770540a16a
environment: test
operator_id:
@ -35,7 +35,7 @@ invoice_2:
type:
subscription_to_expire:
description:
footprint: dfe9a91a365155d4f6b4c614071d2c132472095a5a80f6c5d87e45c199bffd27
footprint: 32c09fe7ba92501f9239c111abd6688cb7d4ea5fe16c201f56d8d28546031804
environment: test
operator_id:
@ -55,7 +55,7 @@ invoice_3:
type:
subscription_to_expire:
description:
footprint: 9913446ac3383d029e3742baa85ae72632f7dddd7fb7d291140775e8735795e3
footprint: bbb731b181eafd9a78b0b610afeddd3c92f55fcc11b9d58a2d4956cb30b28ee0
environment: test
operator_id:
@ -76,7 +76,7 @@ invoice_4:
type:
subscription_to_expire:
description:
footprint: 776bb1ebd50a8cb5ed61af8c80c08185dd3d66baa77b46001245d57f421642f4
footprint: 0b4afc997a22975102441c9dc3635a43bb098d31086f79189751d12e0fb0078c
environment: test
operator_id:
@ -96,6 +96,6 @@ invoice_5:
type:
subscription_to_expire:
description:
footprint: cb23d5e724697e39da04f73b0e3d6e5e7830fd5db10d56f9998d399d435f2b74
footprint: b580117a83436c91475f06ced6c043ce9677c86c2c04cd41ed10860fb214ec71
environment: test
operator_id: