Class: OrganizationPolicy

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

Overview

Authorizes access to Organization objects

Instance Method Summary collapse

Methods inherited from ApplicationPolicy

#initialize, #scope, #user

Constructor Details

This class inherits a constructor from ApplicationPolicy

Instance Method Details

#create?true Also known as: new?

Returns anyone can create an organization

Returns:

  • (true)

    anyone can create an organization



14
15
16
# File 'app/policies/organization_policy.rb', line 14

def create?
  true
end

#destroy?false

Returns we don't currently support destruction of organizations

Returns:

  • (false)

    we don't currently support destruction of organizations



29
30
31
# File 'app/policies/organization_policy.rb', line 29

def destroy?
  false
end

#index?true

Returns everyone can view at least the subset of organizations to which they belong

Returns:

  • (true)

    everyone can view at least the subset of organizations to which they belong



4
5
6
# File 'app/policies/organization_policy.rb', line 4

def index?
  true
end

#show?true

Returns anyone can view an organization

Returns:

  • (true)

    anyone can view an organization



9
10
11
# File 'app/policies/organization_policy.rb', line 9

def show?
  true
end

#update?true, false Also known as: edit?

Returns:

  • (true)

    if the user is an owner of the organization

  • (false)

    otherwise



22
23
24
# File 'app/policies/organization_policy.rb', line 22

def update?
  organization_user.owner?
end