trace = Trace.find(params[:id])
if trace.visible? and (trace.public? or (@user and @user == trace.user))
- if Acl.match(request.remote_ip).where(:k => "no_trace_download").exists?
+ if Acl.no_trace_download(request.remote_ip)
render :nothing => true, :status => :forbidden
elsif request.format == Mime::XML
send_file(trace.xml_file, :filename => "#{trace.id}.xml", :type => Mime::XML.to_s, :disposition => 'attachment')
else
render :action => 'terms'
end
- elsif params[:user] and Acl.match(request.remote_ip, params[:user][:email].split("@").last).where(:k => "no_account_creation").exists?
+ elsif params[:user] and Acl.no_account_creation(request.remote_ip, params[:user][:email].split("@").last)
render :action => 'blocked'
else
session[:referer] = params[:referer]
else
redirect_to :action => :account, :display_name => @user.display_name
end
- elsif Acl.match(request.remote_ip, params[:user][:email].split("@").last).where(:k => "no_account_creation").exists?
+ elsif Acl.no_account_creation(request.remote_ip, params[:user][:email].split("@").last)
render :action => 'blocked'
else
@user = User.new(params[:user])
:openid_url => params[:openid])
flash.now[:notice] = t 'user.new.openid association'
- elsif Acl.match(request.remote_ip).where(:k => "no_account_creation").exists?
+ elsif Acl.no_account_creation(request.remote_ip)
render :action => 'blocked'
end
end
condition = Acl.where("address >> ?", address)
end
end
+
+ def self.no_account_creation(address, domain = nil)
+ self.match(address, domain).where(:k => "no_account_creation").exists?
+ end
+
+ def self.no_trace_download(address, domain = nil)
+ self.match(address, domain).where(:k => "no_trace_download").exists?
+ end
end