Skip to content
Browse files
Move auth.cfg into authz.yaml
The old auth.cfg had three DNs: AUTH, GROUPS, SERVICES. Create lists
of these in the new yaml config. Load the values from there, to pass
to the Generator. The EXPLICIT config is a simple transfer.

Note: this still produces the same authz files as the old
  • Loading branch information
gstein committed Mar 23, 2021
1 parent b21a08c commit 22c5b2f4712a30f4fad217b040a56975b2cc5bac
Showing 1 changed file with 13 additions and 8 deletions.
@@ -35,6 +35,11 @@

class Authorization:
# There are some groups with custom DN values
DN_AUTH = 'ou=auth,ou=groups,dc=apache,dc=org'
DN_GROUPS = 'ou=groups,dc=apache,dc=org'
DN_SERVICES = 'ou=groups,ou=services,dc=apache,dc=org'

def __init__(self, cfg, debug=False):
self.cfg = cfg
self.debug = debug
@@ -48,15 +53,15 @@ def __init__(self, cfg, debug=False):
url = cfg['config']['ldap']
print('LDAP:', url)

### read auth.conf ... better yet: merge that into the yaml config
### for now: ln -s modules/subversion_server/files/authorization/auth.conf .
import configparser
cp = configparser.ConfigParser()'auth.conf')
special = dict((k, v.strip()) for k, v in cp.items('special'))
explicit = dict((k, v.split()) for k, v in cp.items('explicit'))
print('AUTH:', cfg['special']['auth'])
print('GROUPS:', cfg['special']['groups'])
print('SERVICES:', cfg['special']['services'])
special = { a: self.DN_AUTH for a in cfg['special']['auth'] }
special.update((g, self.DN_GROUPS) for g in cfg['special']['groups'])
special.update((s, self.DN_SERVICES) for s in cfg['special']['services'])
print('EXPLICIT:', cfg['explicit'])

self.gen = gen.Generator(url, special, explicit)
self.gen = gen.Generator(url, special, cfg['explicit'])

tdir = cfg['generate']['template_dir']
odir = cfg['generate']['output_dir']

0 comments on commit 22c5b2f

Please sign in to comment.