Skip to content

Commit

Permalink
simplify new permission initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
jpslav committed Sep 11, 2019
1 parent 61deb84 commit c4d43e3
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
class AddFineGrainedAccessToOauthApplications < ActiveRecord::Migration[5.2]
def up
add_column :oauth_applications, :can_access_private_user_data, :boolean, default: false
execute "update oauth_applications set can_access_private_user_data='t' where trusted = 't'"
add_column :oauth_applications, :can_access_private_user_data, :boolean, default: false, null: false
add_column :oauth_applications, :can_find_or_create_accounts, :boolean, default: false, null: false
add_column :oauth_applications, :can_message_users, :boolean, default: false, null: false
add_column :oauth_applications, :can_skip_oauth_screen, :boolean, default: false, null: false

add_column :oauth_applications, :can_find_or_create_accounts, :boolean, default: false
execute "update oauth_applications set can_find_or_create_accounts='t' where trusted = 't'"
Doorkeeper::Application.reset_column_information

add_column :oauth_applications, :can_message_users, :boolean, default: false
execute "update oauth_applications set can_message_users='t' where trusted = 't'"

add_column :oauth_applications, :can_skip_oauth_screen, :boolean, default: false
execute "update oauth_applications set can_skip_oauth_screen='t' where trusted = 't'"
Doorkeeper::Application.where(trusted: true).update_all(
can_access_private_user_data: true,
can_find_or_create_accounts: true,
can_message_users: true,
can_skip_oauth_screen: true
)
end

def down
Expand Down

0 comments on commit c4d43e3

Please sign in to comment.