{ "info": { "author": "Anton Strogonoff", "author_email": "anton@strogonoff.name", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "django-odesk-auth\n=================\n\nSimple oDesk (now Upwork) login for your Django-based project.\n\nAt current version it has inflexible and impossible to disable access control.\nIt suits my own needs so far but I plan to improve on this, given demand.\n\nTested with Django 1.6.\n\n**Note: oDesk rebranded as Upwork.**\nVersion 0.2.0 of this library depends on ``python-upwork`` instead of ``python-odesk``,\nand therefore works with new API endpoints.\nFurther support and development, if any, will only be continued for new\n``django-upwork-auth``, which is in the works. (See issue #4.)\n\n\nCreating oDesk OAuth API key\n----------------------------\n\nGo to https://www.odesk.com/services/api/apply.\n\n* Authentication type should be set to \"OAuth 1.0\".\n* Callback URL should be left blank.\n* Permission \"View the structure of your companies/teams\" is currently\n required to be checked.\n\n\nQuick start\n-----------\n\nProvided you have installed ``django-odesk-auth`` and ``python-upwork==1.0``.\n\n1. Add ``django_odesk_auth`` to INSTALLED_APPS.\n Make sure you have ``django.contrib.sites`` app in INSTALLED_APPS as well.\n\n2. Add ``django_odesk_auth.backends.ODeskOAuthBackend``\n to AUTHENTICATION_BACKENDS.\n\n3. Specify ``ODESK_OAUTH_KEY`` and ``ODESK_OAUTH_SECRET`` settings\n with your key information.\n\n4. Add your_username@odesk.com to ``ODESK_AUTH_ALLOWED_USERS``,\n and set ``ODESK_AUTH_CREATE_UNKNOWN_USER`` to True.\n\n5. Include ``django_odesk_auth.urls`` in your URL patterns.\n\n6. In your login page template, put a link \"Log in via oDesk\" and point it\n to ``{% url \"odesk_oauth_login\" %}``.\n\n7. Open login page and click \"Log in via oDesk\" to verify everything works.\n\nImportant: keep ``ODESK_OAUTH_KEY`` and ``ODESK_OAUTH_SECRET`` settings in a file\nthat is not under version control.\n\n\nExample project\n---------------\n\nRequirements: Vagrant, Ansible, and free 8000 port.\n\nFirst, fill in some critical settings in ``example_project/settings.py``\n(see comments in the file).\n\nFrom example_project directory, bring up a VM using provided Vagrantfile\nand run Django development server on it::\n\n $ vagrant up\n $ vagrant ssh\n vm$ cd /vagrant/example_project/\n vm$ ./manage.py runserver 0.0.0.0:8000\n\nOn your host machine, navigate to 127.0.0.1:8000 and you should be able\nto test Upwork login functionality.\n\n\nAccess control\n--------------\n\nApp has basic access control facilities.\n\nYou can specify who is allowed to log in to your site and who upon login gets\nstaff and/or superuser statuses. This is configured through Django settings.\n\nCurrently access control cannot be turned off.\nYou **have** to explicitly specify at least who is allowed to log in to your site.\n(Yes, this means you can't grant access to everyone yet, unless you hack the app.)\n\nUsers that aren't allowed to log in get ``User.is_active`` flag set to False.\nSee ``utils.update_user_permissions()`` definition if you're interested in other specifics,\nand see available settings below.\n\n\nMaking authenticated oDesk API calls\n------------------------------------\n\nAfter user is successfully authenticated, you can call oDesk API on their behalf.\n\nHere's a quick example::\n\n from django_odesk_auth import utils, O_ACCESS_TOKEN\n \n odesk_client = utils.get_client(request.session[O_ACCESS_TOKEN])\n print odesk_client.hr.get_teams()\n # Should output list of teams user has access to\n\nSome notes:\n\n* How you make API calls is up to you. Internally django-odesk-auth\n uses python-upwork library, and so does this example.\n\n* ``utils.get_client()`` function returns an instance of ``upwork.Client``.\n Handy if you're using python-upwork library to make API calls.\n\n* OAuth access token, obtained during authentication, is stored\n under ``request.session[O_ACCESS_TOKEN]``.\n\n\nChecking OAuth access token\n---------------------------\n\nSometimes there's a need to make sure that current user's authentication\nis still valid\u2014that they, for example, didn't revoke access to their account.\n\nFor that you can use ``utils.check_login()`` in Python, or make an AJAX request\nto named URL ``'odesk_oauth_check_login'`` from client side\n(see ``views.oauth_check_login``).\n\n\nAvailable Django settings\n-------------------------\n\nODESK_OAUTH_KEY, ODESK_OAUTH_SECRET \n API key information.\n\nODESK_AUTH_CREATE_UNKNOWN_USER = False \n Whether to create a new account in Django if given user logs in via oDesk\n for the first time.\n\nODESK_AUTH_ALLOWED_USERS = () \n oDesk emails of users who are allowed to log in via oDesk.\n\nODESK_AUTH_ADMINS = () \n oDesk emails of users who are marked as ``is_staff`` upon login.\n\nODESK_AUTH_SUPERUSERS = () \n oDesk emails of users who are marked as ``is_superuser`` upon login.\n\nODESK_AUTH_ALLOWED_TEAMS = () \n IDs of oDesk teams, members of which are allowed to log in via oDesk.\n\nODESK_AUTH_ADMIN_TEAMS = () \n IDs of oDesk teams, members of which are marked as ``is_staff`` upon login.\n\nODESK_AUTH_SUPERUSER_TEAMS = () \n IDs of oDesk teams, members of which are marked as ``is_superuser`` upon login.", "description_content_type": null, "docs_url": null, "download_url": "http://github.com/strogonoff/django-odesk-auth", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": null, "keywords": null, "license": "BSD License", "maintainer": null, "maintainer_email": null, "name": "django-odesk-auth", "package_url": "https://pypi.org/project/django-odesk-auth/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-odesk-auth/", "project_urls": { "Download": "http://github.com/strogonoff/django-odesk-auth" }, "release_url": "https://pypi.org/project/django-odesk-auth/0.2/", "requires_dist": null, "requires_python": null, "summary": "A simple Django app for basic \u201cLog in via Upwork\u201d functionality.", "version": "0.2" }, "last_serial": 1605088, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "a29b1c93d71701ca217c5c57b955d66c", "sha256": "e9186d9ac201c4fc6eaf2a811d1094bd639b0ac79c81b55913fce0b40deaa43c" }, "downloads": -1, "filename": "django-odesk-auth-0.1.0.tar.gz", "has_sig": false, "md5_digest": "a29b1c93d71701ca217c5c57b955d66c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7656, "upload_time": "2014-03-07T03:00:31", "url": "https://files.pythonhosted.org/packages/83/8e/dbb5be9d75ab416f6daaf8b70b967d4c97fa80a8d3fbcfe8b1bc4b5c8ca1/django-odesk-auth-0.1.0.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "fcca79865b39c7121ea9a50e1e079eb5", "sha256": "3255dfc2b76a3170eb5289a8cb2b4294d789ee67a05e1c4aade68035dded62c4" }, "downloads": -1, "filename": "django-odesk-auth-0.2.tar.gz", "has_sig": false, "md5_digest": "fcca79865b39c7121ea9a50e1e079eb5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8256, "upload_time": "2015-06-24T17:42:22", "url": "https://files.pythonhosted.org/packages/8f/2d/561e6ce8129cee23dbb3b9a059f30d98a94cb12b82883cb099a452069aec/django-odesk-auth-0.2.tar.gz" } ], "0.2-pre2": [ { "comment_text": "", "digests": { "md5": "4a6a5bee84c1a749f0959de3b7763e04", "sha256": "26adeea03443b6833512eafc99a5be0939909e5c3b284418f4a2aa665297ec1f" }, "downloads": -1, "filename": "django-odesk-auth-0.2-pre2.tar.gz", "has_sig": false, "md5_digest": "4a6a5bee84c1a749f0959de3b7763e04", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8268, "upload_time": "2015-06-15T22:48:14", "url": "https://files.pythonhosted.org/packages/29/44/b5e44ed62c36ee99c64119c4c25e6904e50b1f34e232294608cddb8554cd/django-odesk-auth-0.2-pre2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "fcca79865b39c7121ea9a50e1e079eb5", "sha256": "3255dfc2b76a3170eb5289a8cb2b4294d789ee67a05e1c4aade68035dded62c4" }, "downloads": -1, "filename": "django-odesk-auth-0.2.tar.gz", "has_sig": false, "md5_digest": "fcca79865b39c7121ea9a50e1e079eb5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8256, "upload_time": "2015-06-24T17:42:22", "url": "https://files.pythonhosted.org/packages/8f/2d/561e6ce8129cee23dbb3b9a059f30d98a94cb12b82883cb099a452069aec/django-odesk-auth-0.2.tar.gz" } ] }