symbiod/symbiod

View on GitHub
lib/sidekiq_constraint.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

# Allows only users with role `staff` to access sidekiq dashboard
class SidekiqConstraint
  def matches?(request)
    return false unless User.exists?(request.session[:user_id])
    user = User.find request.session[:user_id]
    SidekiqPolicy.new(user, nil).access_allowed?
  end
end