# Path: pyvac/helpers/ldap.py
# class UnknownLdapUser(Exception):
# class LdapWrapper(object):
# class LdapCache(object):
#     def __init__(self, filename):
#     def _bind(self, dn, password):
#     def _search(self, what, retrieve):
#     def _search_admin(self, what, retrieve):
#     def _search_team(self, what, retrieve):
#     def _search_chapter(self, what, retrieve):
#     def _search_by_item(self, item):
#     def search_user_by_login(self, login):
#     def search_user_by_dn(self, user_dn):
#     def _extract_country(self, user_dn):
#     def _extract_cn(self, user_dn):
#     def _convert_date(self, date):
#     def _cast_arrivaldate(self, date):
#     def parse_ldap_entry(self, user_dn, entry):
#     def authenticate(self, login, password):
#     def add_user(self, user, password, unit=None, uid=None):
#     def update_user(self, user, password=None, unit=None, arrival_date=None,
#                     uid=None, photo=None, mobile=None):
#     def delete_user(self, user_dn):
#     def update_team(self, team, members):
#     def update_managers(self, old, new):
#     def add_manager(self, user_dn):
#     def remove_manager(self, user_dn):
#     def update_admins(self, old, new):
#     def add_admin(self, user_dn):
#     def remove_admin(self, user_dn):
#     def get_hr_by_country(self, country, full=False):
#     def list_users(self):
#     def list_ou(self):
#     def list_teams(self):
#     def list_chapters(self):
#     def list_manager(self):
#     def list_admin(self):
#     def list_arrivals_country(self, country):
#     def list_active_users(self):
#     def get_users_units(self):
#     def get_team_members(self, team):
#     def create_team(self, team):
#     def delete_team(self, team):
#     def __new__(cls, *args, **kwargs):
#     def configure(cls, settings):
#     def from_config(cls, config, **kwargs):
# def hashPassword(password):
# def randomstring(length=8):


import json
    import datetime
    import datetime
from .ldap import dn
from datetime import timedelta
from pyramid.httpexceptions import HTTPNotFound
# -*- coding: utf-8 -*-


def flash_type(message):
    if ';' in message:
        return message.split(';', 1)[0]
    return 'error'


def flash_msg(message):
    if ';' in message:
        return message.split(';', 1)[1]

# Path: pyvac/helpers/ldap.py
# class UnknownLdapUser(Exception):
# class LdapWrapper(object):
# class LdapCache(object):
#     def __init__(self, filename):
#     def _bind(self, dn, password):
#     def _search(self, what, retrieve):
#     def _search_admin(self, what, retrieve):
#     def _search_team(self, what, retrieve):
#     def _search_chapter(self, what, retrieve):
#     def _search_by_item(self, item):
#     def search_user_by_login(self, login):
#     def search_user_by_dn(self, user_dn):
#     def _extract_country(self, user_dn):
#     def _extract_cn(self, user_dn):
#     def _convert_date(self, date):
#     def _cast_arrivaldate(self, date):
#     def parse_ldap_entry(self, user_dn, entry):
#     def authenticate(self, login, password):
#     def add_user(self, user, password, unit=None, uid=None):
#     def update_user(self, user, password=None, unit=None, arrival_date=None,
#                     uid=None, photo=None, mobile=None):
#     def delete_user(self, user_dn):
#     def update_team(self, team, members):
#     def update_managers(self, old, new):
#     def add_manager(self, user_dn):
#     def remove_manager(self, user_dn):
#     def update_admins(self, old, new):
#     def add_admin(self, user_dn):
#     def remove_admin(self, user_dn):
#     def get_hr_by_country(self, country, full=False):
#     def list_users(self):
#     def list_ou(self):
#     def list_teams(self):
#     def list_chapters(self):
#     def list_manager(self):
#     def list_admin(self):
#     def list_arrivals_country(self, country):
#     def list_active_users(self):
#     def get_users_units(self):
#     def get_team_members(self, team):
#     def create_team(self, team):
#     def delete_team(self, team):
#     def __new__(cls, *args, **kwargs):
#     def configure(cls, settings):
#     def from_config(cls, config, **kwargs):
# def hashPassword(password):
# def randomstring(length=8):


# Path: pyvac/helpers/util.py
import json
    import datetime
    import datetime
from .ldap import dn
from datetime import timedelta
from pyramid.httpexceptions import HTTPNotFound

# -*- coding: utf-8 -*-


def flash_type(message):
    if ';' in message:
        return message.split(';', 1)[0]
    return 'error'


def flash_msg(message):
    if ';' in message:
        return message.split(';', 1)[1]

    return message