mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 09:24:21 +01:00
fix unicode
This commit is contained in:
parent
b5a8e302d1
commit
147cad3511
@ -372,6 +372,11 @@ class LdapCherry(object):
|
|||||||
attrid = self.attributes.backend_attributes[b][attr]
|
attrid = self.attributes.backend_attributes[b][attr]
|
||||||
if not attr in ret:
|
if not attr in ret:
|
||||||
ret[attrid] = tmp[attr]
|
ret[attrid] = tmp[attr]
|
||||||
|
|
||||||
|
cherrypy.log.error(
|
||||||
|
msg = "user '" + username + "' attributes " + str(ret),
|
||||||
|
severity = logging.DEBUG
|
||||||
|
)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def _parse_params(self, params):
|
def _parse_params(self, params):
|
||||||
|
@ -163,10 +163,10 @@ class Backend(ldapcherry.backend.Backend):
|
|||||||
return dn_entry
|
return dn_entry
|
||||||
|
|
||||||
def _str(self, s):
|
def _str(self, s):
|
||||||
try:
|
return s.encode('utf-8')
|
||||||
return str(s)
|
|
||||||
except UnicodeEncodeError:
|
def _uni(self, s):
|
||||||
return unicode(s).encode('unicode_escape')
|
return s.decode('utf-8')
|
||||||
|
|
||||||
def auth(self, username, password):
|
def auth(self, username, password):
|
||||||
|
|
||||||
@ -303,9 +303,9 @@ class Backend(ldapcherry.backend.Backend):
|
|||||||
for attr in attrs_tmp:
|
for attr in attrs_tmp:
|
||||||
value_tmp = attrs_tmp[attr]
|
value_tmp = attrs_tmp[attr]
|
||||||
if len(value_tmp) == 1:
|
if len(value_tmp) == 1:
|
||||||
attrs[attr] = value_tmp[0]
|
attrs[attr] = self._uni(value_tmp[0])
|
||||||
else:
|
else:
|
||||||
attrs[attr] = value_tmp
|
attrs[attr] = map(self._uni, value_tmp)
|
||||||
|
|
||||||
if self.key in attrs:
|
if self.key in attrs:
|
||||||
ret[attrs[self.key]] = attrs
|
ret[attrs[self.key]] = attrs
|
||||||
@ -317,9 +317,9 @@ class Backend(ldapcherry.backend.Backend):
|
|||||||
for attr in attrs_tmp:
|
for attr in attrs_tmp:
|
||||||
value_tmp = attrs_tmp[attr]
|
value_tmp = attrs_tmp[attr]
|
||||||
if len(value_tmp) == 1:
|
if len(value_tmp) == 1:
|
||||||
ret[attr] = value_tmp[0]
|
ret[attr] = self._uni(value_tmp[0])
|
||||||
else:
|
else:
|
||||||
ret[attr] = value_tmp
|
ret[attr] = map(self._uni, value_tmp)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def get_groups(self, username):
|
def get_groups(self, username):
|
||||||
@ -333,5 +333,5 @@ class Backend(ldapcherry.backend.Backend):
|
|||||||
groups = self._search(searchfilter, NO_ATTR, self.groupdn)
|
groups = self._search(searchfilter, NO_ATTR, self.groupdn)
|
||||||
ret = []
|
ret = []
|
||||||
for entry in groups:
|
for entry in groups:
|
||||||
ret.append(entry[0])
|
ret.append(self._uni(entry[0]))
|
||||||
return ret
|
return ret
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
## -*- coding: utf-8 -*-
|
||||||
<%inherit file="navbar.tmpl"/>
|
<%inherit file="navbar.tmpl"/>
|
||||||
<%block name="core">
|
<%block name="core">
|
||||||
<div class="row clearfix top-buffer bottom-buffer">
|
<div class="row clearfix top-buffer bottom-buffer">
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
## -*- coding: utf-8 -*-
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
## -*- coding: utf-8 -*-
|
||||||
<%inherit file="navbar.tmpl"/>
|
<%inherit file="navbar.tmpl"/>
|
||||||
<%block name="core">
|
<%block name="core">
|
||||||
<div class="row clearfix">
|
<div class="row clearfix">
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
## -*- coding: utf-8 -*-
|
||||||
<%
|
<%
|
||||||
len_attr = len(attributes)
|
len_attr = len(attributes)
|
||||||
switch = len_attr / 2
|
switch = len_attr / 2
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
## -*- coding: utf-8 -*-
|
||||||
<%inherit file="navbar.tmpl"/>
|
<%inherit file="navbar.tmpl"/>
|
||||||
<%block name="core">
|
<%block name="core">
|
||||||
</%block>
|
</%block>
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
## -*- coding: utf-8 -*-
|
||||||
<%inherit file="base.tmpl"/>
|
<%inherit file="base.tmpl"/>
|
||||||
<%block name="core">
|
<%block name="core">
|
||||||
<div class="row clearfix" style="margin-top:30px">
|
<div class="row clearfix" style="margin-top:30px">
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
## -*- coding: utf-8 -*-
|
||||||
<%inherit file="navbar.tmpl"/>
|
<%inherit file="navbar.tmpl"/>
|
||||||
<%block name="core">
|
<%block name="core">
|
||||||
<div class="row clearfix top-buffer bottom-buffer">
|
<div class="row clearfix top-buffer bottom-buffer">
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
## -*- coding: utf-8 -*-
|
||||||
#<%inherit file="base.tmpl"/>
|
#<%inherit file="base.tmpl"/>
|
||||||
<%block name="navbar">
|
<%block name="navbar">
|
||||||
<div class="row clearfix">
|
<div class="row clearfix">
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
## -*- coding: utf-8 -*-
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var graph = ${graph_js};
|
var graph = ${graph_js};
|
||||||
var roles = ${roles_js};
|
var roles = ${roles_js};
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
## -*- coding: utf-8 -*-
|
||||||
<%inherit file="navbar.tmpl"/>
|
<%inherit file="navbar.tmpl"/>
|
||||||
<%block name="core">
|
<%block name="core">
|
||||||
<div class="row clearfix">
|
<div class="row clearfix">
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
## -*- coding: utf-8 -*-
|
||||||
<%inherit file="navbar.tmpl"/>
|
<%inherit file="navbar.tmpl"/>
|
||||||
<%block name="core">
|
<%block name="core">
|
||||||
<div class="row clearfix">
|
<div class="row clearfix">
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
## -*- coding: utf-8 -*-
|
||||||
<%inherit file="navbar.tmpl"/>
|
<%inherit file="navbar.tmpl"/>
|
||||||
<%block name="core">
|
<%block name="core">
|
||||||
<div class="row clearfix top-buffer bottom-buffer">
|
<div class="row clearfix top-buffer bottom-buffer">
|
||||||
|
Loading…
Reference in New Issue
Block a user