A user asked for help installing Portal Client . Which is a:
Python-based client for downloading data files hosted by the an instance of the portal software developed by the GDC and further modified by the Institute for Genome Sciences (IGS)
You can install this in any directory that you have write permissions to, and you will need python3 installed.
Here are the quickie install instructions:
git clone https://github.com/IGS/portal_client;
python3 -m venv --copies VENV_portal_client;
source VENV_portal_client/bin/activate;
pip install -r portal_client/requirements.txt;
cd portal_client;
easy_install . ;
Any time you need to run the tool, source the Python Virtual Environment (virtualenv) and run the command. For example:
source VENV_portal_client/bin/activate;
portal_client --help;
If you use a lot of Python virtualenv’s, I suggest using the virtualenvwrapper tool, which makes it easier to manage and run many virtualenv’s:https://virtualenvwrapper. readthedocs .io/en/latest/
After you clone the Edx repo there you will find a (undocumented) list of packages required to install on Ubuntu:
requirements/system/ubuntu/apt-packages.txt
These packages and others are required for Debian Stretch. First, install these packages:
sudo apt-get install $(grep -vE "^\s*#" requirements/system/ubuntu/apt-packages.txt | tr "\n" " ")
And then install these packages:
sudo apt-get install python-scipy python-numpy build-essential python-dev gfortran libfreetype6-dev libjpeg-dev libtiff5-dev zlib1g-dev libpng-dev libxml2-dev libxslt-dev yui-compressor graphviz libgraphviz-dev graphviz-dev mysql-server libmysqlclient-dev libgeos-dev libreadline7 libreadline7-dev mongodb nodejs mysql-client virtualenvwrapper libgeos-ruby1.8 lynx-cur libxmlsec1-dev swig libsqlclient-dev libxmlsec1
Like the photo? See a bigger version on Flickr .
Unless your an LDAP expert it’s not obvious how to find the groups a user is a member of, and that also describes how you need to tackle this problem.
This code makes a lot of assumptions and also assumes that a user’s UID is named ‘uid’.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LDAP_SERVER = "ldaps://my-ldap-server.com/"
LDAP_BASE = "dc=my-ldap-server,dc=com"
def users_ldap_groups(uid):
""" Returns a list of the groups that the uid is a member of.
Returns False if it can't find the uid or throws an exception.
It's up to the caller to ensure that the UID they're using exists!
"""
logger.debug("uid: ", uid)
# ignore certificate errors
ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER)
l = ldap.initialize(LDAP_SERVER)
# this search for all objectClasses that user is in.
# change this to suit your LDAP schema
search_filter='(|(&(objectClass=*)(member=uid=%s,cn=users,cn=accounts,dc=my-ldap-server,dc=com)))' % uid
try:
# this returns the groups!
results = l.search_s(LDAP_BASE, ldap.SCOPE_SUBTREE, search_filter, ['cn',])
logger.debug('%s groups: %s' % (uid, results) )
return results
except ldap.NO_SUCH_OBJECT as e:
logger.error("{}:{}unable to lookup uid {} on LDAP server {}: {}".format(__file__, sys._getframe().f_code.co_name, uid, LDAP_SERVER, e))
return False
except Exception as e: # some other error occured
logger.error("{}:{}: other error occurred looking up {} in LDAP: {}".format(__file__, sys._getframe().f_code.co_name,uid,e))
return False
# shouldn't get here, but if we do, we don't have any results!
return False
View the code on Gist .
If there’s a better way to do this, let me know.
References:
This thread on the Python-LDAP mailing list was quite useful:
Linux, Python, Boston, Donegal.