YaleSTC/shifts

View on GitHub
app/models/app_config.rb

Summary

Maintainability
A
0 mins
Test Coverage
class AppConfig < ActiveRecord::Base
  #commented out for now, maybe re-add later
  #validates_presence_of :auth_types
  validates_presence_of :mailer_address, :admin_email

  LOGIN_OPTIONS = [
    # Displayed               stored in db
    ["Central Authentication Service (CAS)",      "CAS"],
    ["Built-in Authentication",                   "built-in"]
  ]

  def login_options
    self.auth_types.split(', ')
  end

  def auth_types=(login_options)
    login_options = login_options.split(', ') if login_options.class == String
      write_attribute(:auth_types, login_options.uniq.remove_blank.join(', '))
  end


end