Skip to content

Commit

Permalink
ManualOverride.get_current_groups: Better handling of no ismemberof a…
Browse files Browse the repository at this point in the history
…ttributes #31

Does not raise ValueError
  • Loading branch information
astrochun committed Jul 14, 2020
1 parent 14de970 commit 7dd4195
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions requiam/manual_override.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,19 @@ def get_current_groups(uid, ldap_dict, log):
mo_ldc.ldap_attribs = ['ismemberof']

user_query = f'(uid={uid})'
print(user_query)

mo_ldc.ldc.search(mo_ldc.ldap_search_dn, user_query, attributes=mo_ldc.ldap_attribs)

membership = mo_ldc.ldc.entries[0].ismemberof.value

figshare_dict = dict()

if isinstance(membership, type(None)):
log.warning("No ismembersof attributes")
raise TypeError

figshare_dict = dict()
figshare_dict['portal'] = ''
figshare_dict['quota'] = ''
return figshare_dict

# Extract portal
portal_stem = figshare_stem('portal')
Expand Down

0 comments on commit 7dd4195

Please sign in to comment.