Class: Portier::ViewTagsPermission

Inherits:
BasePermission show all
Defined in:
lib/portier/view_tags_permission.rb

Overview

************************************************************************************* Control the access using a tag. *************************************************************************************

Instance Attribute Summary

Attributes inherited from BasePermission

#access_denied_message, #application_controller, #current_user

Instance Method Summary collapse

Methods inherited from BasePermission

#initialize, #set_access_denied_message

Constructor Details

This class inherits a constructor from Portier::BasePermission

Instance Method Details

#can_view?(tag, options = {}) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
13
# File 'lib/portier/view_tags_permission.rb', line 5

def can_view?(tag, options={})
  if self.respond_to? tag.to_sym
    @options = options

    self.send(tag.to_sym)
  else
    raise Portier::NoPermissionError, "You must define the method \"#{tag}\" in the view tags file (app/permissions/view_tags_permission.rb). See documentation for more details."
  end
end