Revision 2dec184c
Added by Eric Helms over 8 years ago
app/models/permission.rb | ||
---|---|---|
has_many :filterings, :dependent => :destroy
|
||
has_many :filters, :through => :filterings
|
||
|
||
scoped_search :on => :name, :complete_value => true
|
||
scoped_search :on => :resource_type
|
||
|
||
def self.resources
|
||
@all_resources ||= Permission.uniq.order(:resource_type).pluck(:resource_type).compact
|
||
end
|
Also available in: Unified diff
Fixes #11303: Allow scoped search by name for permissions.
This both provides this functionality and fixes an issue with creating
filters using hammer. Hammer attempts to search for a permission by
name using scoped search syntax when creating a filter with the
--permission=view_domains style syntax. However, this was defaulting to
returning all permissions instead of scoped permissions.