Class: ResourcePolicy
- Inherits:
-
ApplicationPolicy
- Object
- ApplicationPolicy
- ResourcePolicy
- Defined in:
- app/policies/resource_policy.rb
Overview
Protects Resource objects
Instance Method Summary collapse
-
#create? ⇒ Boolean
(also: #new?)
Whether or not the user can create resources for this organization.
-
#index? ⇒ true
Everyone can list resources in their organizations.
-
#show? ⇒ true
Anyone can view an resource belonging to their organization.
-
#update? ⇒ Boolean
(also: #edit?, #destroy?)
If the user can change an resource belonging to this organization.
Methods inherited from ApplicationPolicy
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 resources for this organization
16 17 18 |
# File 'app/policies/resource_policy.rb', line 16 def create? organization_user. end |
#index? ⇒ true
Returns everyone can list resources in their organizations
6 7 8 |
# File 'app/policies/resource_policy.rb', line 6 def index? true end |
#show? ⇒ true
Returns anyone can view an resource belonging to their organization
11 12 13 |
# File 'app/policies/resource_policy.rb', line 11 def show? true end |
#update? ⇒ Boolean Also known as: edit?, destroy?
Returns if the user can change an resource belonging to this organization
23 24 25 |
# File 'app/policies/resource_policy.rb', line 23 def update? organization_user.editor? end |