Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix eduroam accounting and auth #10

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dmitry-sinina
Copy link
Contributor

No description provided.

@@ -62,6 +62,6 @@ group :development do
gem 'web-console', '>= 3.3.0'
# Spring speeds up development by keeping your application running in the background.
# Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmitry-sinina why did you remove spring? Have you encountered some issues with it?

has_many :email_redirects, class_name: 'Email::Redirect', foreign_key: :domain_id, inverse_of: :domain, dependent: :restrict_with_error

validates :fqdn, presence: true
validates :fqdn, uniqueness: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmitry-sinina you can write it in a single line:

validates :fqdn, presence: true, uniqueness: true

class Domain < ApplicationRecord
self.table_name = 'domains'

has_many :email_redirects, class_name: 'Email::Redirect', foreign_key: :domain_id, inverse_of: :domain, dependent: :restrict_with_error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmitry-sinina you can omit foreign_key key cause it will be equal to :domain_id by default according to Rails convention

class Email::Redirect < ApplicationRecord
self.table_name = 'email_redirects'

belongs_to :domain, class_name: 'Domain', foreign_key: :domain_id, inverse_of: :email_redirects
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmitry-sinina you can omit foreign_key key cause it will be equal to :domain_id by default according to Rails convention

validates :username, uniqueness: { scope: :domain_id }

def display_name
rewrited_destination.to_s
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmitry-sinina you don't need to add .to_s explicitly because you've already have a valiation that value can't be nil

validates :fqdn, uniqueness: true

def display_name
fqdn.to_s
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmitry-sinina you don't need to add .to_s explicitly because you've already have a valiation that value can't be nil

@@ -26,8 +26,9 @@ def authorize!

def authorization_data_for(record)
{
'User-Name': record.login,
'Cleartext-Password': record.password
# 'User-Name': record.login,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we don't need to provide login in response anymore?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants