Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
sogodovecotldapandgroups [2016/02/02 22:08]
jim Add blank line.
sogodovecotldapandgroups [2016/02/05 12:44] (current)
jim Fix Python script.
Line 82: Line 82:
                    ​['​memberOf'​])                    ​['​memberOf'​])
   for dn, entry in res:   for dn, entry in res:
-      for g in entry['​memberOf'​]:​ +      ​try: 
-          # Returns '​cn=All UK staff,​ou=Groups,​dc=example,​dc=com'​ etc. +          ​for g in entry['​memberOf'​]:​ 
-          # Fish out 'All UK staff' as group name. +              # Returns '​cn=All UK staff,​ou=Groups,​dc=example,​dc=com'​ etc. 
-          groups.append(g.split(',',​ 1)[0][3:​]) +              # Fish out 'All UK staff' as group name. 
-  +              groups.append(g.split(',',​ 1)[0][3:​]) 
 +      ​except KeyError: 
 +          pass    # User in no groups. 
 +          ​
   os.environ["​ACL_GROUPS"​] = ","​.join(groups)   os.environ["​ACL_GROUPS"​] = ","​.join(groups)
   try:   try:
 
sogodovecotldapandgroups.txt · Last modified: 2016/02/05 12:44 by jim
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0