jam-cloud/ruby/lib/jam_ruby/models/icecast_sercurity.rb

41 lines
905 B
Ruby

module JamRuby
class IcecastSecurity < ActiveRecord::Base
include JAmXml
self.primary_key = 'id'
attr_accessible :chroot, :changeowner_user, :changeowner_group
validates :chroot, numericality: {only_integer: true}, length: {in: 0..1}
def dumpXml (ident=1, output=$stdout)
tb = "\t"
tbs = tb * (ident)
tbs2 = tb * (ident+1)
tbse = tb * (ident-1)
if tbse.empty? || tbse.nil?
tbse=""
end
nm = "security"
output.puts "#{tbse}<#{nm}>"
output.puts "#{tbs}<chroot>#{self.chroot}</chroot>"
output.puts "#{tbs}<changeowner>"
v = jMakeStrXmlSafe(self.changeowner_user)
output.puts "#{tbs2}<user>#{v}</user>"
v = jMakeStrXmlSafe(self.changeowner_group)
output.puts "#{tbs2}<group>#{v}</group>"
output.puts "#{tbs}<changeowner>"
output.puts "#{tbse}</#{nm}>"
end
end
end