added checks for object and user support to get_all_permissions
- restructure code for code-reuse