In certain unfortunate cases some permissions may not yet exist on the
app config, leading to a key error during permission setting or getting.
This could be treated as a migration or as a matter of course. This
patch treats it as a matter of course, and adds the appropriate
underlying permission if this was an add_perm (setting), or returns an
empty ACL if this was a query (getting).