Method: Authorize::Permission.aggregate_mask
- Defined in:
- lib/authorize/permission.rb
.aggregate_mask ⇒ Object
Find the aggregate permission mask for the current scope This calculation could be more effectively performed at the database using an aggregate function. For MySQL, a bit_or function exists. For SQLite3, it is necessary to code an extension. For an example, see: snippets.dzone.com/posts/show/3717
64 65 66 |
# File 'lib/authorize/permission.rb', line 64 def self.aggregate_mask Mask.new(all.inject(Set.new){|memo, p| memo | p.mask}) end |