import flask_wtf
import wtforms

secret_key = '9c2n8t5nrvbyt7cm3v4n87tnv45'

ldap_url = 'ldap://ldap.hackerspace.pl'
dn_format = "uid=%s,ou=people,dc=hackerspace,dc=pl"

admin_dn = 'cn=ldapweb,ou=Services,dc=hackerspace,dc=pl'
admin_pw = 'changeme'

hackerspace_name = 'Warsaw Hackerspace'

readable_names = {
    'commonname': u'Common Name',
    'givenname': u'Given Name',
    'gecos': u'GECOS (public name)',
    'surname': u'Surname',
    'loginshell': u'Shell',
    'telephonenumber': 'Phone Number',
    'mobiletelephonenumber': 'Mobile Number',
    'sshpublickey': 'SSH Public Key',
    'mifareidhash': 'MIFARE ID Hash',
}

full_name = {
    'cn': 'commonname',
    'gecos': 'gecos',
    'sn': 'surname',
    'mobile': 'mobiletelephonenumber',
    'l': 'locality',
}

can_add = set([
    'telephonenumber',
    'mobiletelephonenumber',
    'sshpublickey',
    'mifareidhash',
])
can_delete = can_add
can_modify = can_add | set([
    'givenname', 'surname', 'commonname', 'gecos',
])
can = { 'add':can_add, 'mod':can_modify, 'del':can_delete }
admin_required = set()


perm_errors = {
        'add': 'You cannot add this attribute!',
        'mod': 'You cannot change this attribute!',
        'del': 'You cannot delete this attribute!',
        }
std_templates = {
        'add': 'ops/add.html',
        'mod': 'ops/mod.html',
        'del': 'ops/del.html',
        }



default_field = (wtforms.fields.StringField, {})
fields = { 'telephonenumber': (wtforms.fields.StringField, {'validators': [wtforms.validators.Regexp(r'[+0-9 ]+')]})}

kadmin_passwd = True
kadmin_principal_map = "{}@HACKERSPACE.PL"

TOKEN_LENGTH = 32
