rmails 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +15 -0
  4. data/Vagrantfile +1 -1
  5. data/app/assets/javascripts/controls/domains.coffee.erb +68 -75
  6. data/app/assets/javascripts/models/domain.coffee.erb +4 -3
  7. data/app/assets/stylesheets/application.sass +5 -13
  8. data/app/assets/stylesheets/base.css.sass +0 -4
  9. data/app/controllers/domains_controller.rb +1 -1
  10. data/app/models/virtual_domain.rb +6 -0
  11. data/app/models/virtual_user.rb +2 -2
  12. data/app/views/admin_users/first.html.haml +0 -1
  13. data/app/views/aliases/_templates.html.haml +29 -0
  14. data/app/views/domains/_templates.html.haml +71 -0
  15. data/app/views/domains/index.html.haml +9 -114
  16. data/app/views/users/_form.html.haml +4 -2
  17. data/app/views/users/_templates.html.haml +27 -0
  18. data/bin/rmails +14 -5
  19. data/config/locales/server/help/dovecot/cz.yml +4 -2
  20. data/config/locales/server/key/dovecot/en.yml +17 -17
  21. data/config/locales/views/aliases/cz.yml +3 -1
  22. data/config/locales/views/aliases/en.yml +20 -0
  23. data/config/locales/views/domains/cz.yml +1 -1
  24. data/config/locales/views/domains/en.yml +11 -10
  25. data/config/locales/views/server/cz.yml +1 -0
  26. data/config/locales/views/users/cz.yml +8 -2
  27. data/config/locales/views/users/en.yml +22 -0
  28. data/db/migrate/20121112201341_virtual_user.rb +0 -8
  29. data/lib/rmails/installer.rb +12 -3
  30. data/lib/rmails/version.rb +2 -2
  31. data/public/assets/{application-83367ef0d1b7ecb80fbc1ba279811151.js → application-3b8b925cdaedaadcce73613bb5c35985.js} +1 -1
  32. data/public/assets/{application-83367ef0d1b7ecb80fbc1ba279811151.js.gz → application-3b8b925cdaedaadcce73613bb5c35985.js.gz} +0 -0
  33. data/public/assets/application-ab23db04de6609ba65d1ee5a378d5735.css +1 -0
  34. data/public/assets/{application-7b6b5d175d26fb23a5584728dc35220f.css.gz → application-ab23db04de6609ba65d1ee5a378d5735.css.gz} +0 -0
  35. data/public/assets/application.css +1 -1
  36. data/public/assets/application.css.gz +0 -0
  37. data/public/assets/application.js +1 -1
  38. data/public/assets/application.js.gz +0 -0
  39. data/public/assets/manifest.yml +26 -26
  40. data/system/dist/rmails/Gemfile.2 +1 -0
  41. metadata +10 -6
  42. data/public/assets/application-7b6b5d175d26fb23a5584728dc35220f.css +0 -1
@@ -6,10 +6,8 @@
6
6
  $(document).ready(function() { new window.Domains('#content', {}); });
7
7
 
8
8
 
9
- = link_to new_domain_path, :class => 'add-domain btn btn-large btn-inverse' do
9
+ = link_to '#!new', :class => 'add-domain btn btn-large btn-inverse' do
10
10
  %span= t '.create'
11
- = link_to '#', :class => 'rm-domain btn btn-large btn-danger dn' do
12
- %span= t '.reset'
13
11
 
14
12
  %ul#domains.list
15
13
  - @domains.each do |domain|
@@ -17,120 +15,17 @@
17
15
  .item
18
16
  .iconat @
19
17
  .btn-group
20
- = link_to t(".delete"), domain_path(domain), :method => :delete, :confirm => t(".confirm"), :class => 'label label-warning delete'
18
+ = link_to t(".edit"), "#!edit/#{domain.id}", :class => 'label edit'
19
+ = link_to t(".delete"), "#!delete/#{domain.id}", :'data-msg' => t(".confirm"), :class => 'label label-warning rm'
21
20
  .item-content
