]> git.openstreetmap.org Git - rails.git/commit
separate ability and capability
authorChris Flipse <cflipse@gmail.com>
Sun, 17 Jun 2018 17:15:49 +0000 (13:15 -0400)
committerChris Flipse <cflipse@gmail.com>
Sun, 17 Jun 2018 17:57:32 +0000 (13:57 -0400)
commit91fc65a2e3ad47414344a6d5dc03cb5fb2a08ce1
treea6b04beae4a6d1067da79f38cb40457edebb6293
parent4d20a2c96a3ff722071e7b1093d260b1236b2eeb
separate ability and capability

These are asking fundamentally different questions;

Abilities are asking the application if the user has a role that allows
the user to take a certain action
Capabilities are asking if the user has granted the application to
perform a certain type of action

CanCanCan makes no distinction, however, so the `granted_capabilities`
method is provided as a point that can be checked in rescue methods, so
that one can _attempt_ to continue to provide the more informative error
messages around permission refusals
app/controllers/application_controller.rb
app/models/ability.rb
app/models/capability.rb [new file with mode: 0644]
test/models/abilities_test.rb
test/models/capability_test.rb [new file with mode: 0644]