Sha256: f23fd523e360faf65dd75671ebad26e4695f84c21575f83a66170e178e8674fa

Contents?: true

Size: 605 Bytes

Versions: 1

Compression:

Stored size: 605 Bytes

Contents

# frozen_string_literal: true

require 'accession'

class APISubject < ApplicationRecord
  include Accession::Principal

  has_many :api_subject_roles
  has_many :roles, through: :api_subject_roles

  valhammer
  validates :x509_cn, format: { with: /\A[\w-]+\z/ }

  def permissions
    # This could be extended to gather permissions from
    # other data sources providing input to api_subject identity
    roles.joins(:permissions).pluck('permissions.value')
  end

  def functioning?
    # more than enabled? could inform functioning?
    # such as an administrative or AAF lock
    enabled?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aaf-gumboot-1.1.0 spec/dummy/app/models/api_subject.rb