- database[:permissions][user] = DATABASE_PRIVILEGES.each_with_object([]) do |privileges, privilege|
- privileges << privilege if record["#{privilege}_priv".to_sym] == "Y"
- end
+ next unless database
+
+ user = "'#{record[:user]}'@'#{record[:host]}'"
+
+ database[:permissions][user] = DATABASE_PRIVILEGES.each_with_object([]) do |privilege, privileges|
+ privileges << privilege if record["#{privilege}_priv".to_sym] == "Y"