fix remove permissoins of users for repository, write tests for it