Ajout fichier d'urls

This commit is contained in:
Paul Marillonnet 2017-02-24 10:04:09 +01:00
parent d00ea8c410
commit 160aa9dfac
3 changed files with 66 additions and 1 deletions

View File

@ -1,9 +1,19 @@
from django.db import models
from passerelle.base.models import BaseResource
from passerelle.utils.jsonresponse import APIError
from passerelle.utils.api import endpoint
import lookups
sys.path.insert(0, "/home/paul/Documents/paul-synchro/django/sp_sso/saml/")
import utils
#TODO
# ldap3 instead of python-ldap
# derive CsvDataSource connector
# Create your models here.
def format_person(p):
data = {} #TODO format to LDAP InetOrgPerson schema?
@ -15,3 +25,18 @@ def format_org_unit(u):
def get_org_unit(u):
return 0
class LDAPConnector(BaseResource):
@classmethod
def get_icon_class(cls):
return 'grid'
@classmethod
def get_verbose_name(cls):
return "LDAP Connector"
@classmethod
def is_enabled(cls):
return True

32
django/ldap_conn/urls.py Normal file
View File

@ -0,0 +1,32 @@
# passerelle - uniform access to multiple data sources and services
# Copyright (C) 2016 Entr'ouvert
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from django.conf.urls import patterns, include, url
from .views import *
urlpatterns = patterns('',
url(r'^(?P<slug>[\w,-]+)/data$', CsvDataView.as_view(), name='csvdatasource-data'),
)
management_urlpatterns = patterns('',
url(r'^(?P<connector_slug>[\w,-]+)/download/$',
CsvDownload.as_view(), name='csv-download'),
url(r'^(?P<connector_slug>[\w,-]+)/queries/new/$',
NewQueryView.as_view(), name='csv-new-query'),
url(r'^(?P<connector_slug>[\w,-]+)/queries/(?P<pk>[\w,-]+)/$',
UpdateQueryView.as_view(), name='csv-edit-query'),
)

View File

@ -1,3 +1,11 @@
from django.shortcuts import render
from django.shortcuts import render, redirect
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
#TODO
# derive csv connector
# use ldap3 instead of python-ldap
# Create your views here.
def dummy_view(request):
return HttpResponse("Dummy LDAP connector view.")