mirror of
https://github.com/internetee/registry.git
synced 2025-07-20 17:55:55 +02:00
Improve registrar area linked user switch
- Introduce profile - Move linked users to profile - Use PUT #599
This commit is contained in:
parent
bd78c9d5c8
commit
e2ebe0aa84
16 changed files with 248 additions and 73 deletions
|
@ -3,10 +3,16 @@ class Registrar
|
|||
skip_authorization_check
|
||||
|
||||
def switch
|
||||
new_user = ApiUser.find(params[:new_user_id])
|
||||
sign_in(new_user) if new_user.identity_code == current_user.identity_code
|
||||
raise 'Cannot switch to unlinked user' unless current_user.linked_with?(new_user)
|
||||
|
||||
sign_in(new_user)
|
||||
redirect_to :back, notice: t('.switched', new_user: new_user)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def new_user
|
||||
@new_user ||= ApiUser.find(params[:new_user_id])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
17
app/controllers/registrar/profile_controller.rb
Normal file
17
app/controllers/registrar/profile_controller.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
class Registrar
|
||||
class ProfileController < BaseController
|
||||
skip_authorization_check
|
||||
|
||||
helper_method :linked_users
|
||||
|
||||
def show
|
||||
@user = current_user
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def linked_users
|
||||
current_user.linked_users
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue