alphagov/transition — pull request #294 by jamiecobbett (2014-05-29 16:47:45+00:00)
Title: Rename 'admin' to 'GDS Editor'

We currently use 'admin' to mean 'can edit any site'. We want to add the ability to edit things which are beyond mappings (specifically, the redirection host whitelist) which we don't want to give to everyone who is an currently an admin.

We can migrate the data in signon with this script:
```ruby
application = Doorkeeper::Application.find_by_name('transition')

# update the available permissions list
supported_permission = application.supported_permissions.find_by_name('admin')
supported_permission.name = 'GDS Editor'

# update the users
application.permissions.where("permissions like '%admin%'").each do |permission|
permission.permissions = permission.permissions.map { |string| (string == 'admin') ? 'GDS Editor' : string }
permission.save
end
```