I think you can use Role#add_permissions to simplify this
see https://github.com/theforeman/foreman/blob/develop/app/models/role.rb#L138