README.md updated and reorganized, Improved error handling for configparser and ldap manager, requirements.txt added
This commit is contained in:
parent
347843cb24
commit
e37592bdc6
9 changed files with 72 additions and 31 deletions
|
|
@ -3,11 +3,9 @@ import config
|
|||
import json
|
||||
import math
|
||||
|
||||
from config import ldap_manager
|
||||
from config import ldap_manager, etcd_client
|
||||
from helper import resolve_product
|
||||
|
||||
etcd_client = config.etcd_client
|
||||
|
||||
|
||||
class ValidationException(Exception):
|
||||
"""Validation Error"""
|
||||
|
|
@ -105,7 +103,7 @@ class AddProductSchema(BaseSchema):
|
|||
user = self.objects['user']
|
||||
user = json.loads(user.entry_to_json())
|
||||
uid, ou, *dc = user['dn'].replace('ou=', '').replace('dc=', '').replace('uid=', '').split(',')
|
||||
if ou != config.config['ldap']['internal_user_ou']:
|
||||
if ou != config.config.get('ldap', 'internal_user_ou', fallback='users'):
|
||||
raise ValidationException('You do not have access to create product.')
|
||||
|
||||
product = resolve_product(self.specs.value['usable-id'], etcd_client)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue