add code for privilege checking.