From 45783d105788cd2a834ffca14c5b788d40d32d3d Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Sun, 16 Oct 2011 22:16:32 -0400 Subject: [PATCH] filter_creds_by_caller() supports list args --- sfa/trust/credential.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sfa/trust/credential.py b/sfa/trust/credential.py index 575911bc..a18019d8 100644 --- a/sfa/trust/credential.py +++ b/sfa/trust/credential.py @@ -209,17 +209,19 @@ class Signature(object): # not be changed else the signature is no longer valid. So, once # you have loaded an existing signed credential, do not call encode() or sign() on it. -def filter_creds_by_caller(creds, caller_hrn): +def filter_creds_by_caller(creds, caller_hrn_list): """ Returns a list of creds who's gid caller matches the specified caller hrn """ if not isinstance(creds, list): creds = [creds] + if not isinstance(caller_hrn_list, list): + caller_hrn_list = [caller_hrn_list] caller_creds = [] for cred in creds: try: tmp_cred = Credential(string=cred) - if tmp_cred.get_gid_caller().get_hrn() == caller_hrn: + if tmp_cred.get_gid_caller().get_hrn() in caller_hrn_list: caller_creds.append(cred) except: pass return caller_creds -- 2.45.2