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