-
Notifications
You must be signed in to change notification settings - Fork 3
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
ActiveAdmin.register Domain do | ||
menu parent: 'Services configuration', priority: 20 | ||
|
||
# actions :index | ||
config.batch_actions = false | ||
|
||
permit_params :fqdn | ||
|
||
filter :id | ||
filter :fqdn | ||
|
||
index do | ||
id_column | ||
actions | ||
column :fqdn | ||
column :created_at | ||
column :updated_at | ||
end | ||
|
||
show do | ||
attributes_table do | ||
row :id | ||
row :fqdn | ||
end | ||
end | ||
|
||
form do |f| | ||
f.semantic_errors(*f.object.errors.keys) | ||
f.inputs do | ||
f.input :fqdn | ||
end | ||
f.actions | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
ActiveAdmin.register Email::Redirect do | ||
menu parent: 'Services configuration', priority: 30 | ||
# actions :index | ||
config.batch_actions = false | ||
|
||
includes :domain | ||
permit_params :username, :domain_id, :rewrited_destination | ||
|
||
filter :id | ||
filter :username | ||
filter :domain | ||
|
||
index do | ||
id_column | ||
actions | ||
column :username | ||
column :domain | ||
column :rewrited_destination | ||
column :created_at | ||
column :updated_at | ||
end | ||
|
||
show do | ||
attributes_table do | ||
row :id | ||
row :username | ||
row :domain | ||
row :rewrited_destination | ||
end | ||
end | ||
|
||
form do |f| | ||
f.semantic_errors(*f.object.errors.keys) | ||
f.inputs do | ||
f.input :username | ||
f.input :domain | ||
f.input :rewrited_destination | ||
end | ||
f.actions | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,8 +26,9 @@ def authorize! | |
|
||
def authorization_data_for(record) | ||
{ | ||
'User-Name': record.login, | ||
'Cleartext-Password': record.password | ||
# 'User-Name': record.login, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why we don't need to provide login in response anymore? |
||
'control:Cleartext-Password': record.password, | ||
'Acct-Interim-Interval': 60 | ||
} | ||
end | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dmitry-sinina you can omit |
||
|
||
validates :fqdn, presence: true | ||
validates :fqdn, uniqueness: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
|
||
def display_name | ||
fqdn.to_s | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dmitry-sinina you don't need to add |
||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
class Email::Redirect < ApplicationRecord | ||
self.table_name = 'email_redirects' | ||
|
||
belongs_to :domain, class_name: 'Domain', foreign_key: :domain_id, inverse_of: :email_redirects | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dmitry-sinina you can omit |
||
|
||
validates :rewrited_destination, :username, :domain_id, presence: true | ||
validates :username, uniqueness: { scope: :domain_id } | ||
|
||
def display_name | ||
rewrited_destination.to_s | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dmitry-sinina you don't need to add |
||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,3 +31,9 @@ | |
|
||
en: | ||
hello: "Hello world" | ||
date: | ||
formats: | ||
long: "%Y-%m-%d" | ||
time: | ||
formats: | ||
long: "%Y-%m-%d %H:%M:%S" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
class AddEmail < ActiveRecord::Migration[5.2] | ||
def up | ||
execute %q{ | ||
create table domains( | ||
id serial primary key, | ||
fqdn varchar not null unique, | ||
created_at timestamptz, | ||
updated_at timestamptz | ||
); | ||
|
||
create table email_redirects( | ||
id serial primary key, | ||
username varchar not null, | ||
domain_id integer not null references domains(id), | ||
rewrited_destination varchar not null, | ||
created_at timestamptz, | ||
updated_at timestamptz | ||
); | ||
create unique index on email_redirects using btree(username, domain_id); | ||
} | ||
end | ||
|
||
def down | ||
execute %q{ | ||
drop table email_redirects; | ||
drop table domains; | ||
} | ||
end | ||
|
||
end |
There was a problem hiding this comment.
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?