Sha256: df4ce84dd2d28d6ac9b3f5bfd8fd9ef76b9bfbc08c502a86e3cdd950deee5676
Contents?: true
Size: 827 Bytes
Versions: 8
Compression:
Stored size: 827 Bytes
Contents
require "delegate" module Ddr::Auth class LegacyAuthorization < SimpleDelegator def to_roles sources.map(&:to_roles).reduce(&:merge) end def clear sources.each(&:clear) end def clear? sources.all? { |auth| auth.source.empty? } end def migrate migrated = inspect roles.grant *to_roles clear ["LEGACY AUTHORIZATION DATA", migrated, "ROLES", roles.serialize.inspect].join("\n\n") end def inspect sources.map { |auth| auth.inspect }.join("\n") end private def sources wrappers.map { |wrapper| wrapper.new(self) } end def wrappers classes = [ LegacyPermissions, LegacyRoles ] if respond_to? :default_permissions classes << LegacyDefaultPermissions end classes end end end
Version data entries
8 entries across 8 versions & 1 rubygems