identity-vault/app/controllers/concerns/identity_authorizable.rb
nora 9998147a4e
epic: overhaul program management experience (#188)
* temp commit

* lemme do it

* nope

* let them do it too

* collab invite model

* better visuals on progman

* waow

* danger will robinson

* show apps on backend & link user

* first pass on app auditability!

* no lastnaming admins

* async frame that shit!

* waugh

* can't add yourself

* fix reinvite

* sidebar badging

* lint...

* gotta be on the app!

* let that get rescued by applcon

* already in revoke_all_authorizations

* woag

* the routes you grew up with no longer exist

* what would the UI for that even be?

* sorch

* much better!

* frickin validations
2026-03-02 22:15:13 -05:00

24 lines
651 B
Ruby

# frozen_string_literal: true
# Opt-in concern for frontend controllers that want Pundit authorization
# with Identity as the authorization subject (instead of Backend::User).
#
# This does NOT affect backend controllers — they continue using
# Backend::User via Backend::ApplicationController.
module IdentityAuthorizable
extend ActiveSupport::Concern
included do
include Pundit::Authorization
after_action :verify_authorized
rescue_from Pundit::NotAuthorizedError do |_e|
flash[:error] = "You're not authorized to do that."
redirect_to root_path
end
def pundit_user
current_identity
end
end
end