Rbac Factory

This branch is based on #167