22
- = link_to domain.name, domain_path(domain), :class => 'item-label'
23
- -#= link_to t(".edit"), edit_domain_path(domain), :class => 'label edit'
24
- = link_to t(".manage"), domain_path(domain), :class => 'label label-info manage', :'data-inverse' => t(".nomanage")
21
+ = link_to domain.name, "#!show/#{domain.id}", :class => 'item-label'
22
+ = link_to t(".manage"), "#!show/#{domain.id}", :class => 'label label-info manage'
23
+ = link_to t(".nomanage"), "#!hide/#{domain.id}", :class => 'label dn nomanage'
25
24
 
26
25
 
27
26
  #domains_JSON.dn= @domains.to_json(:include => [:virtual_users, :virtual_aliases])
28
27
 
29
-
30
-
31
28
  #EJS.dn
32
- %script#domain_form_EJS{"type" => "text/ejs"}
33
- %li.empty
34
- .item
35
- .iconat @
36
- = render :partial => 'form', :locals => { :domain => domain_ejs_object }
37
- .out
38
-
39
- %script#domain_edit_EJS{"type" => "text/ejs"}
40
- .iconat @
41
- = render :partial => 'form', :locals => { :domain => domain_ejs_object }
42
- .out
43
-
44
- %script#domain_item_EJS{"type" => "text/ejs"}
45
- .iconat @
46
- .btn-group
47
- = link_to t(".delete"), domain_path('{id}'), :method => :delete, :confirm => t(".confirm"), :class => 'label label-warning delete'
48
- .item-content
49
- %a{:href => "", :class => "item-label"}
50
- :plain
51
- <%= item.attr('name') %>
52
- = link_to t(".manage"), domain_path('{id}'), :class => 'label label-info manage', :'data-inverse' => t(".nomanage")
53
-
54
- %script#errors_EJS{"type" => "text/ejs"}
55
- .errors
56
- %h6= t('.errors')
57
- :plain
58
- <% for (attr in errors) { %>
59
- <% list (errors[attr], function(error) { %>
60
- <p><%= error %></p>
61
- <% }) %>
62
- <% } %>
63
-
64
- %script#manage_area_EJS{"type" => "text/ejs"}
65
- .item-content.out.row-fluid
66
- .span5.users
67
- %h4
68
- %span.title= t('users.index.title')
69
- %span.dn.title_new= t('users.index.title_new')
70
- %span.dn.title_edit= t('users.index.title_edit')
71
- .label-info.label.new-user=t 'users.form.create'
72
- %table.table.table-condensed
73
- .span5.aliases
74
- %h4
75
- %span.title= t('aliases.index.title')
76
- %span.dn.title_new= t('aliases.index.title_new')
77
- %span.dn.title_edit= t('aliases.index.title_edit')
78
- .label-info.label.new-alias=t 'aliases.form.create'
79
- %table.table.table-condensed
80
-
81
- %script#aliass_each_EJS{"type" => "text/ejs"}
82
- :plain
83
- <% list (items, function(item, index) { %>
84
- <tr id="alias_<%= index %>">
85
- %td.tar
86
- :plain
87
- <%= item.source %>
88
- %td
89
- %b
90
- :plain
91
- @<%= domain_name %>
92
- %i.icon-hand-right
93
- %td
94
- :plain
95
- <%= item.destination %>
96
- %td.tar
97
- = link_to t(".edit"), edit_domain_alias_path('{domain_id}', '{id}'), :class => 'label edit-alias'
98
- = link_to "&times;".html_safe, domain_alias_path('{domain_id}', '{id}'), :class => 'rm-alias', :title => t(".delete")
99
- :plain
100
- </tr>
101
- <% }) %>
102
-
103
- %script#aliass_tabr_EJS{"type" => "text/ejs"}
104
- %tr.new
105
-
106
- %script#aliass_form_EJS{"type" => "text/ejs"}
107
- %td{:colspan => "4"}
108
- = render :partial => '/aliases/form', :locals => { :virtual_alias => alias_ejs_object }
109
-
110
- %script#vusers_each_EJS{"type" => "text/ejs"}
111
- :plain
112
- <% list (items, function(item, index) { %>
113
- <tr id="user_<%= index %>">
114
- %td
115
- %i.icon-inbox
116
- :plain
117
- <%= item.email %>@<%= domain_name %>
118
- %td
119
- %i.icon-user
120
- :plain
121
- <%= item.name %>
122
- %td.tar
123
- = link_to t(".edit"), edit_domain_user_path('{domain_id}', '{id}'), :class => 'label edit-user'
124
- = link_to "&times;".html_safe, domain_user_path('{domain_id}', '{id}'), :class => 'rm-user', :title => t(".delete")
125
-
126
- :plain
127
- </tr>
128
- <% }) %>
129
-
130
- %script#vusers_tabr_EJS{"type" => "text/ejs"}
131
- %tr.new
132
-
133
- %script#vusers_form_EJS{"type" => "text/ejs"}
134
- %td{:colspan => "4"}
135
- = render :partial => '/users/form', :locals => { :virtual_user => user_ejs_object }
136
-
29
+ = render :partial => '/domains/templates'
30
+ = render :partial => '/aliases/templates'
31
+ = render :partial => '/users/templates'
@@ -1,9 +1,11 @@
1
- = simple_form_for virtual_user, :url => domain_users_path(@domain||'{domain_id}'), :method => :post do |f|
1
+ = simple_form_for virtual_user, :url => domain_users_path(@domain||'{domain_id}'), :method => :post, :html => { :class => 'form-horizontal'} do |f|
2
2
 
3
3
  = f.input :name, :label => t('.name')
4
4
  = f.input :email, :label => t('.email')
5
5
  = f.input :password, :label => t('.password')
6
- = f.input :password_confirmation, :label => t('.password_confirmation')
6
+
7
+ = f.input :quota_kb, :label => t('.quota_kb'), :hint => t('.no_limit')
8
+ = f.input :quota_messages, :label => t('.quota_messages'), :hint => t('.no_limit')
7
9
 
8
10
  .actions
9
11
  = f.button :button, t('.submit'), :type => 'submit', :class => 'btn-primary right'
@@ -0,0 +1,27 @@
1
+ %script#vusers_each_EJS{"type" => "text/ejs"}
2
+ :plain
3
+ <% list (items, function(item, index) { %>
4
+ <tr id="user_<%= index %>">
5
+ %td
6
+ %i.icon-inbox
7
+ :plain
8
+ <%= item.email %>@<%= domain_name %>
9
+ %td
10
+ %i.icon-user
11
+ :plain
12
+ <%= item.name %>
13
+ %td.tar
14
+ = link_to t(".edit"), edit_domain_user_path('{domain_id}', '{id}'), :class => 'label edit-user'
15
+ = link_to "&times;".html_safe, domain_user_path('{domain_id}', '{id}'), :class => 'rm-user', :title => t(".delete")
16
+
17
+ :plain
18
+ </tr>
19
+ <% }) %>
20
+
21
+ %script#vusers_tabr_EJS{"type" => "text/ejs"}
22
+ %tr.new
23
+
24
+ %script#vusers_form_EJS{"type" => "text/ejs"}
25
+ %td{:colspan => "4"}
26
+ = render :partial => '/users/form', :locals => { :virtual_user => user_ejs_object }
27
+
data/bin/rmails CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- #/ Usage: rmails action
2
+ #/ Usage: rmails action [options]
3
3
  #/
4
4
  #/ Actions:
5
5
  #/ --install
@@ -11,7 +11,10 @@
11
11
  #/ --stop-app
