Add test cases for CurrentUserPermissionManager, modify the class and some others to make this test set runnable