lib/puppet/provider/macauthdb/default.rb
# Update the delegates_map table with the modified list of rules
Update the delegates_map table with the modified list of rules
Update the delegates_map table with the modified list of rules
def sql_update_delegates_map(dbconn, the_rule, delegates)
    delete = "DELETE FROM delegates_map WHERE r_id = ?"
    self.class.exec_sql_statement(dbconn, delete, the_rule['id'])
    unless delegates.empty?
      rules = delegates.map do |name|
        query = %Q{SELECT * FROM rules WHERE name = ?}
        self.class.exec_sql_statement(dbconn, query, the_rule['name']).first
      end
      mapping = "INSERT INTO delegates_map VALUES (?,?,?)"
      rules.each_with_index do |rule, i|
        row = [the_rule['id'], rule[0], i]
        self.class.exec_sql_statement(dbconn, mapping, row)
      end
    end
  end
def sql_update_delegates_map ( dbconn , the_rule , delegates ) delete = "DELETE FROM delegates_map WHERE r_id = ?" self . class . exec_sql_statement ( dbconn , delete , the_rule [ 'id' ] ) unless delegates . empty? rules = delegates . map do | name | query = %Q{SELECT * FROM rules WHERE name = ?} self . class . exec_sql_statement ( dbconn , query , the_rule [ 'name' ] ) . first end mapping = "INSERT INTO delegates_map VALUES (?,?,?)" rules . each_with_index do | rule , i | row = [ the_rule [ 'id' ] , rule [ 0 ] , i ] self . class . exec_sql_statement ( dbconn , mapping , row ) end end end
Update the delegates_map table with the modified list of rules
Update the delegates_map table with the modified list of rules
dbconn
the_rule
delegates