Sha256: 5c036737c9e4bdf94c9b926f96e52fd093958c992d6025495e7726e2e1d7e7af
Contents?: true
Size: 982 Bytes
Versions: 1
Compression:
Stored size: 982 Bytes
Contents
module FlexibleAccessibility class Permission attr_reader :resource attr_reader :actions def initialize(args={}) @resource = args[:resource] @actions = args[:actions] end def controller ApplicationResource.new(self.resource).controller end def namespace ApplicationResource.new(self.resource).namespace end # TODO: this function may be recursive because nesting may be existed class << self def all permissions = [] RouteProvider.new.app_controllers.each do |scope| namespace = scope.first.to_s scope.last.each do |resource| resource = "#{namespace}/#{resource}" unless namespace == 'default' permissions << Permission.new(:resource => resource.gsub(/_controller/, ''), :actions => RouteProvider.new(ApplicationResource.new(resource).klass).verifiable_routes_list) end end permissions end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
flexible_accessibility-0.3.16 | lib/flexible_accessibility/permission.rb |