lib/rails-canhaz/extensions_subject.rb in rails-canhaz-0.1.2 vs lib/rails-canhaz/extensions_subject.rb in rails-canhaz-0.2.0
- old
+ new
@@ -47,9 +47,14 @@
# @return [Bool] True if the user has not the given permission, false otherwise
def cannot?(permission, object)
!self.can?(permission, object)
end
+ # Removes all permissions on the current subject
+ def can_do_nothing
+ CanHazPermission.destroy_all(['csubject_id = ? AND csubject_type = ?', self.id, self.class.to_s])
+ end
+
# Gets All objects that match a given type and permission
#
# @param type [Class] The type of the objects
# @param permission [String, Symbol] The name of the permission
# @return The macthing objects in an array