Changeset View
Changeset View
Standalone View
Standalone View
wallace/module_invitationpolicy.py
Show All 10 Lines | |||||
# This program is distributed in the hope that it will be useful, | # This program is distributed in the hope that it will be useful, | ||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
# GNU General Public License for more details. | # GNU General Public License for more details. | ||||
# You should have received a copy of the GNU General Public License | # You should have received a copy of the GNU General Public License | ||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
# | # | ||||
from six import string_types | |||||
import datetime | import datetime | ||||
import os | import os | ||||
import random | import random | ||||
import signal | import signal | ||||
import tempfile | import tempfile | ||||
import time | import time | ||||
try: | try: | ||||
▲ Show 20 Lines • Show All 680 Lines • ▼ Show 20 Lines | def user_dn_from_email_address(email_address): | ||||
if not email_address.split('@')[1] in local_domains: | if not email_address.split('@')[1] in local_domains: | ||||
user_dn_from_email_address.cache[email_address] = None | user_dn_from_email_address.cache[email_address] = None | ||||
return None | return None | ||||
log.debug(_("Checking if email address %r belongs to a local user") % (email_address), level=8) | log.debug(_("Checking if email address %r belongs to a local user") % (email_address), level=8) | ||||
user_dn = auth.find_user_dn(email_address, True) | user_dn = auth.find_user_dn(email_address, True) | ||||
if isinstance(user_dn, basestring): | if isinstance(user_dn, string_types): | ||||
log.debug(_("User DN: %r") % (user_dn), level=8) | log.debug(_("User DN: %r") % (user_dn), level=8) | ||||
else: | else: | ||||
log.debug(_("No user record(s) found for %r") % (email_address), level=8) | log.debug(_("No user record(s) found for %r") % (email_address), level=8) | ||||
# remember this lookup | # remember this lookup | ||||
user_dn_from_email_address.cache[email_address] = user_dn | user_dn_from_email_address.cache[email_address] = user_dn | ||||
return user_dn | return user_dn | ||||
▲ Show 20 Lines • Show All 760 Lines • Show Last 20 Lines |