diff --git a/app/views/icons/_alert_circle.html.erb b/app/views/icons/_alert_circle.html.erb new file mode 100644 index 00000000..8a021ee3 --- /dev/null +++ b/app/views/icons/_alert_circle.html.erb @@ -0,0 +1,6 @@ + + + + + + diff --git a/app/views/icons/_lock_open.html.erb b/app/views/icons/_lock_open.html.erb new file mode 100644 index 00000000..1a1ce108 --- /dev/null +++ b/app/views/icons/_lock_open.html.erb @@ -0,0 +1,6 @@ + + + + + + diff --git a/config/locales/en.yml b/config/locales/en.yml index 37788d85..76299873 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -57,6 +57,10 @@ en: &en sign_up_with_microsoft: Sign up with Microsoft by_creating_an_account_you_agree_to_our_html: 'By creating an account, you agree to our Privacy Policy and Terms of Service.' enter_email_to_continue: Enter email to continue + doorkeeper: + scopes: + write: Update your data + read: Read your data es: &es role: Rol diff --git a/db/migrate/20240720063827_create_doorkeeper_tables.rb b/db/migrate/20240720063827_create_doorkeeper_tables.rb new file mode 100644 index 00000000..958b1efd --- /dev/null +++ b/db/migrate/20240720063827_create_doorkeeper_tables.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true + +class CreateDoorkeeperTables < ActiveRecord::Migration[7.1] + def change + create_table :oauth_applications do |t| + t.string :name, null: false + t.string :uid, null: false + t.string :secret, null: false + t.text :redirect_uri + t.string :scopes, null: false, default: '' + t.boolean :confidential, null: false, default: true + t.timestamps null: false + end + + add_index :oauth_applications, :uid, unique: true + + create_table :oauth_access_grants do |t| + t.references :resource_owner, null: false + t.references :application, null: false + t.string :token, null: false + t.integer :expires_in, null: false + t.text :redirect_uri, null: false + t.string :scopes, null: false, default: '' + t.datetime :created_at, null: false + t.datetime :revoked_at + end + + add_index :oauth_access_grants, :token, unique: true + add_foreign_key :oauth_access_grants, :oauth_applications, column: :application_id + + create_table :oauth_access_tokens do |t| + t.references :resource_owner, index: true + t.references :application, null: false + t.string :token, null: false + t.string :refresh_token + t.integer :expires_in + t.string :scopes + t.datetime :created_at, null: false + t.datetime :revoked_at + t.string :previous_refresh_token, null: false, default: '' + end + + add_index :oauth_access_tokens, :token, unique: true + add_index :oauth_access_tokens, :refresh_token, unique: true + + add_foreign_key :oauth_access_tokens, :oauth_applications, column: :application_id + add_foreign_key :oauth_access_grants, :users, column: :resource_owner_id + add_foreign_key :oauth_access_tokens, :users, column: :resource_owner_id + end +end diff --git a/db/schema.rb b/db/schema.rb index b6cd288d..21e94cef 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[7.1].define(version: 2024_07_20_063826) do +ActiveRecord::Schema[7.1].define(version: 2024_07_20_063827) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -149,6 +149,48 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_20_063826) do t.index ["user_id"], name: "index_encrypted_user_configs_on_user_id" end + create_table "oauth_access_grants", force: :cascade do |t| + t.bigint "resource_owner_id", null: false + t.bigint "application_id", null: false + t.string "token", null: false + t.integer "expires_in", null: false + t.text "redirect_uri", null: false + t.string "scopes", default: "", null: false + t.datetime "created_at", null: false + t.datetime "revoked_at" + t.index ["application_id"], name: "index_oauth_access_grants_on_application_id" + t.index ["resource_owner_id"], name: "index_oauth_access_grants_on_resource_owner_id" + t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true + end + + create_table "oauth_access_tokens", force: :cascade do |t| + t.bigint "resource_owner_id" + t.bigint "application_id", null: false + t.string "token", null: false + t.string "refresh_token" + t.integer "expires_in" + t.string "scopes" + t.datetime "created_at", null: false + t.datetime "revoked_at" + t.string "previous_refresh_token", default: "", null: false + t.index ["application_id"], name: "index_oauth_access_tokens_on_application_id" + t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true + t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id" + t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true + end + + create_table "oauth_applications", force: :cascade do |t| + t.string "name", null: false + t.string "uid", null: false + t.string "secret", null: false + t.text "redirect_uri" + t.string "scopes", default: "", null: false + t.boolean "confidential", default: true, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true + end + create_table "submission_events", force: :cascade do |t| t.bigint "submission_id", null: false t.bigint "submitter_id" @@ -314,6 +356,10 @@ ActiveRecord::Schema[7.1].define(version: 2024_07_20_063826) do add_foreign_key "email_messages", "users", column: "author_id" add_foreign_key "encrypted_configs", "accounts" add_foreign_key "encrypted_user_configs", "users" + add_foreign_key "oauth_access_grants", "oauth_applications", column: "application_id" + add_foreign_key "oauth_access_grants", "users", column: "resource_owner_id" + add_foreign_key "oauth_access_tokens", "oauth_applications", column: "application_id" + add_foreign_key "oauth_access_tokens", "users", column: "resource_owner_id" add_foreign_key "submission_events", "submissions" add_foreign_key "submission_events", "submitters" add_foreign_key "submissions", "templates"