GitLab wird am Donnerstag, den 27. Januar, zwischen 08:00 und 12:00 Uhr wegen wichtigen Wartungsarbeiten nicht zur Verfügung stehen.

Commit 7731eea9 authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Add CAS specifc methods to user model

parent 7db49da7
...@@ -822,11 +822,11 @@ def allow_password_authentication? ...@@ -822,11 +822,11 @@ def allow_password_authentication?
end end
def allow_password_authentication_for_web? def allow_password_authentication_for_web?
Gitlab::CurrentSettings.password_authentication_enabled_for_web? && !ldap_user? Gitlab::CurrentSettings.password_authentication_enabled_for_web? && !ldap_user? && !cas_user?
end end
def allow_password_authentication_for_git? def allow_password_authentication_for_git?
Gitlab::CurrentSettings.password_authentication_enabled_for_git? && !ldap_user? Gitlab::CurrentSettings.password_authentication_enabled_for_git? && !ldap_user? && !cas_user?
end end
def can_change_username? def can_change_username?
...@@ -905,6 +905,14 @@ def ldap_identity ...@@ -905,6 +905,14 @@ def ldap_identity
@ldap_identity ||= identities.find_by(["provider LIKE ?", "ldap%"]) @ldap_identity ||= identities.find_by(["provider LIKE ?", "ldap%"])
end end
def cas_user?
identities.exists?(["provider = ? AND extern_uid IS NOT NULL", "cas3"])
end
def cas_identity
@cas_identity ||= identities.find_by(["provider = ?", "cas3"])
end
def project_deploy_keys def project_deploy_keys
DeployKey.unscoped.in_projects(authorized_projects.pluck(:id)).distinct(:id) DeployKey.unscoped.in_projects(authorized_projects.pluck(:id)).distinct(:id)
end end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment