modified script to get proper connection and show records form the rights table