مراية لـ
https://github.com/postalserver/postal.git
تم المزامنة 2025-12-01 05:43:04 +00:00
initial commit from appmail
هذا الالتزام موجود في:
38
app/controllers/credentials_controller.rb
Normal file
38
app/controllers/credentials_controller.rb
Normal file
@@ -0,0 +1,38 @@
|
||||
class CredentialsController < ApplicationController
|
||||
|
||||
include WithinOrganization
|
||||
|
||||
before_action { @server = organization.servers.present.find_by_permalink!(params[:server_id]) }
|
||||
before_action { params[:id] && @credential = @server.credentials.find_by_key!(params[:id]) }
|
||||
|
||||
def index
|
||||
@credentials = @server.credentials.order(:name).to_a
|
||||
end
|
||||
|
||||
def new
|
||||
@credential = @server.credentials.build
|
||||
end
|
||||
|
||||
def create
|
||||
@credential = @server.credentials.build(params.require(:credential).permit(:type, :name, :hold))
|
||||
if @credential.save
|
||||
redirect_to_with_json [organization, @server, :credentials]
|
||||
else
|
||||
render_form_errors 'new', @credential
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
if @credential.update(params.require(:credential).permit(:name, :hold))
|
||||
redirect_to_with_json [organization, @server, :credentials]
|
||||
else
|
||||
render_form_errors 'edit', @credential
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@credential.destroy
|
||||
redirect_to_with_json [organization, @server, :credentials]
|
||||
end
|
||||
|
||||
end
|
||||
المرجع في مشكلة جديدة
حظر مستخدم