]> git.openstreetmap.org Git - rails.git/blob - db/migrate/041_add_fine_o_auth_permissions.rb
Remove code to populate countries table
[rails.git] / db / migrate / 041_add_fine_o_auth_permissions.rb
1 class AddFineOAuthPermissions < ActiveRecord::Migration
2   PERMISSIONS = [:allow_read_prefs, :allow_write_prefs, :allow_write_diary,
3                  :allow_write_api, :allow_read_gpx, :allow_write_gpx ]
4
5   def self.up
6     PERMISSIONS.each do |perm|
7       # add fine-grained permissions columns for OAuth tokens, allowing people to
8       # give permissions to parts of the site only.
9       add_column :oauth_tokens, perm, :boolean, :null => false, :default => false
10
11       # add fine-grained permissions columns for client applications, allowing the
12       # client applications to request particular privileges.
13       add_column :client_applications, perm, :boolean, :null => false, :default => false
14     end
15   end
16
17   def self.down
18     PERMISSIONS.each do |perm|
19       remove_column :oauth_tokens, perm
20       remove_column :client_applications, perm
21     end
22   end
23 end