added setPermissions action, fixed caching issue, some refactoring