Search
find_ldap_user(login)
¶
Find the LDAP user identified by 'login' in the configured ldap database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
login
|
The login to find in the LDAP database |
required |
Returns:
| Type | Description |
|---|---|
|
None if no user is found, a dictionary defining 'cn', 'username', 'fullname' and 'email' otherwise. |
Source code in ckanext/ldap/lib/search.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
ldap_search(cnx, filter_str, attributes, non_unique='raise')
¶
Helper function to perform the actual LDAP search.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cnx
|
The LDAP connection object |
required | |
filter_str
|
The LDAP filter string |
required | |
attributes
|
The LDAP attributes to fetch. This must include self.ldap_username |
required | |
non_unique
|
What to do when there is more than one result. Can be either 'log' (log an error and return None - used to indicate that this is a configuration problem that needs to be address by the site admin, not by the current user) or 'raise' (raise an exception with a message that will be displayed to the current user - such as 'please use your unique id instead'). Other values will silently ignore the error. (Default value = 'raise') |
'raise'
|
Returns:
| Type | Description |
|---|---|
|
A dictionary defining 'cn', self.ldap_username and any other attributes that were defined in attributes; or None if no user was found. |
Source code in ckanext/ldap/lib/search.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |