lib/seek/permissions/policy_based_authorization.rb
#looks up the entry in the authorization lookup table for a single authorised type, for a given action, user_id and asset_id. A user id of zero
#indicates an anonymous user. Returns nil if there is no record available
looks up the entry in the authorization lookup table for a single authorised type, for a given action, user_id and asset_id. A user id of zero
indicates an anonymous user. Returns nil if there is no record available
looks up the entry in the authorization lookup table for a single authorised type for a given action user_id and asset_id . A user id of zero indicates an anonymous user . Returns nil if there is no record available
def lookup_for_asset action,user_id,asset_id
          attribute = "can_#{action}"
          @@expected_true_value ||= ActiveRecord::Base.connection.quoted_true.gsub("'","")
          res = ActiveRecord::Base.connection.select_one("select #{attribute} from #{lookup_table_name} where user_id=#{user_id} and asset_id=#{asset_id}")
          if res.nil?
            nil
          else
            res[attribute].to_s==@@expected_true_value
          end
        end
def lookup_for_asset action , user_id , asset_id attribute = "can_#{action}" @@expected_true_value ||= ActiveRecord :: Base . connection . quoted_true . gsub ( "'" , "" ) res = ActiveRecord :: Base . connection . select_one ( "select #{attribute} from #{lookup_table_name} where user_id=#{user_id} and asset_id=#{asset_id}" ) if res . nil? nil else res [ attribute ] . to_s == @@expected_true_value end end
looks up the entry in the authorization lookup table for a single authorised type, for a given action, user_id and asset_id.
looks up the entry in the authorization lookup table for a single authorised type for a given action user_id and asset_id .
action
user_id
asset_id