RE: LDAP authentication with user binding » patch0.patch
app/models/auth_source_ldap.rb | ||
---|---|---|
21 | 21 |
class AuthSourceLdap < AuthSource |
22 | 22 |
validates_presence_of :host, :port, :attr_login |
23 | 23 |
validates_length_of :name, :host, :account_password, :maximum => 60, :allow_nil => true |
24 |
validates_length_of :account, :base_dn, :maximum => 255, :allow_nil => true |
|
24 |
validates_length_of :account, :domain, :base_dn, :maximum => 255, :allow_nil => true
|
|
25 | 25 |
validates_length_of :attr_login, :attr_firstname, :attr_lastname, :attr_mail, :maximum => 30, :allow_nil => true |
26 | 26 |
validates_numericality_of :port, :only_integer => true |
27 | 27 |
|
... | ... | |
35 | 35 |
return nil if login.blank? || password.blank? |
36 | 36 |
attrs = [] |
37 | 37 |
# get user's DN |
38 |
ldap_con = initialize_ldap_con(self.account, self.account_password)
|
|
38 |
domain.blank? ? ldap_con = initialize_ldap_con(self.account, self.account_password) : ldap_con = initialize_ldap_con(domain + "\\" + login, password);
|
|
39 | 39 |
login_filter = Net::LDAP::Filter.eq( self.attr_login, login ) |
40 | 40 |
object_filter = Net::LDAP::Filter.eq( "objectClass", "*" ) |
41 | 41 |
dn = String.new |
app/views/auth_sources/_form.rhtml | ||
---|---|---|
11 | 11 |
<p><label for="auth_source_port"><%=l(:field_port)%> <span class="required">*</span></label> |
12 | 12 |
<%= text_field 'auth_source', 'port', :size => 6 %> <%= check_box 'auth_source', 'tls' %> LDAPS</p> |
13 | 13 | |
14 |
<p><label for="auth_source_domain"><%=l(:field_domain)%></label> |
|
15 |
<%= text_field 'auth_source', 'domain' %></p> |
|
16 | ||
14 | 17 |
<p><label for="auth_source_account"><%=l(:field_account)%></label> |
15 | 18 |
<%= text_field 'auth_source', 'account' %></p> |
16 | 19 |
config/locales/bg.yml | ||
---|---|---|
876 | 876 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
877 | 877 |
Are you sure you want to continue? |
878 | 878 |
label_close_versions: Close completed versions |
879 |
field_domain: Domain |
|
879 | 880 |
label_board_sticky: Sticky |
880 | 881 |
label_board_locked: Locked |
881 | 882 |
permission_export_wiki_pages: Export wiki pages |
882 | 883 |
setting_cache_formatted_text: Cache formatted text |
883 | 884 |
permission_manage_project_activities: Manage project activities |
884 |
|
config/locales/bs.yml | ||
---|---|---|
900 | 900 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
901 | 901 |
Are you sure you want to continue? |
902 | 902 |
label_close_versions: Close completed versions |
903 |
field_domain: Domain |
|
903 | 904 |
label_board_sticky: Sticky |
904 | 905 |
label_board_locked: Locked |
905 | 906 |
permission_export_wiki_pages: Export wiki pages |
config/locales/ca.yml | ||
---|---|---|
879 | 879 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
880 | 880 |
Are you sure you want to continue? |
881 | 881 |
label_close_versions: Close completed versions |
882 |
field_domain: Domain |
|
882 | 883 |
label_board_sticky: Sticky |
883 | 884 |
label_board_locked: Locked |
884 | 885 |
permission_export_wiki_pages: Export wiki pages |
config/locales/cs.yml | ||
---|---|---|
882 | 882 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
883 | 883 |
Are you sure you want to continue? |
884 | 884 |
label_close_versions: Close completed versions |
885 |
field_domain: Domain |
|
885 | 886 |
label_board_sticky: Sticky |
886 | 887 |
label_board_locked: Locked |
887 | 888 |
permission_export_wiki_pages: Export wiki pages |
config/locales/da.yml | ||
---|---|---|
902 | 902 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
903 | 903 |
Are you sure you want to continue? |
904 | 904 |
label_close_versions: Close completed versions |
905 |
field_domain: Domain |
|
905 | 906 |
label_board_sticky: Sticky |
906 | 907 |
label_board_locked: Locked |
907 | 908 |
permission_export_wiki_pages: Export wiki pages |
config/locales/de.yml | ||
---|---|---|
902 | 902 |
Sie sind dabei, einige oder alle ihre Berechtigungen zu entfernen. Es ist möglich, dass Sie danach das Projekt nicht mehr sehen oder editieren dürfen. |
903 | 903 |
Sind Sie wirklich sicher, dass Sie dies tun möchten? |
904 | 904 |
label_close_versions: Vollständige Versionen schließen |
905 |
field_domain: Domain |
|
905 | 906 |
label_board_sticky: Sticky |
906 | 907 |
label_board_locked: Locked |
907 | 908 |
permission_export_wiki_pages: Export wiki pages |
config/locales/el.yml | ||
---|---|---|
882 | 882 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
883 | 883 |
Are you sure you want to continue? |
884 | 884 |
label_close_versions: Close completed versions |
885 |
field_domain: Domain |
|
885 | 886 |
label_board_sticky: Sticky |
886 | 887 |
label_board_locked: Locked |
887 | 888 |
permission_export_wiki_pages: Export wiki pages |
config/locales/en.yml | ||
---|---|---|
241 | 241 |
field_port: Port |
242 | 242 |
field_account: Account |
243 | 243 |
field_base_dn: Base DN |
244 |
field_domain: Domain |
|
244 | 245 |
field_attr_login: Login attribute |
245 | 246 |
field_attr_firstname: Firstname attribute |
246 | 247 |
field_attr_lastname: Lastname attribute |
config/locales/es.yml | ||
---|---|---|
262 | 262 |
field_default_value: Estado por defecto |
263 | 263 |
field_delay: Retraso |
264 | 264 |
field_description: Descripción |
265 |
field_domain: Domain |
|
265 | 266 |
field_done_ratio: % Realizado |
266 | 267 |
field_downloads: Descargas |
267 | 268 |
field_due_date: Fecha fin |
config/locales/fi.yml | ||
---|---|---|
912 | 912 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
913 | 913 |
Are you sure you want to continue? |
914 | 914 |
label_close_versions: Close completed versions |
915 |
field_domain: Domain |
|
915 | 916 |
label_board_sticky: Sticky |
916 | 917 |
label_board_locked: Locked |
917 | 918 |
permission_export_wiki_pages: Export wiki pages |
config/locales/fr.yml | ||
---|---|---|
906 | 906 |
text_journal_deleted: "{{label}} {{old}} supprimé" |
907 | 907 |
text_journal_added: "{{label}} {{value}} ajouté" |
908 | 908 |
enumeration_system_activity: Activité système |
909 |
field_domain: Domain |
|
909 | 910 |
label_board_sticky: Sticky |
910 | 911 |
label_board_locked: Verrouillé |
config/locales/gl.yml | ||
---|---|---|
902 | 902 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
903 | 903 |
Are you sure you want to continue? |
904 | 904 |
label_close_versions: Close completed versions |
905 |
field_domain: Domain |
|
905 | 906 |
label_board_sticky: Sticky |
906 | 907 |
label_board_locked: Locked |
907 | 908 |
permission_export_wiki_pages: Export wiki pages |
config/locales/he.yml | ||
---|---|---|
886 | 886 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
887 | 887 |
Are you sure you want to continue? |
888 | 888 |
label_close_versions: Close completed versions |
889 |
field_domain: Domain |
|
889 | 890 |
label_board_sticky: Sticky |
890 | 891 |
label_board_locked: Locked |
891 | 892 |
permission_export_wiki_pages: Export wiki pages |
config/locales/hu.yml | ||
---|---|---|
907 | 907 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
908 | 908 |
Are you sure you want to continue? |
909 | 909 |
label_close_versions: Close completed versions |
910 |
field_domain: Domain |
|
910 | 911 |
label_board_sticky: Sticky |
911 | 912 |
label_board_locked: Locked |
912 | 913 |
permission_export_wiki_pages: Export wiki pages |
config/locales/id.yml | ||
---|---|---|
894 | 894 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
895 | 895 |
Are you sure you want to continue? |
896 | 896 |
label_close_versions: Close completed versions |
897 |
field_domain: Domain |
|
897 | 898 |
label_board_sticky: Sticky |
898 | 899 |
label_board_locked: Locked |
899 | 900 |
permission_export_wiki_pages: Export wiki pages |
config/locales/it.yml | ||
---|---|---|
889 | 889 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
890 | 890 |
Are you sure you want to continue? |
891 | 891 |
label_close_versions: Close completed versions |
892 |
field_domain: Domain |
|
892 | 893 |
label_board_sticky: Sticky |
893 | 894 |
label_board_locked: Locked |
894 | 895 |
permission_export_wiki_pages: Export wiki pages |
895 | 896 |
setting_cache_formatted_text: Cache formatted text |
896 | 897 |
permission_manage_project_activities: Manage project activities |
897 |
|
config/locales/ja.yml | ||
---|---|---|
915 | 915 |
enumeration_doc_categories: 文書カテゴリ |
916 | 916 |
enumeration_activities: 作業分類 (時間トラッキング) |
917 | 917 |
enumeration_system_activity: システム作業分類 |
918 |
field_domain: Domain |
|
918 | 919 |
permission_manage_project_activities: Manage project activities |
config/locales/ko.yml | ||
---|---|---|
942 | 942 |
권한들 일부 또는 전부를 막 삭제하려고 하고 있습니다. 그렇게 되면 이 프로젝트를 더이상 수정할 수 없게 됩니다. |
943 | 943 |
계속하시겠습니까? |
944 | 944 |
label_close_versions: 완료된 버전 닫기 |
945 |
field_domain: Domain |
|
945 | 946 |
label_board_sticky: Sticky |
946 | 947 |
label_board_locked: Locked |
947 | 948 |
permission_export_wiki_pages: Export wiki pages |
config/locales/lt.yml | ||
---|---|---|
950 | 950 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
951 | 951 |
Are you sure you want to continue? |
952 | 952 |
label_close_versions: Close completed versions |
953 |
field_domain: Domain |
|
953 | 954 |
label_board_sticky: Sticky |
954 | 955 |
label_board_locked: Locked |
955 | 956 |
permission_export_wiki_pages: Export wiki pages |
config/locales/nl.yml | ||
---|---|---|
864 | 864 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
865 | 865 |
Are you sure you want to continue? |
866 | 866 |
label_close_versions: Close completed versions |
867 |
field_domain: Domain |
|
867 | 868 |
label_board_sticky: Sticky |
868 | 869 |
label_board_locked: Locked |
869 | 870 |
permission_export_wiki_pages: Export wiki pages |
config/locales/no.yml | ||
---|---|---|
877 | 877 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
878 | 878 |
Are you sure you want to continue? |
879 | 879 |
label_close_versions: Close completed versions |
880 |
field_domain: Domain |
|
880 | 881 |
label_board_sticky: Sticky |
881 | 882 |
label_board_locked: Locked |
882 | 883 |
permission_export_wiki_pages: Export wiki pages |
config/locales/pl.yml | ||
---|---|---|
906 | 906 |
version_status_closed: zamknięta |
907 | 907 |
version_status_locked: zablokowana |
908 | 908 |
version_status_open: otwarta |
909 |
|
|
909 | ||
910 |
field_domain: Domain |
|
910 | 911 |
label_board_sticky: Przyklejona |
911 | 912 |
label_board_locked: Zamknięta |
912 | 913 |
permission_export_wiki_pages: Eksport stron wiki |
config/locales/pt-BR.yml | ||
---|---|---|
909 | 909 |
Você está para remover algumas de suas próprias permissões e pode não mais estar apto a editar este projeto após esta operação. |
910 | 910 |
Você tem certeza que deseja continuar? |
911 | 911 |
label_close_versions: Fechar versões concluídas |
912 |
field_domain: Domain |
|
912 | 913 |
label_board_sticky: Marcado |
913 | 914 |
label_board_locked: Travado |
914 | 915 |
label_change_log: Registro de alterações |
config/locales/pt.yml | ||
---|---|---|
894 | 894 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
895 | 895 |
Are you sure you want to continue? |
896 | 896 |
label_close_versions: Close completed versions |
897 |
field_domain: Domain |
|
897 | 898 |
label_board_sticky: Sticky |
898 | 899 |
label_board_locked: Locked |
899 | 900 |
permission_export_wiki_pages: Export wiki pages |
config/locales/ro.yml | ||
---|---|---|
879 | 879 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
880 | 880 |
Are you sure you want to continue? |
881 | 881 |
label_close_versions: Close completed versions |
882 |
field_domain: Domain |
|
882 | 883 |
label_board_sticky: Sticky |
883 | 884 |
label_board_locked: Locked |
884 | 885 |
permission_export_wiki_pages: Export wiki pages |
config/locales/ru.yml | ||
---|---|---|
990 | 990 |
Вы собираетесь удалить некоторые или все права, из-за чего могут пропасть права на редактирование этого проекта. |
991 | 991 |
Продолжить? |
992 | 992 |
label_close_versions: Закрыть завершенные версии |
993 |
field_domain: Domain |
|
993 | 994 |
label_board_sticky: Прикреплена |
994 | 995 |
label_board_locked: Заблокирована |
995 | 996 |
permission_export_wiki_pages: Export wiki pages |
config/locales/sk.yml | ||
---|---|---|
881 | 881 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
882 | 882 |
Are you sure you want to continue? |
883 | 883 |
label_close_versions: Close completed versions |
884 |
field_domain: Domain |
|
884 | 885 |
label_board_sticky: Sticky |
885 | 886 |
label_board_locked: Locked |
886 | 887 |
permission_export_wiki_pages: Export wiki pages |
config/locales/sl.yml | ||
---|---|---|
878 | 878 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
879 | 879 |
Are you sure you want to continue? |
880 | 880 |
label_close_versions: Close completed versions |
881 |
field_domain: Domain |
|
881 | 882 |
label_board_sticky: Sticky |
882 | 883 |
label_board_locked: Locked |
883 | 884 |
permission_export_wiki_pages: Export wiki pages |
config/locales/sr.yml | ||
---|---|---|
897 | 897 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
898 | 898 |
Are you sure you want to continue? |
899 | 899 |
label_close_versions: Close completed versions |
900 |
field_domain: Domain |
|
900 | 901 |
label_board_sticky: Sticky |
901 | 902 |
label_board_locked: Locked |
902 | 903 |
permission_export_wiki_pages: Export wiki pages |
config/locales/sv.yml | ||
---|---|---|
933 | 933 |
enumeration_doc_categories: Dokumentkategorier |
934 | 934 |
enumeration_activities: Aktiviteter (tidsuppföljning) |
935 | 935 |
enumeration_system_activity: Systemaktivitet |
936 |
field_domain: Domain |
|
936 | 937 |
permission_export_wiki_pages: Export wiki pages |
937 | 938 |
setting_cache_formatted_text: Cache formatted text |
938 | 939 |
permission_manage_project_activities: Manage project activities |
config/locales/th.yml | ||
---|---|---|
879 | 879 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
880 | 880 |
Are you sure you want to continue? |
881 | 881 |
label_close_versions: Close completed versions |
882 |
field_domain: Domain |
|
882 | 883 |
label_board_sticky: Sticky |
883 | 884 |
label_board_locked: Locked |
884 | 885 |
permission_export_wiki_pages: Export wiki pages |
config/locales/tr.yml | ||
---|---|---|
909 | 909 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
910 | 910 |
Are you sure you want to continue? |
911 | 911 |
label_close_versions: Close completed versions |
912 |
field_domain: Domain |
|
912 | 913 |
label_board_sticky: Sticky |
913 | 914 |
label_board_locked: Locked |
914 | 915 |
permission_export_wiki_pages: Export wiki pages |
config/locales/uk.yml | ||
---|---|---|
878 | 878 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
879 | 879 |
Are you sure you want to continue? |
880 | 880 |
label_close_versions: Close completed versions |
881 |
field_domain: Domain |
|
881 | 882 |
label_board_sticky: Sticky |
882 | 883 |
label_board_locked: Locked |
883 | 884 |
permission_export_wiki_pages: Export wiki pages |
config/locales/vi.yml | ||
---|---|---|
941 | 941 |
You are about to remove some or all of your permissions and may no longer be able to edit this project after that. |
942 | 942 |
Are you sure you want to continue? |
943 | 943 |
label_close_versions: Close completed versions |
944 |
field_domain: Domain |
|
944 | 945 |
label_board_sticky: Sticky |
945 | 946 |
label_board_locked: Locked |
946 | 947 |
permission_export_wiki_pages: Export wiki pages |
config/locales/zh-TW.yml | ||
---|---|---|
975 | 975 |
enumeration_doc_categories: 文件分類 |
976 | 976 |
enumeration_activities: 活動 (時間追蹤) |
977 | 977 |
enumeration_system_activity: 系統活動 |
978 |
field_domain: Domain |
|
978 | 979 |
permission_export_wiki_pages: Export wiki pages |
979 | 980 |
setting_cache_formatted_text: Cache formatted text |
980 | 981 |
permission_manage_project_activities: Manage project activities |
config/locales/zh.yml | ||
---|---|---|
265 | 265 |
field_port: 端口 |
266 | 266 |
field_account: 帐号 |
267 | 267 |
field_base_dn: Base DN |
268 |
field_domain: Domain |
|
268 | 269 |
field_attr_login: 登录名属性 |
269 | 270 |
field_attr_firstname: 名字属性 |
270 | 271 |
field_attr_lastname: 姓氏属性 |
db/migrate/20100115124427_add_auth_sources_domain.rb | ||
---|---|---|
1 |
class AddAuthSourcesDomain < ActiveRecord::Migration |
|
2 |
def self.up |
|
3 |
add_column :auth_sources, :domain, :string, :default => '', :null => true |
|
4 |
end |
|
5 | ||
6 |
def self.down |
|
7 |
remove_column :auth_sources, :domain |
|
8 |
end |
|
9 |
end |