12
12
  #/ Stops server of configuration app.
13
13
  #/ You may have to be root to run this.
14
-
14
+ #/ Options:
15
+ #/ --clear
16
+ #/ Truncate data in database.
17
+ #/
15
18
 
16
19
  $stderr.sync = true
17
20
 
@@ -24,6 +27,8 @@ require 'rmails/runner'
24
27
  install = false
25
28
  start = false
26
29
  stop = false
30
+ clear = false
31
+
27
32
 
28
33
  # parse arguments
29
34
  file = __FILE__
@@ -31,22 +36,26 @@ ARGV.options do |opts|
31
36
  opts.on("--install") { |install| }
32
37
  opts.on("--start-app") { |start| }
33
38
  opts.on("--stop-app") { |stop| }
39
+ opts.on("--clear") { |clear| }
34
40
  opts.on_tail("-h", "--help") { exec "grep ^#/<'#{file}'|cut -c4-" }
35
41
  opts.parse!
36
42
  end
37
43
 
38
44
 
39
- if not(install or start or stop) or(start and stop)
45
+ if (start and stop) or
46
+ (install and (start or stop)) or
47
+ (not install and not start and not stop)
40
48
  exec "grep ^#/<'#{file}'|cut -c4-"
49
+ end # bug that helps to have better condition
41
50
 
42
51
  if install
43
- setup = Rmails::Installer.new
52
+ puts install
53
+ setup = Rmails::Installer.new({:clear => clear})
44
54
  setup.run
45
55
 
46
56
  elsif start
47
57
  app = Rmails::Runner.new
48
58
  app.start
49
- end
50
59
 
51
60
  elsif stop
52
61
  app = Rmails::Runner.new
@@ -6,8 +6,7 @@ cz:
6
6
  auth_worker_max_count: Maximum number of dovecot-auth worker processes. They're used to execute blocking passdb and userdb queries (eg. MySQL and PAM). They're automatically created and destroyed as needed.
7
7
  auth_mechanisms: Space separated list of wanted authentication mechanisms (plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi otp skey gss-spnego).
8
8
  auth_verbose: Log unsuccessful authentication attempts and the reasons why they failed.
9
- mail_cache_min_mail_count: The minimum number of mails in a mailbox before updates are done to cache file. This allows optimizing Dovecot's behavior to do less disk writes at the cost of more disk reads.
10
-
9
+ mail_cache_min_mail_count: Minimální počet zpráv ve schránce, který předchází aktualizaci souboru mezipaměti. Jedná se o optimalizaci pro menší počet zápisů na disk za cenu většího počtu čtení z disku.
11
10
  postmaster_address: Address to use when sending rejection mails.
12
11
 
13
12
  quota_full_tempfail: If user is over quota, return with temporary failure instead of bouncing the mail.
@@ -16,6 +15,9 @@ cz:
16
15
  rejection_reason: Human readable error message for rejection mails.
17
16
  rejection_variables: "%n = CRLF, %r = reason, %s = original subject, %t = recipient"
18
17
 
18
+ storage_size: Maximální velikost pro doručenou poštu.
19
+ storage_trash: Maximální velikost pro dočasné uložení smazaných zpráv. Připočítává se k celkové velikosti schránky.
20
+ storage_spam: Maximální velikost pro nevyžádanou poštu. Připočítává se k celkové velikosti schránky.
19
21
 
20
22
 
21
23
 
@@ -1,20 +1,20 @@
1
1
  en:
2
2
  server:
3
3
  key:
