class Arpa::Repositories::Actions::Finder

Public Instance Methods

by_name_and_resource(name, resource_id) click to toggle source
# File lib/arpa/repositories/actions/finder.rb, line 7
def by_name_and_resource(name, resource_id)
  record = repository_class.find_by(name: name, repository_resource_id: resource_id)
  mapper_instance.map_to_entity(record) if record
end
mapper_instance() click to toggle source
# File lib/arpa/repositories/actions/finder.rb, line 22
def mapper_instance
  Arpa::DataMappers::ActionMapper.instance
end
permission(resource_name, action_name, profile_ids) click to toggle source
# File lib/arpa/repositories/actions/finder.rb, line 12
def permission(resource_name, action_name, profile_ids)
  record = repository_class
           .distinct(true)
           .joins(:resource, roles: :profiles)
           .find_by(repository_profiles: { id: profile_ids },
                    repository_resources: { name: resource_name },
                    name: action_name)
  mapper_instance.map_to_entity(record) if record
end
repository_class() click to toggle source
# File lib/arpa/repositories/actions/finder.rb, line 26
def repository_class
  RepositoryAction
end