-
Notifications
You must be signed in to change notification settings - Fork 655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug/ch132025/split configs for broker and central login #16150
Bug/ch132025/split configs for broker and central login #16150
Conversation
This pull request has been linked to Clubhouse Story #132025: Split configs for broker and central login / communication. |
18a0ed0
to
1027160
Compare
1027160
to
0f658d5
Compare
Staging acceptance ✅CartoDB -> Central redirection enabled
Regular user login (amiedes-testlogin-1)
Organization user login (amiedes-testlogin-1-org-admin)
CartoDB -> Central redirection disabled
Regular user login (amiedes-testlogin-1)
Organization user login (amiedes-testlogin-1-org-admin)
|
@@ -12,7 +12,7 @@ class OauthApp < ActiveRecord::Base | |||
has_many :oauth_app_users, inverse_of: :oauth_app, dependent: :destroy | |||
has_many :oauth_app_organizations, inverse_of: :oauth_app, dependent: :destroy | |||
|
|||
validates :user, presence: true, if: -> { sync_with_central? || !central_enabled? } | |||
validates :user, presence: true, if: -> { sync_with_central? || Cartodb::Central.api_sync_disabled? } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The process for migrating this was:
- Replace
central_enabled?
perCartodb::Central.api_sync_enabled?
- Replace
!central_enabled?
perCartodb::Central.api_sync_disabled?
- The
central_enabled?
method becomes unused, so it can be removed
@@ -344,9 +344,4 @@ def clean_password | |||
self.crypted_password = '' | |||
self.save | |||
end | |||
|
|||
# INFO: state_machine needs guard methods to be instance methods |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe in a previous version of the gem, but not anymore. Removing the "alias" to avoid one additional level of indirection.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
About my silly comments, I'd just ignore them and focus on updating with master (to get CI back), test & deploy for the sake of pragmatism. In the mid term there won't be any "old http client" so not worth it.
@@ -49,7 +49,7 @@ def new | |||
elsif saml_authentication? && !user | |||
# Automatically trigger SAML request on login view load -- could easily trigger this elsewhere | |||
redirect_to(saml_service.authentication_request) | |||
elsif central_enabled? && !@organization.try(:auth_enabled?) | |||
elsif Cartodb::Central.login_redirection_enabled? && !@organization.try(:auth_enabled?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
silly thing: can we take advantage to use the safe operator @organization&.auth_enabled?
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think it should be equivalent. Sometimes I'm more keen to refactorings that others 😆 🤷
@@ -213,7 +213,11 @@ def password_expired | |||
|
|||
respond_to do |format| | |||
format.html do | |||
url = central_enabled? && !@organization.try(:auth_enabled?) ? Cartodb::Central.new.login_url : login_url | |||
url = if Cartodb::Central.login_redirection_enabled? && !@organization.try(:auth_enabled?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here about safe operator
|
||
class <<self | ||
|
||
alias login_redirection_enabled? api_sync_enabled? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Related: https://app.clubhouse.io/cartoteam/story/132025/split-configs-for-broker-and-central-login-communication