Fix permissions checking. Use archetypes instead of legacy.