Skip to content

Commit 8f05ba7

Browse files
committed
Filter out users with no associated projects
1 parent 0e87547 commit 8f05ba7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

osg-comanage-project-usermap.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717

1818
_usage = f"""\
19-
usage: [PASS=...] {SCRIPT} [OPTIONS]
19+
usage: {SCRIPT} [OPTIONS]
2020
2121
OPTIONS:
22-
-u LDAP_USER[:PASS] specify LDAP user for reading data from LDAP server
22+
-u LDAP_USER specify LDAP user for reading data from LDAP server
2323
-s LDAP_SERVER specify LDAP server to read data from
2424
-a ldap_authfile specify path to file to open and read LDAP authtok
2525
-o outfile specify output file (default: write to stdout)
@@ -91,7 +91,11 @@ def get_osguser_groups(filter_group_name=None):
9191
ldap_users = utils.get_ldap_active_users_and_groups(options.ldap_server, options.ldap_user, options.ldap_authtok, filter_group_name)
9292
topology_projects = requests.get(f"{TOPOLOGY_ENDPOINT}/miscproject/json").json()
9393
project_names = topology_projects.keys()
94-
return {user: [p for p in groups if p in project_names] for user, groups in ldap_users.items()}
94+
return {
95+
user: [g for g in groups if g in project_names]
96+
for user, groups in ldap_users.items()
97+
if any(g in project_names for g in groups)
98+
}
9599

96100

97101
def parse_localmap(inputfile):

0 commit comments

Comments
 (0)