1
0
مراية لـ https://github.com/postalserver/postal.git تم المزامنة 2026-01-17 21:39:47 +00:00

only allow organizations to be managed by admins

هذا الالتزام موجود في:
Adam Cooke
2017-04-21 10:18:24 +01:00
الأصل 90b90577cf
التزام 46daca9aa7
10 ملفات معدلة مع 70 إضافات و119 حذوفات

عرض الملف

@@ -1,10 +0,0 @@
class Admin::OrganizationsController < ApplicationController
before_action :admin_required
before_action { params[:id] && @organization = Organization.find_by_permalink!(params[:id]) }
def index
@organizations = Organization.order(:created_at => :desc).includes(:owner).page(params[:page])
end
end

عرض الملف

@@ -1,10 +0,0 @@
class Admin::StatsController < ApplicationController
before_action :admin_required
def stats
@stats = Statistic.global
@queue_size = QueuedMessage.unlocked.retriable.count
end
end

عرض الملف

@@ -1,11 +1,16 @@
class OrganizationsController < ApplicationController
before_action :admin_required, :only => [:new, :create]
before_action :require_organization_admin, :only => [:edit, :update, :delete, :destroy]
def index
@organizations = current_user.organizations.present.order(:name).to_a
if @organizations.size == 1 && params[:nrd].nil?
redirect_to organization_root_path(@organizations.first)
if current_user.admin?
@organizations = Organization.present.order(:name).to_a
else
@organizations = current_user.organizations.present.order(:name).to_a
if @organizations.size == 1 && params[:nrd].nil?
redirect_to organization_root_path(@organizations.first)
end
end
end
@@ -17,7 +22,6 @@ class OrganizationsController < ApplicationController
@organization = Organization.new(params.require(:organization).permit(:name, :permalink))
@organization.owner = current_user
if @organization.save
@organization.users << current_user
redirect_to_with_json organization_root_path(@organization)
else
render_form_errors 'new', @organization