Class: ResourceLinkPolicy

Inherits:
ApplicationPolicy show all
Defined in:
app/policies/resource_link_policy.rb

Overview

Protects access to ResourceLink objects

Instance Method Summary collapse

Methods inherited from ApplicationPolicy

#index?, #initialize, #scope, #user

Constructor Details

This class inherits a constructor from ApplicationPolicy

Instance Method Details

#create?Boolean Also known as: new?

Returns whether or not the user can create resource links for this organization

Returns:

  • (Boolean)

    whether or not the user can create resource links for this organization



11
12
13
# File 'app/policies/resource_link_policy.rb', line 11

def create?
  organization_user.author?
end

#show?true

Returns anyone can view a resource link belonging to their organization

Returns:

  • (true)

    anyone can view a resource link belonging to their organization



6
7
8
# File 'app/policies/resource_link_policy.rb', line 6

def show?
  true
end

#update?Boolean Also known as: edit?, destroy?

Returns if the user can change an resource belonging to this organization

Returns:

  • (Boolean)

    if the user can change an resource belonging to this organization



18
19
20
# File 'app/policies/resource_link_policy.rb', line 18

def update?
  organization_user.editor?
end