Some permissions refactoring