Sha256: eaa7fd35821d03bf77da8fecb8d50ed1a3967ac821e12025712be875f149faa7
Contents?: true
Size: 820 Bytes
Versions: 5
Compression:
Stored size: 820 Bytes
Contents
## # Authorization # # Basic authorization methods for controllers module Outpost module Controller module Authorization # Make sure the user can authorize the current resource def authorize(resource) if !current_user.can_manage?(resource) handle_unauthorized(resource) end end # Use this for before_filter. Should be overridden for custom behavor. def authorize_resource authorize(self.class.model) end # What to do when a user doesn't have proper permissions def handle_unauthorized(resource) redirect_to outpost.root_path, alert: "You don't have permission to manage " \ "#{resource.to_title.pluralize}" return false end end # Authorization end # Controller end # Outpost
Version data entries
5 entries across 5 versions & 1 rubygems