def validateFedoraUser(request):
    # Setup FAS client
    fasclient = AccountSystem()
    try:
        fasusername = fedora_cert.read_user_cert()
        print " * FAS username: %s" % fasusername
    except:
        fasusername = raw_input(' * FAS username: '******' * FAS password: ')
    fasclient.username = fasusername
    fasclient.password = password

    # Query user
    fasid = request["fasid"]
    email = request["email"]
    person = fasclient.person_by_username(fasid)

    # Validate user
    if not person:
        raise Exception("Request submitter %s does not match a known FAS username" % fasid)

    if not person["bugzilla_email"] == email:
        raise Exception("Email %s of request submitter does not match email of specified FAS user %s" % (email, fasid))

    if "cla_fpca" not in person["group_roles"] or person["group_roles"]["cla_fpca"]["role_status"] != "approved":
        raise Exception("Request submitter %s has not signed the Fedora Project Contributor Agreement" % fasid)

    if "packager" not in person["group_roles"] or person["group_roles"]["packager"]["role_status"] != "approved":
        if request["branches"].difference(set(["master"])):
            raise Exception("Request contains patches for stable-release branches, but user %s is not a packager" % fasid)

    print " => User %s successfully validated" % fasid
예제 #2
0
def _get_last_website_login(username):
    """ Retrieve from FAS the last time this user has been seen.

    :arg username, the fas username from who we would like to see the
        last connection in FAS.
    """
    from fedora.client import AccountSystem
    fasclient = AccountSystem()

    log.debug('Querying FAS for user: {0}'.format(username))
    try:
        import fedora_cert
        fasusername = fedora_cert.read_user_cert()
    except Exception:
        log.debug('Could not read Fedora cert, using login name')
        if PY3:
            fasusername = input('FAS username: '******'FAS username: '******'FAS password for %s: ' % fasusername)
    fasclient.username = fasusername
    fasclient.password = password
    person = fasclient.person_by_username(username)
    print('Last login in FAS:')
    print('   %s %s' % (username, person['last_seen'].split(' ')[0]))
    print()
예제 #3
0
 def user_active(self, name):
     user_json = dict()
     account = AccountSystem(username=self.username, password=self.password)
     try:
         user_json = account.person_by_username(name)
     except AuthError:
         print("[*] Invalid Username / Password")
         return 1
     try:
         if user_json['status'] == 'active':
             return True
         else:
             return False
     except KeyError:
         return False
예제 #4
0
 def user_active(self, name):
     user_json = dict()
     account = AccountSystem(username=self.username,
                         password=self.password)
     try:
         user_json = account.person_by_username(name)
     except AuthError:
         print("[*] Invalid Username / Password")
         return 1
     try:
         if user_json['status'] == 'active':
             return True
         else:
             return False
     except KeyError:
         return False
def _get_last_website_login(username):
    """ Retrieve from FAS the last time this user has been seen.

    :arg username, the fas username from who we would like to see the
        last connection in FAS.
    """
    from fedora.client import AccountSystem
    fasclient = AccountSystem()

    log.debug('Querying FAS for user: {0}'.format(username))
    try:
        fasusername = fedora_cert.read_user_cert()
    except Exception:
        log.debug('Could not read Fedora cert, using login name')
        fasusername = raw_input('FAS username: '******'FAS password for %s: ' % fasusername)
    fasclient.username = fasusername
    fasclient.password = password
    person = fasclient.person_by_username(username)
    print('Last login in FAS:')
    print('   %s %s' % (username, person['last_seen'].split(' ')[0]))
예제 #6
0
        print('Using default gpg_home')
    else:
        print('Using gpg_home: %(gpghome)s' % {'gpghome': args.gpg_home})

if args.gpg_home != None:
    os.putenv('GNUPGHOME', args.gpg_home)

fas = AccountSystem(args.site,
                    username=args.admin_user,
                    password=args.admin_pass,
                    insecure=args.insecure)

if args.verbose:
    print('Getting user details...')
try:
    details = fas.person_by_username(args.target_user)
except AuthError:
    print('Failed to login to FAS. Please check admin_user and admin_pass!')
    sys.exit(2)
except ServerError:
    print('Failed to retrieve user details: the server reported an error!')
    sys.exit(3)

if not 'username' in list(details.keys()):
    print('Error: user %(username)s is not known on this FAS site!' %
          {'username': args.target_user})
    sys.exit(4)

if not 'security_question' in list(details.keys()):
    print(
        'Error: security_question was not retrieved by FAS! Are you sure you are using FAS >= 0.8.14, and that admin_user has the privileges to retrieve security_question?'
if args.verbose:
    if args.gpg_home == None:
        print 'Using default gpg_home'
    else:
        print 'Using gpg_home: %(gpghome)s' % {'gpghome': args.gpg_home}

if args.gpg_home != None:
    os.putenv('GNUPGHOME', args.gpg_home)

fas = AccountSystem(args.site, username=args.admin_user, password=args.admin_pass, insecure=args.insecure)

if args.verbose:
    print 'Getting user details...'
try:
    details = fas.person_by_username(args.target_user)
except AuthError:
    print 'Failed to login to FAS. Please check admin_user and admin_pass!'
    sys.exit(2)
except ServerError:
    print 'Failed to retrieve user details: the server reported an error!'
    sys.exit(3)

if not 'username' in details.keys():
    print 'Error: user %(username)s is not known on this FAS site!' % {'username': args.target_user}
    sys.exit(4)

if not 'security_question' in details.keys():
    print 'Error: security_question was not retrieved by FAS! Are you sure you are using FAS >= 0.8.14, and that admin_user has the privileges to retrieve security_question?'
    sys.exit(5)
예제 #8
0
username = raw_input('FAS Username: '******'\n', ''))

	user = report['user']
	url = report['url']
	error = report['error']

	user_data = fas2.person_by_username(user)
	user_realname = user_data.human_name
	user_email = user_data.email

	if user_realname == None:
		# Some users don't set the real name on FAS
		user_realname = report['user']

	message = """From: %s <%s>
To: %s <%s>
MIME-Version: 1.0
Content-type: text/plain
Subject: Fedora Planet Warning\n
Hello %s,

The URL you have configured for the Fedora Planet is not working.