Class: Oauth2Provider::Scope
- Inherits:
-
Object
- Object
- Oauth2Provider::Scope
- Includes:
- Mongoid::Document, Mongoid::Timestamps, Document::Base
- Defined in:
- app/models/oauth2_provider/scope.rb
Class Method Summary collapse
-
.sync_scopes_with_scope(scope) ⇒ Object
Sync all scopes with the correct exploded scope when a scope is modified (changed or removed).
Instance Method Summary collapse
Methods included from Document::Base
Class Method Details
.sync_scopes_with_scope(scope) ⇒ Object
Sync all scopes with the correct exploded scope when a scope is modified (changed or removed)
30 31 32 33 34 35 36 |
# File 'app/models/oauth2_provider/scope.rb', line 30 def sync_scopes_with_scope(scope) scopes_to_sync = any_in(scope: [scope]) scopes_to_sync.each do |client| scope.values = Oauth2Provider.normalize_scope(scope.values) scope.save end end |
Instance Method Details
#normalize(val) ⇒ Object
17 18 19 20 |
# File 'app/models/oauth2_provider/scope.rb', line 17 def normalize(val) separator = Oauth2Provider.settings["scope_separator"] val = val.split(separator) end |
#values_pretty ⇒ Object
22 23 24 25 |
# File 'app/models/oauth2_provider/scope.rb', line 22 def values_pretty separator = Oauth2Provider.settings["scope_separator"] values.join(separator) end |