lib/seek/permissions/policy_based_authorization.rb
def lookup_table_consistent? user_id
          unless user_id.is_a?(Numeric)
            user_id = user_id.nil? ? 0 : user_id.id
          end
          #cannot rely purely on the count, since an item could have been deleted and a new one added
          c = lookup_count_for_user user_id
          last_stored_asset_id = last_asset_id_for_user user_id
          last_asset_id = self.unscoped.last(:order=>:id).try(:id)

          #trigger off a full update for that user if the count is zero and items should exist for that type
          if (c==0 && !last_asset_id.nil?)
            AuthLookupUpdateJob.new.add_items_to_queue User.find_by_id(user_id)
          end
          c==count && (count==0 || (last_stored_asset_id == last_asset_id))
        end
#determines whether the lookup table records are consistent with the number of asset items in the database and the last id of the item added
determines whether the lookup table records are consistent with the number of asset items in the database and the last id of the item added
determines whether the lookup table records are consistent with the number of asset items in the database and the last id of the item added
def lookup_table_consistent? user_id
          unless user_id.is_a?(Numeric)
            user_id = user_id.nil? ? 0 : user_id.id
          end
          c = lookup_count_for_user user_id
          last_stored_asset_id = last_asset_id_for_user user_id
          last_asset_id = self.unscoped.last(:order=>:id).try(:id)
          if (c==0 && !last_asset_id.nil?)
            AuthLookupUpdateJob.new.add_items_to_queue User.find_by_id(user_id)
          end
          c==count && (count==0 || (last_stored_asset_id == last_asset_id))
        end
def lookup_table_consistent? user_id unless user_id . is_a? ( Numeric ) user_id = user_id . nil? ? 0 : user_id . id end c = lookup_count_for_user user_id last_stored_asset_id = last_asset_id_for_user user_id last_asset_id = self . unscoped . last ( :order => :id ) . try ( :id ) if ( c == 0 && ! last_asset_id . nil? ) AuthLookupUpdateJob . new . add_items_to_queue User . find_by_id ( user_id ) end c == count && ( count == 0 || ( last_stored_asset_id == last_asset_id ) ) end
determines whether the lookup table records are consistent with the number of asset items in the database and the last id of the item added
determines whether the lookup table records are consistent with the number of asset items in the database and the last id of the item added
#cannot rely purely on the count, since an item could have been deleted and a new one added #trigger off a full update for that user if the count is zero and items should exist for that type
user_id