class Share
Public Instance Methods
add_htaccess()
click to toggle source
# File Entities/Share.rb, line 96 def add_htaccess if File.exists? path File.open("#{path}/.htaccess", "w") { |f| f << "AuthType Basic AuthName 'Restricted Access' AuthUserFile '#{path}/.htpasswd' Require valid-user " } File.exists? passfile = "#{path}/.htpasswd" and FileUtils.rm passfile if acl.class == Hash acl.each { |k, v| dputs(4) { "Adding #{k} to htpasswd" } case v when /rw|ro/ dputs(4) { "Really adding #{k} to #{passfile}" } user = Persons.find_by_login_name(k) System.run_str("/usr/bin/htpasswd -bnd #{user.login_name} '#{user.password_plain }' >> #{passfile}") end } end end end
setup_instance()
click to toggle source
# File Entities/Share.rb, line 90 def setup_instance if not self.acl self.acl = {} end end