Sha256: afa08454cdf551adb7b8aa6950be177698e1e8613845604302b32ec497d0b48e

Contents?: true

Size: 693 Bytes

Versions: 12

Compression:

Stored size: 693 Bytes

Contents

class User
  include DataMapper::Resource

  property :id,     Serial
  property :name,   String
  
  has n, :keys
  has n, :groups
  has n, :grants
  
  belongs_to :map, :required => false
  
  def authorized_keys_file
    authorized_keys = self.keys.inject('') do |authorized_keys, key|
      authorized_keys << key.public_key
    end
    
    raise "User #{self.name} has a blank SSH key - this is not permitted" if authorized_keys.blank?
    authorized_keys  
  end
  
  def authorized_keys_file_path
    "/home/#{self.name}/.ssh/authorized_keys"
  end
  
  def home_directory_path
    "/home/#{self.name}/"
  end
  
  def ssh_config_directory_path
    "/home/#{self.name}/.ssh/"
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
fabric-0.4.3 lib/fabric/user.rb
fabric-0.4.2 lib/fabric/user.rb
fabric-0.4.1 lib/fabric/user.rb
fabric-0.4.0 lib/fabric/user.rb
fabric-0.3.6 lib/fabric/user.rb
fabric-0.3.5 lib/fabric/user.rb
fabric-0.3.4 lib/fabric/user.rb
fabric-0.3.3 lib/fabric/user.rb
fabric-0.3.2 lib/fabric/user.rb
fabric-0.3.1 lib/fabric/user.rb
fabric-0.3.0 lib/fabric/user.rb
fabric-0.2.0 lib/fabric/user.rb