Merge branch 'master' of github.com:internetee/registry

Conflicts:
	db/schema.rb
This commit is contained in:
Andres Keskküla 2014-09-25 15:30:20 +03:00
commit 641522ff08
31 changed files with 513 additions and 30 deletions

View file

@ -4,9 +4,13 @@ class Ability
def initialize(user)
# user ||= EppUser.last
can :read, DomainTransfer, transfer_to_id: user.registrar.id
can :approve_as_client, DomainTransfer, transfer_from_id: user.registrar.id, status: DomainTransfer::PENDING
if user.admin?
can :manage, Domain
else
can :manage, Domain, registrar_id: user.registrar.id
can :read, DomainTransfer, transfer_to_id: user.registrar.id
can :approve_as_client, DomainTransfer, transfer_from_id: user.registrar.id, status: DomainTransfer::PENDING
end
# Define abilities for the passed in user here. For example:
#
# user ||= User.new # guest user (not logged in)

View file

@ -3,6 +3,7 @@ class Registrar < ActiveRecord::Base
has_many :domains
has_many :ns_sets
has_many :epp_users
has_many :users
has_many :domain_transfers, foreign_key: 'transfer_to_id'
def to_s

View file

@ -1,7 +1,11 @@
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :trackable, :timeoutable
# TODO Foreign user will get email with activation link,email,temp-password.
# After activisation, system should require to change temp password.
# TODO Estonian id validation
belongs_to :role
belongs_to :registrar
end