Sha256: 842b0992d83d518aaa7ffa2d8b99db118fb66c1a4df996b36c2c105f751652fd

Contents?: true

Size: 647 Bytes

Versions: 14

Compression:

Stored size: 647 Bytes

Contents

# frozen_string_literal: true

require 'accession'

class APISubject < ApplicationRecord
  include Accession::Principal

  has_many :api_subject_roles, dependent: :destroy
  has_many :roles, through: :api_subject_roles, dependent: :destroy

  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

14 entries across 14 versions & 1 rubygems

Version Path
aaf-gumboot-2.6.3 spec/dummy/app/models/api_subject.rb
aaf-gumboot-2.6.2 spec/dummy/app/models/api_subject.rb
aaf-gumboot-2.6.1 spec/dummy/app/models/api_subject.rb
aaf-gumboot-2.6.0 spec/dummy/app/models/api_subject.rb
aaf-gumboot-2.5.1 spec/dummy/app/models/api_subject.rb
aaf-gumboot-2.5.0 spec/dummy/app/models/api_subject.rb
aaf-gumboot-2.4.0 spec/dummy/app/models/api_subject.rb
aaf-gumboot-2.2.0 spec/dummy/app/models/api_subject.rb
aaf-gumboot-2.1.4 spec/dummy/app/models/api_subject.rb
aaf-gumboot-2.1.3 spec/dummy/app/models/api_subject.rb
aaf-gumboot-2.1.1 spec/dummy/app/models/api_subject.rb
aaf-gumboot-2.1.0 spec/dummy/app/models/api_subject.rb
aaf-gumboot-2.0.1 spec/dummy/app/models/api_subject.rb
aaf-gumboot-1.2.0 spec/dummy/app/models/api_subject.rb