Class: RubyACL::ACLSQLLookup
Overview
Does a check using an active record lookup on a database
Class Method Summary collapse
Instance Method Summary collapse
-
#check(context) ⇒ Object
it is assumed that if any rows are returned by statement that the check passes, context is passed in once against @statement.
-
#initialize(data) ⇒ ACLSQLLookup
constructor
data
is an SQL statement that is passed to ActiveRecord, any ?‘s in the statement are replaced withcontext[:identifier]
during check().
Constructor Details
#initialize(data) ⇒ ACLSQLLookup
data
is an SQL statement that is passed to ActiveRecord, any ?‘s in the statement are replaced with context[:identifier]
during check()
279 280 281 |
# File 'lib/rubyacl.rb', line 279 def initialize(data) @statement = data.to_s() end |
Class Method Details
.acltype ⇒ Object
273 274 275 |
# File 'lib/rubyacl.rb', line 273 def ACLSQLLookup.acltype() return('sqllookup') end |
Instance Method Details
#check(context) ⇒ Object
it is assumed that if any rows are returned by statement that the check passes, context is passed in once against @statement
286 287 288 289 290 291 292 293 |
# File 'lib/rubyacl.rb', line 286 def check(context) records = ActiveRecord::Base.find_by_sql([@statement, context[:identifier]]) if(records.length > 0) return true else return false end end |