Created
September 8, 2014 20:44
-
-
Save fabioperrella/21c1da9e90c6fc5bc3ec to your computer and use it in GitHub Desktop.
logando no admn do SMTP sem CAS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## substiuir o conteudo do arquivo admin/base_controller.rb pelo abaixo | |
class Admin::BaseController < InheritedResources::Base | |
extend Memoist | |
layout 'admin' | |
protect_from_forgery | |
before_filter :signin, :authenticate_admin!, :log_action | |
def only_employee | |
if not current_admin.employee? | |
reset_session | |
@url = URI::join(AppConfig.cas.login_url, 'logout') | |
@url.query = "service=#{URI.encode(new_admin_session_url)}" | |
render :unauthorized, status: 401, layout: false | |
end | |
end | |
def log_action | |
logger.info "[admin] Employee: #{current_admin.username}, action: #{params["controller"]}/#{params["action"]}, params: #{params}" | |
end | |
def signin | |
sign_in(Admin.first) if current_admin.nil? | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment