prepare rewrite permission system