From 609bdf3a9a86bce590e4475aca40335ad3e23fd3 Mon Sep 17 00:00:00 2001 From: Marc Riera Casals Date: Fri, 22 Jan 2021 15:58:51 +0100 Subject: [PATCH] Add file authorization handler --- Gemfile | 1 + Gemfile.lock | 10 ++++++++++ config/routes.rb | 2 +- ..._datum.decidim_file_authorization_handler.rb | 17 +++++++++++++++++ db/schema.rb | 10 +++++++++- 5 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20210122145801_create_decidim_file_authorization_handler_census_datum.decidim_file_authorization_handler.rb diff --git a/Gemfile b/Gemfile index f612db5..ffefce6 100644 --- a/Gemfile +++ b/Gemfile @@ -8,6 +8,7 @@ DECIDIM_VERSION = { git: 'https://github.com/decidim/decidim.git', tag: 'v0.23.1 gem 'decidim', DECIDIM_VERSION gem 'decidim-verify_wo_registration', git: "https://github.com/CodiTramuntana/decidim-verify_wo_registration.git" +gem 'decidim-file_authorization_handler', git: "https://github.com/MarsBased/decidim-file_authorization_handler.git" gem 'rails', '~> 5.2.4.4' gem 'puma' diff --git a/Gemfile.lock b/Gemfile.lock index 20382d2..d7c4e9d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,6 +7,15 @@ GIT decidim-core (>= 0.20) decidim-proposals (>= 0.20) +GIT + remote: https://github.com/MarsBased/decidim-file_authorization_handler.git + revision: dc54007dfc6b4c25c7b71f677a09d76f592d00e5 + specs: + decidim-file_authorization_handler (0.15.0) + decidim (>= 0.15.0) + decidim-admin (>= 0.15.0) + rails (>= 5.2) + GIT remote: https://github.com/decidim/decidim.git revision: ac6191fa9b9ff2fa243a348142941334d8ee0ef8 @@ -795,6 +804,7 @@ DEPENDENCIES database_cleaner decidim! decidim-dev! + decidim-file_authorization_handler! decidim-verify_wo_registration! faker (~> 1.9.6) geocoder (~> 1.6.1) diff --git a/config/routes.rb b/config/routes.rb index 181c24e..453b3c4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -8,5 +8,5 @@ mount Decidim::Core::Engine => '/' mount Sidekiq::Web => '/sidekiq' if Rails.env.development? - + mount Decidim::FileAuthorizationHandler::AdminEngine => '/admin' end diff --git a/db/migrate/20210122145801_create_decidim_file_authorization_handler_census_datum.decidim_file_authorization_handler.rb b/db/migrate/20210122145801_create_decidim_file_authorization_handler_census_datum.decidim_file_authorization_handler.rb new file mode 100644 index 0000000..4510565 --- /dev/null +++ b/db/migrate/20210122145801_create_decidim_file_authorization_handler_census_datum.decidim_file_authorization_handler.rb @@ -0,0 +1,17 @@ +# This migration comes from decidim_file_authorization_handler (originally 20171110120821) + +# frozen_string_literal: true + +class CreateDecidimFileAuthorizationHandlerCensusDatum < ActiveRecord::Migration[5.1] + def change + create_table :decidim_file_authorization_handler_census_data do |t| + t.references :decidim_organization, index: { name: "decidim_census_data_org_id_index" } + t.string :id_document + t.date :birthdate + + # The rows in this table are immutable (insert or delete, not update) + # To explicitly reflect this fact there is no `updated_at` column + t.datetime "created_at", null: false + end + end +end diff --git a/db/schema.rb b/db/schema.rb index fcdcacf..ec2cd1e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_12_23_164198) do +ActiveRecord::Schema.define(version: 2021_01_22_145801) do # These are extensions that must be enabled in order to support this database enable_extension "ltree" @@ -474,6 +474,14 @@ t.index ["resource_type", "resource_id"], name: "index_decidim_endorsements_on_resource_type_and_resource_id" end + create_table "decidim_file_authorization_handler_census_data", force: :cascade do |t| + t.bigint "decidim_organization_id" + t.string "id_document" + t.date "birthdate" + t.datetime "created_at", null: false + t.index ["decidim_organization_id"], name: "decidim_census_data_org_id_index" + end + create_table "decidim_follows", force: :cascade do |t| t.bigint "decidim_user_id", null: false t.string "decidim_followable_type"