mirror of
https://github.com/internetee/registry.git
synced 2025-08-05 17:28:18 +02:00
Refactor EPP users to API users
This commit is contained in:
parent
b8494993ea
commit
c91c9c8ebf
44 changed files with 154 additions and 150 deletions
|
@ -29,7 +29,7 @@ class Ability
|
|||
can :manage, ZonefileSetting
|
||||
can :manage, DomainVersion
|
||||
can :manage, User
|
||||
can :manage, EppUser
|
||||
can :manage, ApiUser
|
||||
can :manage, Keyrelay
|
||||
can :manage, LegalDocument
|
||||
can :read, ApiLog::EppLog
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# rubocop: disable Metrics/ClassLength
|
||||
class EppUser < ActiveRecord::Base
|
||||
class ApiUser < ActiveRecord::Base
|
||||
# TODO: should have max request limit per day
|
||||
belongs_to :registrar
|
||||
has_many :contacts
|
|
@ -7,7 +7,7 @@ module UserEvents
|
|||
return [] unless registrar
|
||||
@events = []
|
||||
registrar.users.each { |user| @events << user_events(user.id) }
|
||||
registrar.epp_users.each { |user| @events << epp_user_events(user.id) }
|
||||
registrar.api_users.each { |user| @events << epp_user_events(user.id) }
|
||||
@events
|
||||
end
|
||||
|
||||
|
@ -16,7 +16,7 @@ module UserEvents
|
|||
end
|
||||
|
||||
def epp_user_events(id)
|
||||
where(whodunnit: "#{id}-EppUser")
|
||||
where(whodunnit: "#{id}-ApiUser")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,8 +11,8 @@ class Contact < ActiveRecord::Base
|
|||
has_many :statuses, class_name: 'ContactStatus'
|
||||
|
||||
# TODO: remove the x_by
|
||||
belongs_to :created_by, class_name: 'EppUser', foreign_key: :created_by_id
|
||||
belongs_to :updated_by, class_name: 'EppUser', foreign_key: :updated_by_id
|
||||
belongs_to :created_by, class_name: 'ApiUser', foreign_key: :created_by_id
|
||||
belongs_to :updated_by, class_name: 'ApiUser', foreign_key: :updated_by_id
|
||||
belongs_to :registrar
|
||||
|
||||
accepts_nested_attributes_for :address, :disclosure
|
||||
|
|
|
@ -2,7 +2,7 @@ class Registrar < ActiveRecord::Base
|
|||
belongs_to :country
|
||||
has_many :domains, dependent: :restrict_with_error
|
||||
has_many :contacts, dependent: :restrict_with_error
|
||||
has_many :epp_users, dependent: :restrict_with_error
|
||||
has_many :api_users, dependent: :restrict_with_error
|
||||
has_many :messages
|
||||
|
||||
validates :name, :reg_no, :address, :country, presence: true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue