Sha256: 87c541903947922f57c09f12bbe6f4a8648e7b3c729dbe8ccf3cf520c9f6e31e
Contents?: true
Size: 876 Bytes
Versions: 6
Compression:
Stored size: 876 Bytes
Contents
module RestfulAcl module Controller def self.included(base) base.extend(ClassMethods) base.send :include, ClassMethods end module ClassMethods def has_permission? options = { :controller_name => self.controller_name, :object_id => params[:id], :uri => request.fullpath, :user => current_user, :action => params[:action] } permission_denied unless RestfulAcl::Base.new(options).allowed? end private def permission_denied logger.info("[RESTful_ACL] Permission denied to %s at %s for %s" % [blame, Time.now, request.fullpath]) redirect_to denied_url end def blame (@current_user.present?) ? "User ##{@current_user.id}" : "GUEST" end end end end
Version data entries
6 entries across 6 versions & 1 rubygems