مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2026-01-19 22:29:47 +00:00
UI for admins to assign ip pools to servers
هذا الالتزام موجود في:
@@ -1,9 +1,16 @@
|
|||||||
class OrganizationIPPoolsController < ApplicationController
|
class OrganizationIPPoolsController < ApplicationController
|
||||||
|
|
||||||
include WithinOrganization
|
include WithinOrganization
|
||||||
|
before_action :admin_required, :only => [:assignments]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@ip_pools = organization.ip_pools.dedicated.order(:name)
|
@ip_pools = organization.ip_pools.dedicated.order(:name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def assignments
|
||||||
|
organization.ip_pool_ids = params[:ip_pools]
|
||||||
|
organization.save!
|
||||||
|
redirect_to [organization, :ip_pools], :notice => "Organization IP pools have been updated successfully"
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class ServersController < ApplicationController
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
extra_params = [:spam_threshold, :spam_failure_threshold, :postmaster_address]
|
extra_params = [:spam_threshold, :spam_failure_threshold, :postmaster_address]
|
||||||
extra_params += [:send_limit, :allow_sender, :log_smtp_data, :outbound_spam_threshold, :message_retention_days, :raw_message_retention_days, :raw_message_retention_size, :ip_pool_id] if current_user.admin?
|
extra_params += [:send_limit, :allow_sender, :log_smtp_data, :outbound_spam_threshold, :message_retention_days, :raw_message_retention_days, :raw_message_retention_size] if current_user.admin?
|
||||||
if @server.update(safe_params(*extra_params))
|
if @server.update(safe_params(*extra_params))
|
||||||
redirect_to_with_json organization_server_path(organization, @server), :notice => "Server settings have been updated"
|
redirect_to_with_json organization_server_path(organization, @server), :notice => "Server settings have been updated"
|
||||||
else
|
else
|
||||||
@@ -84,7 +84,7 @@ class ServersController < ApplicationController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def safe_params(*extras)
|
def safe_params(*extras)
|
||||||
params.require(:server).permit(:name, :mode, :ip_pool_id, *extras)
|
params.require(:server).permit(:name, :mode, *extras)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,7 +10,22 @@
|
|||||||
|
|
||||||
= render 'organizations/nav', :active_nav => :ips
|
= render 'organizations/nav', :active_nav => :ips
|
||||||
= render 'nav', :active_nav => :ips
|
= render 'nav', :active_nav => :ips
|
||||||
|
|
||||||
.pageContent.pageContent--compact
|
.pageContent.pageContent--compact
|
||||||
|
- if current_user.admin?
|
||||||
|
%p.pageContent__intro.u-margin
|
||||||
|
Choose which IP pools this organization will have access to send mail using. Organization
|
||||||
|
users will be able to choose from any of the pools chosen below. Admins can override on a per
|
||||||
|
server basis if required.
|
||||||
|
= form_tag [:assignments, @organization, :ip_pools], :method => :put do
|
||||||
|
%ul.checkboxList.u-margin
|
||||||
|
- for ip_pool in IPPool.order(:name)
|
||||||
|
%li.checkboxList__item
|
||||||
|
.checkboxList__checkbox= check_box_tag "ip_pools[]", ip_pool.id, @organization.ip_pools.include?(ip_pool), :id => "ip_pool_#{ip_pool.id}"
|
||||||
|
.checkboxList__label
|
||||||
|
= label_tag "ip_pool_#{ip_pool.id}", ip_pool.name, :class => 'checkboxList__actualLabel'
|
||||||
|
%p= submit_tag "Save IP pool assignment", :class => 'button button--positive'
|
||||||
|
- else
|
||||||
- if @ip_pools.empty?
|
- if @ip_pools.empty?
|
||||||
.noData.noData--koala.noData--clean
|
.noData.noData--koala.noData--clean
|
||||||
- if @server.nil?
|
- if @server.nil?
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
e-mail will be routed normally to the intended recipients. When in <b>Development</b> mode,
|
e-mail will be routed normally to the intended recipients. When in <b>Development</b> mode,
|
||||||
outgoing & incoming mail will be held and only visible in the web interface and will not be
|
outgoing & incoming mail will be held and only visible in the web interface and will not be
|
||||||
sent to any recipients or HTTP endpoints.
|
sent to any recipients or HTTP endpoints.
|
||||||
|
|
||||||
.fieldSet__field
|
.fieldSet__field
|
||||||
= f.label :ip_pool_id, :class => 'fieldSet__label'
|
= f.label :ip_pool_id, :class => 'fieldSet__label'
|
||||||
.fieldSet__input
|
.fieldSet__input
|
||||||
|
|||||||
@@ -30,9 +30,6 @@
|
|||||||
.fieldSet__field
|
.fieldSet__field
|
||||||
= f.label :raw_message_retention_size, :class => 'fieldSet__label'
|
= f.label :raw_message_retention_size, :class => 'fieldSet__label'
|
||||||
.fieldSet__input= f.text_field :raw_message_retention_size, :class => 'input input--text'
|
.fieldSet__input= f.text_field :raw_message_retention_size, :class => 'input input--text'
|
||||||
.fieldSet__field
|
|
||||||
= f.label :ip_pool_id, :class => 'fieldSet__label'
|
|
||||||
.fieldSet__input= f.collection_select :ip_pool_id, IPPool.order(:name), :id, :name, {}, :class => 'input input--select'
|
|
||||||
|
|
||||||
.fieldSetSubmit.fieldSetSubmit--wide.buttonSet
|
.fieldSetSubmit.fieldSetSubmit--wide.buttonSet
|
||||||
= f.submit "Save server", :class => 'button button--positive js-form-submit'
|
= f.submit "Save server", :class => 'button button--positive js-form-submit'
|
||||||
|
|||||||
@@ -60,7 +60,9 @@ Rails.application.routes.draw do
|
|||||||
post :make_owner, :on => :member
|
post :make_owner, :on => :member
|
||||||
end
|
end
|
||||||
resources :ip_pool_rules
|
resources :ip_pool_rules
|
||||||
resources :ip_pools, :controller => 'organization_ip_pools'
|
resources :ip_pools, :controller => 'organization_ip_pools' do
|
||||||
|
put :assignments, :on => :collection
|
||||||
|
end
|
||||||
root 'servers#index'
|
root 'servers#index'
|
||||||
get 'settings' => 'organizations#edit'
|
get 'settings' => 'organizations#edit'
|
||||||
patch 'settings' => 'organizations#update'
|
patch 'settings' => 'organizations#update'
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم