Class: AdminUser

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/admin_user.rb

Instance Method Summary collapse

Instance Method Details

#be_super!Object



21
22
23
# File 'app/models/admin_user.rb', line 21

def be_super!
  self.super = true
end

#build_domain(params) ⇒ Object



37
38
39
40
41
# File 'app/models/admin_user.rb', line 37

def build_domain(params)
  domain = self.virtual_domains.build
  domain[:name] = params[:name]
  domain
end

#change_data(params) ⇒ Object



44
45
46
47
48
49
50
51
52
# File 'app/models/admin_user.rb', line 44

def change_data(params)
  success = if not params[:password].blank?
    update_with_password(params)
  else
    params.delete(:password)
    update_without_password(params)
  end
  return success
end

#domain(id) ⇒ Object



33
34
35
# File 'app/models/admin_user.rb', line 33

def domain(id)
  (self.super == true ? VirtualDomain : self.virtual_domains).find(id)
end

#domainsObject



25
26
27
28
29
30
31
# File 'app/models/admin_user.rb', line 25

def domains
  vd = self.super == true ? VirtualDomain.all : self.virtual_domains
  vd.each do |domain|
    VirtualUser.drop_domain_from_email_each(domain.virtual_users)
  end
  vd
end