Show More
@@ -394,13 +394,12 def get_current_revision(quiet=False): | |||||
394 | try: |
|
394 | try: | |
395 | from vcs import get_repo |
|
395 | from vcs import get_repo | |
396 | from vcs.utils.helpers import get_scm |
|
396 | from vcs.utils.helpers import get_scm | |
397 | from vcs.exceptions import RepositoryError, VCSError |
|
|||
398 | repopath = os.path.join(os.path.dirname(__file__), '..', '..') |
|
397 | repopath = os.path.join(os.path.dirname(__file__), '..', '..') | |
399 | scm = get_scm(repopath)[0] |
|
398 | scm = get_scm(repopath)[0] | |
400 | repo = get_repo(path=repopath, alias=scm) |
|
399 | repo = get_repo(path=repopath, alias=scm) | |
401 | tip = repo.get_changeset() |
|
400 | tip = repo.get_changeset() | |
402 | return (tip.revision, tip.short_id) |
|
401 | return (tip.revision, tip.short_id) | |
403 | except (ImportError, RepositoryError, VCSError), err: |
|
402 | except Exception, err: | |
404 | if not quiet: |
|
403 | if not quiet: | |
405 | print ("Cannot retrieve rhodecode's revision. Original error " |
|
404 | print ("Cannot retrieve rhodecode's revision. Original error " | |
406 | "was: %s" % err) |
|
405 | "was: %s" % err) |
@@ -53,8 +53,10 class AuthLdap(object): | |||||
53 | if self.TLS_KIND == 'LDAPS': |
|
53 | if self.TLS_KIND == 'LDAPS': | |
54 | port = port or 689 |
|
54 | port = port or 689 | |
55 | ldap_server_type = ldap_server_type + 's' |
|
55 | ldap_server_type = ldap_server_type + 's' | |
56 |
|
56 | |||
57 | self.TLS_REQCERT = ldap.__dict__['OPT_X_TLS_' + tls_reqcert] |
|
57 | OPT_X_TLS_DEMAND = 2 | |
|
58 | self.TLS_REQCERT = getattr(ldap, 'OPT_X_TLS_%s' % tls_reqcert, | |||
|
59 | OPT_X_TLS_DEMAND) | |||
58 | self.LDAP_SERVER_ADDRESS = server |
|
60 | self.LDAP_SERVER_ADDRESS = server | |
59 | self.LDAP_SERVER_PORT = port |
|
61 | self.LDAP_SERVER_PORT = port | |
60 |
|
62 | |||
@@ -63,12 +65,12 class AuthLdap(object): | |||||
63 | self.LDAP_BIND_PASS = bind_pass |
|
65 | self.LDAP_BIND_PASS = bind_pass | |
64 |
|
66 | |||
65 | self.LDAP_SERVER = "%s://%s:%s" % (ldap_server_type, |
|
67 | self.LDAP_SERVER = "%s://%s:%s" % (ldap_server_type, | |
66 |
|
|
68 | self.LDAP_SERVER_ADDRESS, | |
67 |
|
|
69 | self.LDAP_SERVER_PORT) | |
68 |
|
70 | |||
69 | self.BASE_DN = base_dn |
|
71 | self.BASE_DN = base_dn | |
70 | self.LDAP_FILTER = ldap_filter |
|
72 | self.LDAP_FILTER = ldap_filter | |
71 |
self.SEARCH_SCOPE = ldap |
|
73 | self.SEARCH_SCOPE = getattr(ldap, 'SCOPE_%s' % search_scope) | |
72 | self.attr_login = attr_login |
|
74 | self.attr_login = attr_login | |
73 |
|
75 | |||
74 | def authenticate_ldap(self, username, password): |
|
76 | def authenticate_ldap(self, username, password): | |
@@ -88,7 +90,9 class AuthLdap(object): | |||||
88 | if "," in username: |
|
90 | if "," in username: | |
89 | raise LdapUsernameError("invalid character in username: ,") |
|
91 | raise LdapUsernameError("invalid character in username: ,") | |
90 | try: |
|
92 | try: | |
91 |
|
|
93 | if hasattr(ldap,'OPT_X_TLS_CACERTDIR'): | |
|
94 | ldap.set_option(ldap.OPT_X_TLS_CACERTDIR, | |||
|
95 | '/etc/openldap/cacerts') | |||
92 | ldap.set_option(ldap.OPT_REFERRALS, ldap.OPT_OFF) |
|
96 | ldap.set_option(ldap.OPT_REFERRALS, ldap.OPT_OFF) | |
93 | ldap.set_option(ldap.OPT_RESTART, ldap.OPT_ON) |
|
97 | ldap.set_option(ldap.OPT_RESTART, ldap.OPT_ON) | |
94 | ldap.set_option(ldap.OPT_TIMEOUT, 20) |
|
98 | ldap.set_option(ldap.OPT_TIMEOUT, 20) |
@@ -422,10 +422,10 class UsersGroup(Base, BaseModel): | |||||
422 | Session.flush() |
|
422 | Session.flush() | |
423 | members_list = [] |
|
423 | members_list = [] | |
424 | if v: |
|
424 | if v: | |
|
425 | v = [v] if isinstance(v, basestring) else v | |||
425 | for u_id in set(v): |
|
426 | for u_id in set(v): | |
426 |
member |
|
427 | member = UsersGroupMember(users_group_id,u_id) | |
427 | users_group_id, |
|
428 | members_list.append(member) | |
428 | u_id)) |
|
|||
429 | setattr(users_group, 'members', members_list) |
|
429 | setattr(users_group, 'members', members_list) | |
430 | setattr(users_group, k, v) |
|
430 | setattr(users_group, k, v) | |
431 |
|
431 |
General Comments 0
You need to be logged in to leave comments.
Login now