radar/forem — Issue #117: CanCan for Topic Deletion
Author: DamianPoor
Created: 2012-01-05 17:53:36+00:00
State: open

I'm trying to add the ability for certain privileged posters to delete topics.

I guess the easiest way to do this is to:

1. override the Ability class, defining a "can :destroy_topic, Forem::Forum" block
2. modify the view to check against this ability rather than the currently hardcoded comparison against forem_user and forem_admin?
3. Similarly, replace the logic in the topics_controller.rb to use CanCan's authorize function.

I can also provide a utility function can_delete_forum_topic?(), like the others described in the documentation.

Similarly, I suppose one could also do this for deleting posts, moving topics, pinning topics, etc.

This is nice, because then you can create finer-grained control over actions (e.g., have a "moderator" user who can delete/move/pin topics, but isn't allowed to create new forums or categories.)

Thoughts?