3296: When invoking sudo operations, skip profile check. Profile check is problematic...
authorradhika <radhika@curoverse.com>
Tue, 5 Aug 2014 18:59:17 +0000 (14:59 -0400)
committerradhika <radhika@curoverse.com>
Tue, 5 Aug 2014 18:59:17 +0000 (14:59 -0400)
apps/workbench/app/controllers/application_controller.rb
apps/workbench/app/controllers/users_controller.rb

index fd94cf8e40bc8fccac90821d2fe2f17af6452356..3e9749a3bb72017eb448f0ec9a84a75e82846d4b 100644 (file)
@@ -418,6 +418,8 @@ class ApplicationController < ActionController::Base
         is_admin: user.is_admin,
         prefs: user.prefs
       }
+      session[:skip_profile] = params[:skip_profile]
+
       if !request.format.json? and request.method.in? ['GET', 'HEAD']
         # Repeat this request with api_token in the (new) session
         # cookie instead of the query string.  This prevents API
@@ -514,6 +516,10 @@ class ApplicationController < ActionController::Base
   def check_user_profile
     @profile_config = Rails.configuration.user_profile_form_fields
 
+    if params[:skip_profile] || session[:skip_profile]
+      return true
+    end
+
     if current_user && @profile_config
       missing_required_profile = false
 
index 0d6f6240564f1e72a31a164a0db333654ab4bd01..5746520d78afde7dc518d33652efda4fb9d1745e 100644 (file)
@@ -111,7 +111,7 @@ class UsersController < ApplicationController
                                       owner_uuid: @object.uuid
                                     }
                                   })
-    redirect_to root_url(api_token: resp[:api_token])
+    redirect_to root_url(api_token: resp[:api_token], skip_profile: true)
   end
 
   def home