Creation modele pour formulaire de requete sur le LDAP
This commit is contained in:
parent
39855997f6
commit
91552103c2
|
@ -1,22 +1,20 @@
|
|||
from django.core.urlresolvers import reverse
|
||||
from django.db import models
|
||||
from django import forms
|
||||
from passerelle.base.models import BaseResource
|
||||
from passerelle.utils.jsonresponse import APIError
|
||||
from passerelle.utils.api import endpoint
|
||||
|
||||
#import lookups
|
||||
|
||||
import sys
|
||||
#sys.path.insert(0, "/home/paul/Documents/paul-synchro/django/sp_sso/saml/")
|
||||
#import utils
|
||||
|
||||
# get_all_apps
|
||||
# get_models
|
||||
from .utils import base
|
||||
|
||||
|
||||
#TODO
|
||||
# ldap3 instead of python-ldap
|
||||
# derive CsvDataSource connector
|
||||
|
||||
CHOICES = (('1', 'BASE',), ('2', 'LEVEL',), ('3', 'SUBTREE',))
|
||||
|
||||
# Create your models here.
|
||||
def format_person(p):
|
||||
data = {} #TODO format to LDAP InetOrgPerson schema?
|
||||
|
@ -61,23 +59,30 @@ class Query(models.Model):
|
|||
label = models.CharField('Label', max_length=100)
|
||||
description = models.TextField('Description', blank=True)
|
||||
filters = models.TextField('Filters', blank=True,
|
||||
help_text='List of filter clauses (Python expression)')
|
||||
projections = models.TextField('Projections', blank=True,
|
||||
help_text='List of projections (name:expression)')
|
||||
order = models.TextField('Order', blank=True,
|
||||
help_text='Ordering columns')
|
||||
distinct = models.TextField('Distinct', blank=True,
|
||||
help_text='Distinct columns')
|
||||
structure = models.CharField('Structure',
|
||||
max_length=20,
|
||||
choices=[
|
||||
('array', 'Array'),
|
||||
('dict', 'Dictionary'),
|
||||
('tuples', 'Tuples'),
|
||||
('onerow', 'Single Row'),
|
||||
('one', 'Single Value')],
|
||||
default='dict',
|
||||
help_text='Data structure used for the response')
|
||||
help_text='List of filter clauses (LDAP RFC4515 expression)')
|
||||
attributes = models.TextField('Attributes', blank=True, initial='ALL_ATTRIBUTES',
|
||||
help_text='List of attributes to retrieve for matching entries'.)
|
||||
scope = models.ChoiceField(widget=forms.RadioSelect,
|
||||
choices=CHOICES,
|
||||
help_text='Search scope for the query') #FIXME
|
||||
distinguished_name = models.TextField('Distinguished name', blank=True, initial=base,
|
||||
help_text='Distinguished name for the LDAP operation')
|
||||
#projections = models.TextField('Projections', blank=True,
|
||||
# help_text='List of projections (name:expression)')
|
||||
#order = models.TextField('Order', blank=True,
|
||||
# help_text='Ordering columns')
|
||||
#distinct = models.TextField('Distinct', blank=True,
|
||||
# help_text='Distinct columns')
|
||||
#structure = models.CharField('Structure',
|
||||
# max_length=20,
|
||||
# choices=[
|
||||
# ('array', 'Array'),
|
||||
# ('dict', 'Dictionary'),
|
||||
# ('tuples', 'Tuples'),
|
||||
# ('onerow', 'Single Row'),
|
||||
# ('one', 'Single Value')],
|
||||
# default='dict',
|
||||
# help_text='Data structure used for the response')
|
||||
|
||||
class Meta:
|
||||
ordering = ['slug']
|
||||
|
|
Reference in New Issue