summaryrefslogtreecommitdiff
path: root/app/controllers/admin
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-19 11:46:49 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-06-19 15:29:53 +0200
commit270b7ce810775d69887e76162a00e8dc97e5d959 (patch)
tree33855438dcd29daf1a3ee74735f1dbb411a999c6 /app/controllers/admin
parent228da2dd28a91b3ab2729787e93e72940975a2bd (diff)
downloadgitlab-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.rb26
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