discourse/app/models/user_api_key.rb
Sam fc095acaaa Feature: User API key support (server side implementation)
- Supports throttled read and write
- No support for push yet, but data is captured about intent
2016-08-15 17:59:36 +10:00

31 lines
839 B
Ruby

class UserApiKey < ActiveRecord::Base
belongs_to :user
def access
"#{read ? "r" : ""}#{write ? "w" : ""}#{push ? "p" : ""}"
end
end
# == Schema Information
#
# Table name: user_api_keys
#
# id :integer not null, primary key
# user_id :integer not null
# client_id :string not null
# key :string not null
# application_name :string not null
# read :boolean not null
# write :boolean not null
# push :boolean not null
# push_url :string
# created_at :datetime
# updated_at :datetime
#
# Indexes
#
# index_user_api_keys_on_client_id (client_id)
# index_user_api_keys_on_key (key) UNIQUE
# index_user_api_keys_on_user_id (user_id)
#