* Add feature flag for profile admin section * Fix spec description * Also remove profile admin link from sidebar * Disable profile admin routes based on feature flag * Minor fixes * Remove unnecessary object from spec * Refactor AdminHelper * Fix specs * Fix remaining specs
25 lines
882 B
Ruby
25 lines
882 B
Ruby
module Admin
|
|
class ApplicationController < ApplicationController
|
|
before_action :authorize_admin
|
|
after_action :verify_authorized
|
|
|
|
private
|
|
|
|
def authorization_resource
|
|
self.class.name.demodulize.sub("Controller", "").singularize.constantize
|
|
end
|
|
|
|
def authorize_admin
|
|
authorize(authorization_resource, :access?, policy_class: InternalPolicy)
|
|
end
|
|
|
|
def bust_content_change_caches
|
|
CacheBuster.bust("/tags/onboarding") # Needs to change when suggested_tags is edited.
|
|
CacheBuster.bust("/shell_top") # Cached at edge, sent to service worker.
|
|
CacheBuster.bust("/shell_bottom") # Cached at edge, sent to service worker.
|
|
CacheBuster.bust("/onboarding") # Page is cached at edge.
|
|
CacheBuster.bust("/") # Page is cached at edge.
|
|
SiteConfig.admin_action_taken_at = Time.current # Used as cache key
|
|
end
|
|
end
|
|
end
|