Fixed #20730 -- Fixed "Programmatically creating permissions" error.

Thanks glarrain for the report.