{ "info": { "author": "Steven Mirabito", "author_email": "smirabito@csh.rit.edu", "bugtrack_url": null, "classifiers": [ "Natural Language :: English", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3" ], "description": "cshpy\r\n=====\r\n\r\nA collection of Python 3 utilities and wrappers for services run by [Computer Science House](http://csh.rit.edu/) at RIT.\r\n\r\n## Installation\r\n\r\n $ pip install cshpy3\r\n\r\n(or just download the source)\r\n\r\n## Basic Usage\r\n```python\r\n#!/usr/bin/python\r\nfrom csh.cshldap import LDAP\r\n\r\n# Creates a connection to CSH's LDAP server as an object with some helper functions\r\n# You can also omit the username and password to bind with a Kerberos ticket\r\nldap = LDAP('','')\r\n\r\n# Returns a list of results, in this case of users whose uid starts with 'duck'.\r\n# All CSH LDAP fields are included in a similar way.\r\nldap.search(uid='duck*')\r\n\r\n# This will return users whose common names (cn) start with 'Chris'\r\nldap.search(cn='Chris')\r\n\r\n# This will return users whose uid starts with 'user', and cn starts with 'Name'\r\nldap.search(uid='user*', cn='Name*')\r\n\r\n# Returns a dict of a user's attributes. Performs a search, and then grabs the first result.\r\n# Are you feelin' lucky?\r\nldap.member('uidValue')\r\n\r\n# Equivalent to search(uid='*')\r\nldap.members()\r\n\r\n# You may optionally include a search string.\r\n# Equivalent to search(uid='username')\r\nldap.members('test')\r\n```\r\n\r\n## Functions\r\n\r\n### search()\r\n\r\nSearch returns a list of tuples containing a string and a dictionary.\r\nThe first element of each tuple is the Distinguished Name (dn) of the entry.\r\nThis is the path to the entry in ldap. The second element of each tuple is a\r\ndictionary of attributes as keys.\r\n\r\nSpecific tweaks for CSH include the insertion of two fields, `groups` and `committee`.\r\nIf a member is on eboard, `committee` will have the name of their committee. Otherwise,\r\nthis field will not be present.\r\n`groups` will contain a list of all the groups a member belongs to.\r\n\r\nSo to be clear the return looks like this: `[('dn',{attributes})]`\r\n\r\nYou may optionally specify a different base than the default. `search(base=...)`\r\n\r\n####Word of caution: Not all results are guaranteed to have the same attribute fields\r\nin their dictionary. Do not depend on all users having a `twitterName` for example.\r\n\r\n### modify(uid, attr1=val1, attr2=val2)\r\n\r\nGiven a uid, and attribute values, modifies those values in ldap.\r\nYou may optionally specify a base other than Users.\r\n\r\n### member(uid)\r\n\r\nReturns a dict of attributes for the user. Equivalent to `search(uid=uid)[0][1]`.\r\n\r\n### members()\r\n\r\nReturns a list of users. Shorthand for `search(uid='*')`, or some variant *\r\n\r\n### group(cn)\r\nSearches groups by common name, returns a list of users in that group.\r\n\r\n### getGroups(dn)\r\nReturns a list of cns for groups the given member is a part of.\r\n\r\n### rtps()\r\n\r\nReturns a list of rtps. Shorthand for `group('rtp')`\r\n\r\n### drinkAdmins()\r\n\r\nReturns a list of drink admins. Shorthand for `group('drink')`\r\n\r\n### eboard()\r\n\r\nReturns a list of eboard members. Shorthand for `group('eboard')`", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "csh", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "cshpy3", "package_url": "https://pypi.org/project/cshpy3/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/cshpy3/", "project_urls": null, "release_url": "https://pypi.org/project/cshpy3/0.3.0/", "requires_dist": null, "requires_python": null, "summary": "A collection of Python 3 utilities and wrappers for services run by Computer Science House at RIT", "version": "0.3.0" }, "last_serial": 1897863, "releases": { "0.0.1.dev21": [], "0.3.0": [], "0.3.0.0a1.dev21": [ { "comment_text": "", "digests": { "md5": "36786a81e1b15a4259ebc422f3314120", "sha256": "49da7f123d3287f429738fbda25f0ecc740e95ea4dfc90c8d691df1199b22e25" }, "downloads": -1, "filename": "cshpy3-0.3.0.0a1.dev21-py3-none-any.whl", "has_sig": false, "md5_digest": "36786a81e1b15a4259ebc422f3314120", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10745, "upload_time": "2016-01-10T16:51:43", "url": "https://files.pythonhosted.org/packages/db/2b/a69c3d7d8bb5988066f9366f786a4db3e4a6f497e593381ac0b490897f83/cshpy3-0.3.0.0a1.dev21-py3-none-any.whl" } ] }, "urls": [] }