]> git.openstreetmap.org Git - rails.git/blob - app/models/oauth2_application.rb
Add some validations for i18n values
[rails.git] / app / models / oauth2_application.rb
1 class Oauth2Application < Doorkeeper::Application
2   belongs_to :owner, :polymorphic => true
3
4   validate :allowed_scopes
5
6   private
7
8   def allowed_scopes
9     return if owner.administrator?
10
11     errors.add(:scopes) if scopes.any? { |scope| Oauth::PRIVILEGED_SCOPES.include?(scope) }
12   end
13 end