From 92afd296509de82e7550f67064b032db916b1f63 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 26 Aug 2016 19:12:19 +0200 Subject: The frontend will now be an OAuth app, auto-authorized. The frontend will use an access token for API requests Adding better errors for the API controllers, posting a simple status works from the frontend now --- .../20160826155805_add_superapp_to_oauth_applications.rb | 5 +++++ db/schema.rb | 13 +++++++------ db/seeds.rb | 9 ++------- 3 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 db/migrate/20160826155805_add_superapp_to_oauth_applications.rb (limited to 'db') diff --git a/db/migrate/20160826155805_add_superapp_to_oauth_applications.rb b/db/migrate/20160826155805_add_superapp_to_oauth_applications.rb new file mode 100644 index 000000000..a1b92fada --- /dev/null +++ b/db/migrate/20160826155805_add_superapp_to_oauth_applications.rb @@ -0,0 +1,5 @@ +class AddSuperappToOauthApplications < ActiveRecord::Migration[5.0] + def change + add_column :oauth_applications, :superapp, :boolean, default: false, null: false + end +end diff --git a/db/schema.rb b/db/schema.rb index 45ab70855..b63df0fea 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: 20160325130944) do +ActiveRecord::Schema.define(version: 20160826155805) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -94,15 +94,16 @@ ActiveRecord::Schema.define(version: 20160325130944) do 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", null: false - t.string "scopes", default: "", null: false + t.string "name", null: false + t.string "uid", null: false + t.string "secret", null: false + t.text "redirect_uri", null: false + t.string "scopes", default: "", null: false t.datetime "created_at" t.datetime "updated_at" t.integer "owner_id" t.string "owner_type" + t.boolean "superapp", default: false, null: false t.index ["owner_id", "owner_type"], name: "index_oauth_applications_on_owner_id_and_owner_type", using: :btree t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree end diff --git a/db/seeds.rb b/db/seeds.rb index 4edb1e857..c2bf6a16e 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,7 +1,2 @@ -# This file should contain all the record creation needed to seed the database with its default values. -# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). -# -# Examples: -# -# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) -# Mayor.create(name: 'Emanuel', city: cities.first) +web_app = Doorkeeper::Application.new(name: 'Web', superapp: true, redirect_uri: Doorkeeper.configuration.native_redirect_uri) +web_app.save(validate: false) -- cgit