lib/authorized_persona/authorization.rb
# Grants replace all previous grants to avoid privilege leakage
Grants replace all previous grants to avoid privilege leakage
Grants replace all previous grants to avoid privilege leakage
def grant(privileges) 
        self.authorized_actions = Hash[privileges.map { |auth_tier, actions| [auth_tier.to_s, [actions].flatten.map(&:to_sym)] }]
        tier_names = authorization_persona.authorization_tier_names
        extra_keys = authorized_actions.keys - authorization_persona.authorization_tier_names
        if extra_keys.present?
          raise AuthorizedPersona::Error, "invalid grant: #{authorization_persona_class_name} " \
            "has authorization tiers #{tier_names.join(', ')} but received extra keys: #{extra_keys.join(', ')}"
        end
      end
def grant ( privileges ) self . authorized_actions = Hash [ privileges . map { | auth_tier , actions | [ auth_tier . to_s , [ actions ] . flatten . map ( & :to_sym ) ] } ] tier_names = authorization_persona . authorization_tier_names extra_keys = authorized_actions . keys - authorization_persona . authorization_tier_names if extra_keys . present? raise AuthorizedPersona :: Error , "invalid grant: #{authorization_persona_class_name} " "has authorization tiers #{tier_names.join(', ')} but received extra keys: #{extra_keys.join(', ')}" end end
Grants replace all previous grants to avoid privilege leakage
Grants replace all previous grants to avoid privilege leakage
# rubocop:disable Metrics/AbcSize
privileges
<not_specific>