diff options
| author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-06-19 11:46:49 +0200 |
|---|---|---|
| committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-06-19 15:29:53 +0200 |
| commit | 270b7ce810775d69887e76162a00e8dc97e5d959 (patch) | |
| tree | 33855438dcd29daf1a3ee74735f1dbb411a999c6 /app/controllers/admin | |
| parent | 228da2dd28a91b3ab2729787e93e72940975a2bd (diff) | |
| download | gitlab-ce-270b7ce810775d69887e76162a00e8dc97e5d959.tar.gz | |
Add ability for admin to edit user identity
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers/admin')
| -rw-r--r-- | app/controllers/admin/identities_controller.rb | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/app/controllers/admin/identities_controller.rb b/app/controllers/admin/identities_controller.rb index 6107b1bcb40..795fecd78d6 100644 --- a/app/controllers/admin/identities_controller.rb +++ b/app/controllers/admin/identities_controller.rb @@ -1,11 +1,21 @@ class Admin::IdentitiesController < Admin::ApplicationController - before_action :user, only: [:destroy] + before_action :user + before_action :identity - def destroy - identity = user.identities.find(params[:id]) + def edit + end + + def update + if @identity.update_attributes(identity_params) + redirect_to admin_user_path(@user), notice: 'User identity was successfully updated.' + else + render :edit + end + end + def destroy respond_to do |format| - if identity.destroy + if @identity.destroy format.html { redirect_to [:admin, user], notice: 'User identity was successfully removed.' } else format.html { redirect_to [:admin, user], alert: 'Failed to remove user identity.' } @@ -18,4 +28,12 @@ class Admin::IdentitiesController < Admin::ApplicationController def user @user ||= User.find_by!(username: params[:user_id]) end + + def identity + @identity ||= user.identities.find(params[:id]) + end + + def identity_params + params[:identity].permit(:provider, :extern_uid) + end end |
