Exemplo n.º 1
0
def check_read_access(username, svnrepo, svnpath):
    if user.user_is_super_user():
        return True
    if user.user_is_restricted():
        group_name = get_group_from_svnrepo_path(svnrepo)
        group_id = group.set_group_info_from_name(group_name)
        if not user.user_is_member(group_id):
            return False

    # make sure that usernames are lowercase
    username = username.lower()
    return __check_read_access_with_epel_viewvc(username, svnrepo, svnpath)
Exemplo n.º 2
0
def check_read_access(username, svnrepo, svnpath):
    # make sure that usernames are lowercase
    username = get_name_for_svn_access(svnrepo, username)

    if user.user_is_super_user():
        return True
    if user.user_is_restricted():
        group_name = get_group_from_svnrepo_path(svnrepo)
        group_id = group.set_group_info_from_name(group_name)
        if not user.user_is_member(group_id):
            return False

    return __check_read_access_with_epel_viewvc(username, svnrepo, svnpath)
Exemplo n.º 3
0
def check_read_access(username, svnrepo, svnpath):
    
    global SVNACCESS, SVNGROUPS

    # make sure that usernames are lowercase
    username = get_name_for_svn_access(svnrepo, username)

    #f = open('/tmp/viewvc.log', 'a');
    #f.write(svnrepo+": "+username+"\n");
    #f.close();
    
    if user.user_is_super_user():
        return True
    if user.user_is_restricted():
        path_elements = string.split(svnrepo,'/')
        group_name = path_elements[len(path_elements)-1]
        group_id = group.set_group_info_from_name(group_name)
        if not user.user_is_member(group_id):
            return False

    if SVNACCESS is None:
        fetch_access_file(svnrepo)

    perm = ''
    path = '/'+svnpath
    while True:
        if SVNACCESS.has_key(username) and SVNACCESS[username].has_key(path):
            perm = SVNACCESS[username][path]
            #print "match: SVNACCESS[",username,"][",path,"]",perm
            break
        elif SVNACCESS.has_key('*') and SVNACCESS['*'].has_key(path):
            perm = SVNACCESS['*'][path]
            #print "match: SVNACCESS[*][",path,"]",perm
            break
        else:
            # see if it maches higher in the path
            if path == '/': break
            idx = string.rfind(path,'/')
            if idx == 0:
                path = '/'
            else:
                path = path[:idx]
    
    if perm == 'r' or perm == 'rw':
        return True
    else:
        return False
Exemplo n.º 4
0
def check_read_access(username, svnrepo, svnpath):

    global SVNACCESS, SVNGROUPS

    # make sure that usernames are lowercase
    username = get_name_for_svn_access(svnrepo, username)

    #f = open('/tmp/viewvc.log', 'a');
    #f.write(svnrepo+": "+username+"\n");
    #f.close();

    if user.user_is_super_user():
        return True
    if user.user_is_restricted():
        path_elements = string.split(svnrepo, '/')
        group_name = path_elements[len(path_elements) - 1]
        group_id = group.set_group_info_from_name(group_name)
        if not user.user_is_member(group_id):
            return False

    if SVNACCESS is None:
        fetch_access_file(svnrepo)

    perm = ''
    path = '/' + svnpath
    while True:
        if SVNACCESS.has_key(username) and SVNACCESS[username].has_key(path):
            perm = SVNACCESS[username][path]
            #print "match: SVNACCESS[",username,"][",path,"]",perm
            break
        elif SVNACCESS.has_key('*') and SVNACCESS['*'].has_key(path):
            perm = SVNACCESS['*'][path]
            #print "match: SVNACCESS[*][",path,"]",perm
            break
        else:
            # see if it maches higher in the path
            if path == '/': break
            idx = string.rfind(path, '/')
            if idx == 0:
                path = '/'
            else:
                path = path[:idx]

    if perm == 'r' or perm == 'rw':
        return True
    else:
        return False