4
- disable_plaintext_auth:
5
- auth_username_chars:
6
- auth_worker_max_count:
7
- auth_verbose:
8
- mail_cache_min_mail_count:
9
- imap_login__listener__port:
10
- imaps_login__listener__port:
11
- pop3_login_listener_port:
12
- pop3s_login__listener__port:
13
- imap__process_limit:
14
- pop3__process_limit:
15
- quota_full_tempfail:
16
- rejection_subject:
17
- rejection_reason:
18
- storage_size:
19
- storage_trash:
20
- storage_spam:
4
+ disable_plaintext_auth: Disable authentication without encryption
5
+ auth_username_chars: Allowed characters in a user's name
6
+ auth_worker_max_count: Maximum number oflogin process
7
+ auth_verbose: Detailed loging of authentication
8
+ mail_cache_min_mail_count: Minimum number of emails before updating the cache
9
+ imap_login__listener__port: IMAP port
10
+ imaps_login__listener__port: IMAPs port
11
+ pop3_login_listener_port: POP3 port
12
+ pop3s_login__listener__port: POP3s port
13
+ imap__process_limit: Maximum number of connected IMAP clients
14
+ pop3__process_limit: Maximum number of connected POP3 clients
15
+ quota_full_tempfail: Notification method to a full mailbox
16
+ rejection_subject: Subject of rejection
17
+ rejection_reason: Reason for rejection
18
+ storage_size: Mailbox size
19
+ storage_trash: Size bin
20
+ storage_spam: Size SPAM
@@ -1,10 +1,12 @@
1
1
  cz:
2
2
  aliases:
3
+ templates:
4
+ delete: Odstranit
5
+ edit: Upravit
3
6
  index:
4
7
  title: Přesměrování
5
8
  title_new: Vytvořit nové přesměrování
6
9
  title_edit: Upravit přesměrování
7
- edit: Upravit
8
10
  delete: Odstranit
9
11
  create: Přidat přesměrování
10
12
  confirm: Opravdu chcete odstranit toto přesměrování?
@@ -1 +1,21 @@
1
1
  en:
2
+ aliases:
3
+ templates:
4
+ delete: Delete
5
+ edit: Edit
6
+ index:
7
+ title: Forwarding
8
+ title_new: Creating forwarding
9
+ title_edit: Editting forwarding
10
+ delete: Delete
11
+ create: Add new
12
+ confirm: This will be deleted. Are You sure?
13
+ errors: There were some input errors.
14
+ form:
15
+ source: What
16
+ destination: Where
17
+ create: Create
18
+ submit: Save
19
+ reset: Cancel
20
+ source_hint: Mailbox name or *
21
+ dest_hint: Separate emails with the Enter key
@@ -8,8 +8,8 @@ cz:
8
8
  nomanage: Skrýt
9
9
  create: Přidat doménu
10
10
  confirm: Opravdu chcete doménu odstranit?
11
- errors: Byly objeveny chybné vstupní hodnoty.
12
11
  form:
13
12
  name: Název domény
14
13
  create: Vytvořit doménu
15
14
  reset: Storno
15
+
@@ -1,15 +1,16 @@
1
1
  en:
2
2
  domains:
3
3
  index:
4
- title: Domény, schránky a přesměrování
5
- edit: Upravit
6
- delete: Odstranit
7
- manage: Zobrazit
8
- nomanage: Skrýt
9
- create: Přidat doménu
10
- confirm: Opravdu chcete doménu odstranit?
4
+ title: Domains, emails and forwarding
5
+ edit: Edit
6
+ delete: Delete
7
+ manage: Show
8
+ nomanage: Hide
9
+ create: Add domain
10
+ confirm: Do you really want to delete the domain?
11
11
  errors: Byly objeveny chybné vstupní hodnoty.
12
12
  form:
13
- name: Název domény
14
- create: Vytvořit doménu
15
- reset: Storno
13
+ name: Domain name
14
+ create: Create domain
15
+ reset: Cancel
16
+ no_limit: 0 is unlimited
@@ -23,6 +23,7 @@ cz:
23
23
  certificates: Certifikáty
24
24
 
25
25
  status:
26
+ warning: Varování
26
27
  save_info: Provedení změn na serveru
27
28
  submit_button: Aplikovat změny do nastavení serveru a restartovat služby
28
29
  unsaved_warning: Systém našel neuplatněné změny v nastavení. Oranžově označené nastavení má změněnou, ale neuloženou hodnotu.
@@ -4,8 +4,6 @@ cz:
4
4
  title: Schránky
5
5
  title_new: Vytvořit novou schránku
6
6
  title_edit: Upravit schránku
7
- edit: Upravit
8
- delete: Odstranit
9
7
  create: Přidat shcránku
10
8
  confirm: Opravdu chcete schránku odstranit?
11
9
 
@@ -16,4 +14,12 @@ cz:
16
14
  password_confirmation: Potvrzení hesla
17
15
  create: Vytvořit
18
16
  submit: Uložit
17
+ no_limit: 0 znamená neomezeno
19
18
  reset: Storno
19
+ quota_kb: Velikost schránky (B)
20
+ quota_messages: Limit počtu zpráv
21
+
22
+ templates:
23
+ delete: Odstranit
24
+ edit: Upravit
25
+
@@ -1 +1,23 @@
1
1
  en:
2
+ users:
3
+ index:
4
+ title: Users/Mailboxes
5
+ manage: Show
6
+ nomanage: Hide
7
+ create: Add new
8
+ confirm: This will be deleted. Are You sure?
9
+ errors: There were some input errors.
10
+ form:
11
+ name: Name
12
+ email: Email
13
+ password: Password
14
+ create: Create
15
+ submit: Save
16
+ reset: Cancel
17
+ no_limit: 0 is unlimited
18
+ quota_kb: Mailbox size quota
19
+ quota_messages: Messages count qouta
20
+ templates:
21
+ delete: Delete
22
+ edit: Edit
23
+
@@ -16,14 +16,6 @@ class VirtualUser < ActiveRecord::Migration
16
16
  t.string :reset_password_token
17
17
  t.datetime :reset_password_sent_at
18
18
 
19
- ## Trackable
20
- t.integer :sign_in_count, :default => 0
21
- t.datetime :current_sign_in_at
22
- t.datetime :last_sign_in_at
23
- t.string :current_sign_in_ip
24
- t.string :last_sign_in_ip
25
-
26
-
27
19
  t.integer :quota_kb, :default => 10485760 # 10M
28
20
  t.integer :quota_messages, :default => 0
29
21
 
@@ -7,9 +7,10 @@ end
7
7
 
8
8
  module Rmails
9
9
  class Installer
10
- def initialize
11
- @passwords = []
12
- @interpreter = AutomateIt.new(:project => "system")
10
+ def initialize(params={})
11
+ @passwords = params[:passwords]||[]
12
+ @clear = params[:clear]
13
+ @interpreter = AutomateIt.new(:project => "system")
13
14
  @interpreter.include_in(self)
14
15
  @interpreter.set :rake_task, Rake::Task
15
16
  @interpreter.set :rails_root, Rails.root
@@ -21,6 +22,11 @@ module Rmails
21
22
  Bundler.with_clean_env do
22
23
  @interpreter.shell_manager.sh("bundle install --without development assets")
23
24
  end
25
+ if @clear
26
+ puts '!! Going to TRUNCATE database'
27
+ else
28
+ @interpreter.shell_manager.sh("rake db:data:dump")
29
+ end
24
30
  @interpreter.invoke '02_setup_database'
25
31
  @interpreter.invoke '03_setup_postfix'
26
32
  @interpreter.invoke '04_setup_dovecot'
@@ -30,6 +36,9 @@ module Rmails
30
36
  @interpreter.invoke '08_setup_spamassassin'
31
37
  @interpreter.invoke '09_setup_awstats'
32
38
  @interpreter.invoke 'XX_start_services'
39
+ unless @clear
40
+ @interpreter.shell_manager.sh("rake db:data:load")
41
+ end
33
42
  end
34
43
  end
35
44
  end