openstreetmap-website/db/migrate/041_add_fine_o_auth_permissions.rb
2009-08-13 17:18:08 +00:00

23 lines
867 B
Ruby

class AddFineOAuthPermissions < ActiveRecord::Migration
PERMISSIONS = [:allow_read_prefs, :allow_write_prefs, :allow_write_diary,
:allow_write_api, :allow_read_gpx, :allow_write_gpx ]
def self.up
PERMISSIONS.each do |perm|
# add fine-grained permissions columns for OAuth tokens, allowing people to
# give permissions to parts of the site only.
add_column :oauth_tokens, perm, :boolean, :null => false, :default => false
# add fine-grained permissions columns for client applications, allowing the
# client applications to request particular privileges.
add_column :client_applications, perm, :boolean, :null => false, :default => false
end
end
def self.down
PERMISSIONS.each do |perm|
remove_column :oauth_tokens, perm
remove_column :client_applications, perm
end
end
end