You can only select roles which has certain permissions, but you cannot assign a certain permission to a role.
It may be more flexible if you can create new roles and add permissions, or modify existing role permissions with UI (something like a spreadsheet format and able to change settings by clicking)