Class: Decidim::Admin::OrganizationDashboardConstraint
- Inherits:
-
Object
- Object
- Decidim::Admin::OrganizationDashboardConstraint
- Defined in:
- app/constraints/decidim/admin/organization_dashboard_constraint.rb
Overview
A Rails routes constraint to only allow access to an Organization admin to the organization dashboard.
Instance Method Summary collapse
-
#initialize(request) ⇒ OrganizationDashboardConstraint
constructor
Initializes the constraint.
-
#matches? ⇒ Boolean
Checks if the user can access the organization dashboard.
Constructor Details
#initialize(request) ⇒ OrganizationDashboardConstraint
Initializes the constraint.
request [Rack::Request]
11 12 13 |
# File 'app/constraints/decidim/admin/organization_dashboard_constraint.rb', line 11 def initialize(request) @request = request end |
Instance Method Details
#matches? ⇒ Boolean
Checks if the user can access the organization dashboard.
Returns boolean.
18 19 20 |
# File 'app/constraints/decidim/admin/organization_dashboard_constraint.rb', line 18 def matches? user && user.organization == organization && end |