30 lines
734 B
Ruby
30 lines
734 B
Ruby
module JamRuby
|
|
class IpBlacklist < ActiveRecord::Base
|
|
|
|
attr_accessible :remote_ip, :notes, as: :admin
|
|
|
|
@@log = Logging.logger[IpBlacklist]
|
|
|
|
validates :remote_ip, presence:true, uniqueness:true
|
|
|
|
def self.listed(remote_ip)
|
|
IpBlacklist.count(:conditions => "remote_ip = '#{remote_ip}'") == 1
|
|
end
|
|
|
|
def self.admin_url
|
|
APP_CONFIG.admin_root_url + "/admin/ip_blacklists/"
|
|
end
|
|
|
|
def self.admin_activity_url(remote_ip)
|
|
APP_CONFIG.admin_root_url + "/admin/download_trackers?q[remote_ip_equals]=#{URI.escape(remote_ip)}&commit=Filter&order=id_desc"
|
|
end
|
|
|
|
def admin_url
|
|
APP_CONFIG.admin_root_url + "/admin/ip_blacklists/" + id
|
|
end
|
|
|
|
def to_s
|
|
remote_ip
|
|
end
|
|
end
|
|
end |