moved permission migration from rake task to User#migrate_permissions!, added unit tests