def _set_insecure(self, insecure): self._insecure = insecure self.proxy = FasProxyClient(self.base_url, useragent=self.useragent, session_as_cookie=False, debug=self.debug, insecure=insecure) return insecure
def __init__(self, timeout): self.debug = config.get('jsonfas.debug', False) if not self.fas: self.fas = FasProxyClient(self.fas_url, debug=self.debug, session_name=config.get('visit.cookie.name', 'tg-visit'), useragent='JsonFasVisitManager/%s' % __version__) BaseVisitManager.__init__(self, timeout) log.debug('JsonFasVisitManager.__init__: exit')
def __init__(self, timeout): self.log = log if not self.fas: JsonFasVisitManager.fas = FasProxyClient( self.fas_url, debug=self.debug, session_name=config.get('visit.cookie.name', 'tg-visit'), useragent='JsonFasVisitManager/%s' % __version__, retries=3) BaseVisitManager.__init__(self, timeout) self.log.debug('JsonFasVisitManager.__init__: exit')
def __init__(self, base_url='https://admin.fedoraproject.org/accounts/', *args, **kwargs): '''Create the AccountSystem client object. :kwargs base_url: Base of every URL used to contact the server. Defaults to the Fedora Project FAS instance. :kwargs useragent: useragent string to use. If not given, default to "Fedora Account System Client/VERSION" :kwargs debug: If True, log debug information :kwargs username: username for establishing authenticated connections :kwargs password: password to use with authenticated connections :kwargs session_cookie: **Deprecated** Use session_id instead. User's session_cookie to connect to the server :kwargs session_id: user's session_id to connect to the server :kwargs cache_session: if set to true, cache the user's session cookie on the filesystem between runs. ''' if 'useragent' not in kwargs: kwargs['useragent'] = \ 'Fedora Account System Client/%s' % __version__ super(AccountSystem, self).__init__(base_url, *args, **kwargs) # We need a single proxy for the class to verify username/passwords # against. if not self.proxy: self.proxy = FasProxyClient(base_url, useragent=self.useragent, session_as_cookie=False, debug=self.debug, insecure=self.insecure) # Preseed a list of FAS accounts with bugzilla addresses # This allows us to specify a different email for bugzilla than is # in the FAS db. It is a hack, however, until FAS has a field for the # bugzilla address. self.__bugzilla_email = { # Konstantin Ryabitsev: [email protected] 100029: '*****@*****.**', # Sean Reifschneider: [email protected] 100488: '*****@*****.**', # Karen Pease: [email protected] 100281: '*****@*****.**', # Robert Scheck: [email protected] 100093: '*****@*****.**', # Scott Bakers: [email protected] 100881: '*****@*****.**', # Colin Charles: [email protected] 100014: '*****@*****.**', # W. Michael Petullo: [email protected] 100136: '*****@*****.**', # Elliot Lee: [email protected] 100060: '*****@*****.**', # Control Center Team: Bugzilla user but email doesn't exist 9908: '*****@*****.**', # Máirín Duffy 100548: '*****@*****.**', # Muray McAllister: [email protected] 102321: '*****@*****.**', # William Jon McCann: [email protected] 102489: '*****@*****.**', # Matt Domsch's rebuild script -- bz email goes to /dev/null 103590: '*****@*****.**', # Sindre Pedersen Bjørdal: [email protected] 100460: '*****@*****.**', # Jesus M. Rodriguez: [email protected] 102180: '*****@*****.**', # Roozbeh Pournader: [email protected] 100350: '*****@*****.**', # Michael DeHaan: [email protected] 100603: '*****@*****.**', # Sebastian Gosenheimer: [email protected] 103647: '*****@*****.**', # Ben Konrath: [email protected] 101156: '*****@*****.**', # Kai Engert: [email protected] 100399: '*****@*****.**', # William Jon McCann: [email protected] 102952: '*****@*****.**', # Simon Wesp: [email protected] 109464: '*****@*****.**', # Robert M. Albrecht: [email protected] 101475: '*****@*****.**', # Davide Cescato: [email protected] 123204: '*****@*****.**', # Nick Bebout: [email protected] 101458: '*****@*****.**', # Niels Haase: [email protected] 126862: '*****@*****.**', # Thomas Janssen: [email protected] 103110: '*****@*****.**', # Michael J Gruber: '*****@*****.**' 105113: '*****@*****.**', # Juan Manuel Rodriguez Moreno: '*****@*****.**' 101302: '*****@*****.**', # Andrew Cagney: '*****@*****.**' 102169: '*****@*****.**', # Jeremy Katz: '*****@*****.**' 100036: '*****@*****.**', # Dominic Hopf: '*****@*****.**' 124904: '*****@*****.**', # Christoph Wickert: '*****@*****.**': 100271: '*****@*****.**', # Elliott Baron: '*****@*****.**' 106760: '*****@*****.**', # Thomas Spura: '*****@*****.**' 111433: '*****@*****.**', # Adam Miller: '*****@*****.**' 110673: '*****@*****.**', # Garrett Holmstrom: '*****@*****.**' 131739: '*****@*****.**', # Tareq Al Jurf: [email protected] 109863: '*****@*****.**', # Josh Kayse: [email protected] 148243: '*****@*****.**', # Behdad Esfahbod: [email protected] 100102: '*****@*****.**', # Daniel Bruno: [email protected] 101608: '*****@*****.**', # Beth Lynn Eicher: [email protected] 148706: '*****@*****.**', # Andre Robatino: [email protected] 114970: '*****@*****.**', # Jeff Sheltren: [email protected] 100058: '*****@*****.**', # Josh Boyer: [email protected] 100115: '*****@*****.**', # Matthew Miller: [email protected] 100042: '*****@*****.**', # Jamie Nguyen: [email protected] 160587: '*****@*****.**', # Nikos Roussos: [email protected] 144436: '*****@*****.**', # Benedikt Schäfer: [email protected] 154726: '*****@*****.**', # Ricky Elrod: [email protected] 139137: '*****@*****.**', # David Xie: [email protected] 167133: '*****@*****.**', # Felix Schwarz: [email protected] 103551: '*****@*****.**', # Martin Holec: [email protected] 137561: '*****@*****.**', # John Dulaney: [email protected] 149140: '*****@*****.**', # Niels de Vos: [email protected] 102792: '*****@*****.**', # Shawn Wells: [email protected] 156515: '*****@*****.**', # Christopher Tubbs: [email protected] 160404: '*****@*****.**', } # A few people have an email account that is used in owners.list but # have setup a bugzilla account for their primary account system email # address now. Map these here. self.__alternate_email = { # Damien Durand: [email protected] '*****@*****.**': 100406, # Kevin Fenzi: [email protected] '*****@*****.**': 100037, } for bugzilla_map in self.__bugzilla_email.items(): self.__alternate_email[bugzilla_map[1]] = bugzilla_map[0]
# # python-fedora is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with python-fedora; if not, see <http://www.gnu.org/licenses/> # ''' .. moduleauthor:: Ignacio Vazquez-Abrams <*****@*****.**> .. moduleauthor:: Toshio Kuratomi <*****@*****.**> ''' from fedora.client import FasProxyClient from django.conf import settings connection = None if not connection: connection = FasProxyClient(base_url=settings.FAS_URL, useragent=settings.FAS_USERAGENT) def person_by_id(userid): sid, userinfo = connection.person_by_id(userid, { 'username': settings.FAS_USERNAME, 'password': settings.FAS_PASSWORD }) return userinfo
def login(username, password): fas = FasProxyClient() user = fas.get_user_info({'username': username, 'password': password}) roles = [g.name for g in user[1]['approved_memberships']] return roles