From: Tony Mack Date: Fri, 20 Aug 2010 22:29:27 +0000 (+0000) Subject: moved filter_creds_by_caller() from auth.py to credential.py X-Git-Tag: sfa-1.0-0~29 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=c205adab13e918293f0a031d7dfa11e90b13bfad;p=sfa.git moved filter_creds_by_caller() from auth.py to credential.py --- diff --git a/sfa/trust/auth.py b/sfa/trust/auth.py index 8570c786..88326396 100644 --- a/sfa/trust/auth.py +++ b/sfa/trust/auth.py @@ -17,22 +17,6 @@ from sfa.util.sfaticket import * from sfa.util.sfalogging import logger import sys -def filter_creds_by_caller(self, creds, caller_hrn): - """ - Returns a list of creds who's gid caller matches the - specified caller hrn - """ - if not isinstance(creds, list): creds = [creds] - caller_creds = [] - for cred in creds: - try: - tmp_cred = Credential(string=cred) - if tmp_cred.get_gid_caller().get_hrn() == caller_hrn: - caller_creds.append(cred) - except: pass - return caller_creds - - class Auth: """ Credential based authentication diff --git a/sfa/trust/credential.py b/sfa/trust/credential.py index 4735a696..de5fbae1 100644 --- a/sfa/trust/credential.py +++ b/sfa/trust/credential.py @@ -171,6 +171,21 @@ 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(self, creds, caller_hrn): + """ + Returns a list of creds who's gid caller matches the + specified caller hrn + """ + if not isinstance(creds, list): creds = [creds] + caller_creds = [] + for cred in creds: + try: + tmp_cred = Credential(string=cred) + if tmp_cred.get_gid_caller().get_hrn() == caller_hrn: + caller_creds.append(cred) + except: pass + return caller_creds + class Credential(object): ##