Added unit test for permission control.