Formulaires de saisie des infos du connecteur et de la requete

This commit is contained in:
Paul Marillonnet 2017-03-01 10:24:21 +01:00
parent 47df3a9315
commit 4fc293bb17
3 changed files with 79 additions and 5 deletions

View File

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ldap', '0004_auto_20170228_1050'),
]
operations = [
migrations.RemoveField(
model_name='ldapresource',
name='ldif_file',
),
migrations.RemoveField(
model_name='query',
name='password',
),
migrations.RemoveField(
model_name='query',
name='server',
),
migrations.RemoveField(
model_name='query',
name='user',
),
]

View File

@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ldap', '0005_auto_20170301_0309'),
]
operations = [
migrations.AddField(
model_name='query',
name='ldif_file',
field=models.FileField(upload_to=b'ldif', verbose_name=b'LDIF File', blank=True),
),
migrations.AddField(
model_name='query',
name='operation',
field=models.CharField(default=b'1', max_length=1, verbose_name=b'Operation type', choices=[(b'1', b'Search'), (b'2', b'Add'), (b'3', b'Modify'), (b'4', b'Delete')]),
),
migrations.AlterField(
model_name='query',
name='attributes',
field=models.TextField(default=b'ALL_ATTRIBUTES', help_text=b'List of attributes to retrieve for matching entries.', verbose_name=b'Attributes'),
),
migrations.AlterField(
model_name='query',
name='distinguished_name',
field=models.TextField(default=b'ou=People,dc=entrouvert,dc=lan', help_text=b'Distinguished name for the LDAP operation', verbose_name=b'Distinguished name', blank=True),
),
migrations.AlterField(
model_name='query',
name='scope',
field=models.CharField(default=b'1', max_length=1, verbose_name=b'Scope', choices=[(b'1', b'BASE'), (b'2', b'LEVEL'), (b'3', b'SUBTREE')]),
),
]

View File

@ -18,6 +18,7 @@ from .utils import base
# read py files in passerelle/base/
CHOICES = (('1', 'BASE',), ('2', 'LEVEL',), ('3', 'SUBTREE',))
OPERATIONS = (('1', 'Search',), ('2', 'Add',), ('3', 'Modify',), ('4', 'Delete',))
# Create your models here.
def format_person(p):
@ -33,7 +34,7 @@ def get_org_unit(u):
class LDAPResource(BaseResource):
# XXX normalize max_length values
ldif_file = models.FileField('LDIF File', upload_to='ldif', blank=True) # For future uses
#ldif_file = models.FileField('LDIF File', upload_to='ldif', blank=True) # For future uses
server = models.CharField('Server name', max_length=200, default='localhost')
user = models.CharField('Username (full DN)', max_length=200, blank=True)
password = models.CharField('Password', max_length=50, blank=True)
@ -307,14 +308,18 @@ class Query(models.Model):
#server = models.CharField('Server', max_length=200)
#user = models.CharField('User', max_length=200)
#password = models.CharField('Password', max_length=50)
distinguished_name = models.TextField('Distinguished name', blank=True, #initial=base,
ldif_file = models.FileField('LDIF File', upload_to='ldif', blank=True) # For future uses
distinguished_name = models.TextField('Distinguished name', blank=True, default=base,
help_text='Distinguished name for the LDAP operation')
filters = models.TextField('Filters', blank=True,
help_text='List of filter clauses (LDAP RFC4515 expression)')
attributes = models.TextField('Attributes', blank=True, #initial='ALL_ATTRIBUTES',
attributes = models.TextField('Attributes', blank=False, default='ALL_ATTRIBUTES',
help_text='List of attributes to retrieve for matching entries.')
scope = models.CharField(choices=CHOICES, max_length=1)
#help_text='Search scope for the query') #FIXME
scope = models.CharField('Scope', choices=CHOICES, max_length=1,
blank=False, default='1')
operation = models.CharField('Operation type', choices=OPERATIONS, max_length=1,
blank=False, default='1')
#projections = models.TextField('Projections', blank=True,
# help_text='List of projections (name:expression)')
#order = models.TextField('Order', blank=True,