Sha256: f0b6d46b1735ce7e5309a63308982f66063e957a0df7b8f5f35f53231715526a
Contents?: true
Size: 636 Bytes
Versions: 46
Compression:
Stored size: 636 Bytes
Contents
module Itsf::Backend class Service::BasePolicy attr_reader :user, :service def initialize(user, service) @user = user @service = service end def index? authorize_with_rbac(user, service, __method__) end def invoke? authorize_with_rbac(user, service, __method__) end def call? invoke? end private def authorize_with_rbac(user, service_class, method_name) permission_identifier = "#{service_class.name.underscore}/#{method_name.to_s.chomp('?')}" user.respond_to?(:allowed_to?) ? user.allowed_to?(permission_identifier) : true end end end
Version data entries
46 entries across 46 versions & 1 rubygems