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()
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]))
        if six.PY3:
            return raw_config["main"].get(key, None)
        else:
            return raw_config.get("main", key, None)
    except configparser.Error as err:
        sys.stderr.write("Bad configuration file: {0}".format(err))
        sys.exit(1)


#client.username = "******"
#client.password = "******"
raw_config = configparser.ConfigParser()
filepath = os.path.join(os.path.expanduser("~"), ".config", "fedora")
config = {}
if raw_config.read(filepath):
    client.username = config_value(raw_config, "username")
    client.password = config_value(raw_config, "password")

try:
    packagers = client.group_members("packager")
except AuthError as e:
    client.username = raw_input('Username: '******'Password: ')
    packagers = client.group_members("packager")

sponsors = [s.username for s in packagers if s.role_type == "sponsor"]
packagers = [p.username for p in packagers]
packager_group = client.group_by_name("packager")

DIRECTLY_SPONSORED = {}
for role in packager_group.approved_roles: