Giter Site home page Giter Site logo

fedora-infra / tahrir Goto Github PK

View Code? Open in Web Editor NEW
75.0 16.0 53.0 4.75 MB

Pyramid app for issuing your own Open Badges

Home Page: https://badges.fedoraproject.org/

License: Other

Python 23.91% CSS 41.95% JavaScript 14.32% Shell 0.14% HTML 19.69%
python fedora-project pyramid open-badges ansible javascript css web-development

tahrir's Introduction

Tahrir

Tahrir is a Flask application used by the Fedora Project for issuing Open Badges. As per the about page:

The concept of Open Badges originated among those working at the Mozilla and MacArthur foundations, and out of the research of Erin Knight, founding director of the Open Badges project at Mozilla.

Originally, information was hosted on the Mozilla Wiki.

Tahrir is Arabic for Liberation. The name is total overkill.

The project is hosted on Github. You can read the documentation for more details.

You can see Tahrir deployed in production, or in the staging instance.

PyPI Supported Python versions Build status Documentation

tahrir's People

Contributors

abompard avatar adamwill avatar bowlofeggs avatar calweb avatar cdelorme avatar clockfort avatar cverna avatar cydrobolt avatar decause avatar dependabot[bot] avatar dhgutteridge avatar dtgay avatar fluffybeing avatar gridhead avatar heis2201 avatar jamielinux avatar laxathom avatar lmacken avatar mscherer avatar nbebout avatar puiterwijk avatar pypingou avatar ralphbean avatar relrod avatar renovate[bot] avatar rossdylan avatar ryanlerch avatar sayanchowdhury avatar trishnaguha avatar yash256 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tahrir's Issues

Invitations should have a creator associated with them.

A created_by field that refers to an entry in the Person model.

Scenario:

  • Say you create three invitations for three different badges. Later you may want to login and be able to see a list of the ones you have that are still active, and which ones are expired.

Right now, there's no real way to keep track of them on a per-creator basis.

Admin view not properly escaped

Admin view's assertion form escapes <input>, but does not escape <label>
(security flaw)

Additionally, anyone knowing an administrator email can access admin page

Put badge image URL resolving code in its own method.

Currently, we have to do something like this to handle badge images:

% if badge.image.startswith("http"):
    src="${badge_images[assertion.badge_id]}"
% else:
    src="/pngs/${badge_images[assertion.badge_id]}"
% endif

It would be nice to just be able to pass a badge id to a method which would return the appropriate image URL.

Create a favicon

Once Tahrir has a logo, we should use it to make a sweet favicon :)

In the meantime, perhaps we can use the pyramid logo as a favicon?

Require only one-click for FAS oauth login

Right now, to login with FAS, you have to type your fas username in the login box and then click "login". You are taken to the FAS system where you click "OK" and then are redirected back to tahrir.

This was done this way because when it was written, the FAS system would throw an error if you tried to authenticate without providing a username first. This has since been resolved with https://fedorahosted.org/fas/ticket/160

It would be nicer if the user (on tahrir's page) only had to click "login". They would then be taken to FAS which would prompt them for their username if they weren't already logged in, thus removing the extra step from tahrir's side of the equation.

Note that, we won't really get to work on this until https://fedorahosted.org/fas/ticket/160 has been deployed to production.

Award badges via QRcode

An admin should be able to login to tahrir and create a QRcode that is valid for some timespan.

Users who scan that qrcode are taken to a link that then awards them that badge in the db.

This is for stuff like conferences where you want the attendees to get a badge.

Remove hardcoded salt in tahrir-api

In a separate repo there is another project called tahrir-api -> https://github.com/ralphbean/tahrir-api

There in tahrir_api/model.py there is a salt_default function that just returns the default "salt" value that I used when I first wrote tahrir. We need to replace that to instead return the value from the Pyramid config (the value assigned to tahrir.salt in development.ini). This should be available through some Pyramid config object.. but you'll have to read through the docs and experiment to figure it out.

Use pyramid's __acl__ machinery instead of the is_admin function.

When I first wrote tahrir, I was also learning the Pyramid framework at the same time. I implemented my own is_admin function in tahrir/views.py that checked to see if the logged in user was one of the users listed in the tahrir.admin value in the config.

This works, but is kind of clumsy. Pyramid provides a very robust and scalable security framework that I haven't had a chance to use yet: http://docs.pylonsproject.org/projects/pyramid/en/1.0-branch/narr/security.html

It would be excellent if someone could remove all the references to my clumsy is_admin method and replace it with "proper" pyramid authorization code. This will likely take us a few tries to get it correct.

pip installable

It would be awesome if you could pip install tahrir and run a copy of your own easily.

Relicense from AGPLv3+ to AVPLv3+ with exceptions

I'm going to relicense tahrir from AGPLv3+ to AGPLv3+ with the following additional permission:

If you modify the Program, and your modified version becomes subject
to the requirement stated in AGPLv3, section 13, you may satisfy
this requirement by providing access to the Corresponding Source of
your modified version to each user that explicitly requests such
Corresponding Source, no later than 15 days following the date on
which such request was received.

The following people have contributed commits to tahrir. Their public consent will be required before the relicensing is complete:

Contributors will need to email this list with their consent.

Idea: For community-awarded badges, allow users to request an invitiation

@decause has a worthwhile idea, which I will explain with an example:

Joe checks out Antonio's profile and sees that he has earned the Super-Awesome Hackathon 2013 badge. Joe is bummed, because he also attended that event, and wants the badge. Joe can press a button that will open a text box, allowing him to type a special request that the issuer sends him an invite for that badge.

Of course, there are matters of spam to consider. Users who issue many special requests which are denied should be restricted from sending further requests.

Pull username from FAS when possible.

I know we want to keep the authentication pluggable, but we should be able to request the user's username via openid. Let's store it if we can get it.

Easy theme customization.

It'd be easy to make a few parts of Tahrir's theming pluggable so folks can set up their own Tahrir instances with non-Fedora themes.

  • There is already a setting to use custom CSS, I do believe it works fine.
  • We can add an option for logo URL to the settings file.
  • We can potentially set up settings for a few colours (primary, secondary, links, etc) so that people can easily tweak the colour scheme without diving into the CSS. This may be a little more tricky to do well.

Smoothly redirect to and from login

Scenario:

  • The user is not logged in.
  • They try to access the /admin page.

Right now they just get redirected to /.

It would be better if they were automatically redirected to FAS login and then redirected back to /admin (where they originally wanted to go).

Embeddable badges view

There has been interest in the badges mailing list of producing a simple, embedded widget that can be used to display some badges on another site, like a user's blog, or in a forum signature. This is for down the road, but a good idea that should be implemented.

rollover tooltip sometimes persists after mouseoff

Working on tahrir in Firefox under Fedora 17. The pop-up with the JSON blob sometimes persists after the mouse is no longer hovering on the link. Getting rid of it requires moving the mouse on and off the link in different fashions until it finally registers and the popup disappears (or just reloading the page).

I'm not sure what's doing this or what determines if it happens, but I think it has to do with how the code is "listening" for the mouseoff event. I will see if I can fix things. :)

edit: forgot to add this handy image:

image

Make the authn system pluggable

Right now, tahrir is hardcoded to use FAS/oauth for authentication. This is nice for our use case in Fedora, but if someone else wanted to run an instance of tahrir it wouldn't make sense. They may want to use GitHub or Twitter (or whatever) for authentication.

We already use velruse which gets us halfway there. http://packages.python.org/velruse/index.html

Velruse provides mechanisms for authenticating against all different kinds of identity providers. We should allow the user to specify which identity provider they want to use in the config file (development.ini) and not be biased about which one tahrir "prefers".

Maybe tahrir should authenticate using Github by default "out of the box" but we should include our FAS/oauth setup as an example in the documentation.

Delete things from the admin menu

It would seem that I've already added improper/incorrect badge information to tahrir. ๐Ÿ˜ (My next badge I create will be the 'doing it wrong' badge, which I will award to myself.)

Perhaps it would be a good idea to be able to delete badges, or people, or issuers, via the admin interface?

Move global variables to proper homes.

There are a few variables which are displayed on all/most views via the master template, master.mak. These include:

  • awarded_assertions (for logged in users, number of assertions waiting to be accepted)
  • logged_in (should be moved to Pyramid authentication)
  • base_url (the app's base url)
  • title (the page title)
  • is_admin (should be moved to Pyramid authentication)

These variables currently are passed to the template via the returned dict in each view. We should move these variables in their proper homes. logged_in and is_admin should be done through Pyramid auth. groups. title and base_url never really need to change, so we should figure out how to pull those from our settings dict and make them always-available. awarded_assertions might find a good home in the Pyramid headers; it could be passed around everywhere, since it is always going to be displayed on the page.

Two things which are sub-fun for me are knowing where to look in Pyramid documentation and writing authentication/authorization code. Therefore, any contributions to this issue are accepted with a huge smile and a high-five.

OpenID Integration Broken on First Import

The second time I log in with OpenID, it works, but the first time, when loading a URL like this one:

http://badges.helixoide.com/dologin.html?janrain_nonce=2012-07-19T18%3A07%3A46ZF2KN0q&openid.assoc_handle=%7BHMAC-SHA1%7D%7B500476e4%7D%7Bk1cF7Q%3D%3D%7D&openid.claimed_id=https%3A%2F%2Fadmin.fedoraproject.org%2Faccounts%2Fopenid%2Fid%2Fclockfort%2F&openid.identity=https%3A%2F%2Fadmin.fedoraproject.org%2Faccounts%2Fopenid%2Fid%2Fclockfort&openid.mode=id_res&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.sreg=http%3A%2F%2Fopenid.net%2Fextensions%2Fsreg%2F1.1&openid.op_endpoint=https%3A%2F%2Fadmin.fedoraproject.org%2Faccounts%2Fopenid%2Fserver&openid.response_nonce=2012-07-19T18%3A04%3A21Z2yUabA&openid.return_to=http%3A%2F%2Fbadges.helixoide.com%2Fdologin.html%3Fjanrain_nonce%3D2012-07-19T18%253A07%253A46ZF2KN0q&openid.sig=m6WXXQt%2BFRSxz9Z%2B%2BzZMM1ZhKWU%3D&openid.signed=assoc_handle%2Cclaimed_id%2Cidentity%2Cmode%2Cns%2Cns.sreg%2Cop_endpoint%2Cresponse_nonce%2Creturn_to%2Csigned%2Csreg.email&openid.sreg.email=clockfor%40redhat.com

it fails, with "A server error occurred. Please contact the administrator."

Render badge descriptions from .rst to html

I'm going to keep badge descriptions as .rst in the database (sometimes one sentence with no markup. Sometimes three paragraphs with a little markup).

We can use the docutils module to render those to html snippets when serving requests in the tahrir web interface.

This example will be useful in getting a head start on this. It is more complicated than what we need to do. There, it is opening an API.rst file and converting that to html. here we only need to do it for badge.description.

Fix error code images.

Currently, there are two images displayed on error pages (like 404). In these images, the text within the pink circle is white. With our new white background, this will have to be changed. Perhaps @Jenneh can create some cool logos, or we can use standard Fedora ones?

Server-Side Image Resizing

Since images are being stored locally into the local server's /png/{HASH}.png, there is no reason to not resize them server-side to a standard badge resolution

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.