Class: IISConfig::FtpSite
- Defined in:
- lib/iisconfig/ftp_site.rb
Instance Method Summary collapse
- #add ⇒ Object
- #allow_authorization(permissions, access) ⇒ Object
- #allow_ssl ⇒ Object
- #app_pool(pool) ⇒ Object
- #binding(binding) ⇒ Object
- #build_commands ⇒ Object
- #delete ⇒ Object
- #enable_authentication(*authentication) ⇒ Object
-
#initialize ⇒ FtpSite
constructor
A new instance of FtpSite.
- #name(name = nil) ⇒ Object
- #physical_path(path) ⇒ Object
- #required_paths ⇒ Object
Methods inherited from IISObject
Constructor Details
#initialize ⇒ FtpSite
Returns a new instance of FtpSite.
8 9 10 11 12 |
# File 'lib/iisconfig/ftp_site.rb', line 8 def initialize @bindings = [] @authentication = [] @allow_authorization = [] end |
Instance Method Details
#add ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/iisconfig/ftp_site.rb', line 47 def add args = [] args << 'ADD' args << 'SITE' args << "/name:#{@name}" args << "/bindings:\"#{@bindings.join('","')}\"" args << "/physicalPath:\"#{@physical_path.gsub(/\//, '\\')}\"" args end |
#allow_authorization(permissions, access) ⇒ Object
35 36 37 |
# File 'lib/iisconfig/ftp_site.rb', line 35 def (, access) @allow_authorization << { :permissions => , :access => access } end |
#allow_ssl ⇒ Object
39 40 41 |
# File 'lib/iisconfig/ftp_site.rb', line 39 def allow_ssl @ssl = :allow end |
#app_pool(pool) ⇒ Object
23 24 25 |
# File 'lib/iisconfig/ftp_site.rb', line 23 def app_pool(pool) @app_pool = pool end |
#binding(binding) ⇒ Object
19 20 21 |
# File 'lib/iisconfig/ftp_site.rb', line 19 def binding(binding) @bindings << binding end |
#build_commands ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/iisconfig/ftp_site.rb', line 64 def build_commands() commands = [] commands << delete if exist? :site, @name commands << add commands << %W{SET SITE /site.name:#{@name} /[path='/'].applicationPool:#{@app_pool}} unless @app_pool.nil? @allow_authorization.each do |a| = a[:permissions].map { |p| p.capitalize }.join(',') roles = a[:access][:roles] users = a[:access][:users] commands << %W{SET CONFIG #{@name} /section:system.ftpserver/security/authorization /+[accessType='Allow',permissions='#{}',roles='#{roles}',users='#{users}'] /commit:apphost} end @authentication.each do |a| commands << %W{SET CONFIG -section:system.applicationHost/sites /[name='#{@name}'].ftpServer.security.authentication.#{a}Authentication.enabled:true} end unless @ssl.nil? commands << %W{SET CONFIG -section:system.applicationHost/sites /[name='#{@name}'].ftpServer.security.ssl.controlChannelPolicy:"Ssl#{@ssl.capitalize}"} commands << %W{SET CONFIG -section:system.applicationHost/sites /[name='#{@name}'].ftpServer.security.ssl.dataChannelPolicy:"Ssl#{@ssl.capitalize}"} end commands end |
#delete ⇒ Object
43 44 45 |
# File 'lib/iisconfig/ftp_site.rb', line 43 def delete %W{DELETE SITE #{@name}} end |
#enable_authentication(*authentication) ⇒ Object
31 32 33 |
# File 'lib/iisconfig/ftp_site.rb', line 31 def enable_authentication(*authentication) @authentication += authentication end |
#name(name = nil) ⇒ Object
14 15 16 17 |
# File 'lib/iisconfig/ftp_site.rb', line 14 def name(name = nil) @name = name unless name.nil? @name end |
#physical_path(path) ⇒ Object
27 28 29 |
# File 'lib/iisconfig/ftp_site.rb', line 27 def physical_path(path) @physical_path = path end |
#required_paths ⇒ Object
58 59 60 61 62 |
# File 'lib/iisconfig/ftp_site.rb', line 58 def required_paths paths = [] paths << @physical_path paths end |